void JobProvider::enqueue() { // Add this provider to the end of the thread pool's job provider list X265_CHECK(!m_nextProvider && !m_prevProvider && m_pool, "job provider was already queued\n"); m_pool->enqueueJobProvider(*this); m_pool->pokeIdleThread(); }
void ThreadPoolImpl::release() { if (--m_referenceCount == 0) { X265_CHECK(this == ThreadPoolImpl::s_instance, "multiple thread pool instances detected\n"); ThreadPoolImpl::s_instance = NULL; this->Stop(); delete this; } }
bool ThreadPool::create(int numThreads, int maxProviders, int node) { X265_CHECK(numThreads <= MAX_POOL_THREADS, "a single thread pool cannot have more than MAX_POOL_THREADS threads\n"); m_numaNode = node; m_numWorkers = numThreads; m_workers = X265_MALLOC(WorkerThread, numThreads); /* placement new initialization */ if (m_workers) for (int i = 0; i < numThreads; i++) new (m_workers + i)WorkerThread(*this, i); m_jpTable = X265_MALLOC(JobProvider*, maxProviders); m_numProviders = 0; return m_workers && m_jpTable; }
/* get address of default quantization matrix */ const int32_t* ScalingList::getScalingListDefaultAddress(int sizeId, int listId) const { switch (sizeId) { case BLOCK_4x4: return quantTSDefault4x4; case BLOCK_8x8: return (listId < 3) ? quantIntraDefault8x8 : quantInterDefault8x8; case BLOCK_16x16: return (listId < 3) ? quantIntraDefault8x8 : quantInterDefault8x8; case BLOCK_32x32: return (listId < 1) ? quantIntraDefault8x8 : quantInterDefault8x8; default: break; } X265_CHECK(0, "invalid scaling list size\n"); return NULL; }
ThreadPool *ThreadPool::getThreadPool() { X265_CHECK(ThreadPoolImpl::s_instance, "getThreadPool() called prior to allocThreadPool()\n"); return ThreadPoolImpl::s_instance; }