Initialize multi/single-thread worker
| 639 | |
| 640 | // Initialize multi/single-thread worker |
| 641 | static int InitThreadContext(VP8Decoder* const dec) { |
| 642 | dec->cache_id_ = 0; |
| 643 | if (dec->mt_method_ > 0) { |
| 644 | WebPWorker* const worker = &dec->worker_; |
| 645 | if (!WebPGetWorkerInterface()->Reset(worker)) { |
| 646 | return VP8SetError(dec, VP8_STATUS_OUT_OF_MEMORY, |
| 647 | "thread initialization failed."); |
| 648 | } |
| 649 | worker->data1 = dec; |
| 650 | worker->data2 = (void*)&dec->thread_ctx_.io_; |
| 651 | worker->hook = FinishRow; |
| 652 | dec->num_caches_ = |
| 653 | (dec->filter_type_ > 0) ? MT_CACHE_LINES : MT_CACHE_LINES - 1; |
| 654 | } else { |
| 655 | dec->num_caches_ = ST_CACHE_LINES; |
| 656 | } |
| 657 | return 1; |
| 658 | } |
| 659 | |
| 660 | int VP8GetThreadMethod(const WebPDecoderOptions* const options, |
| 661 | const WebPHeaderStructure* const headers, |
no test coverage detected