Commit 04d2e574 authored by Jingning Han's avatar Jingning Han

Use vpx prefix for codec independent threading functions

Replace vp9_ prefix with vpx_ for common multi-threading functions.

Change-Id: I941a5ead9bfe8213fdad345511d2061b07797b55
parent 3a3b0be0
...@@ -24,27 +24,27 @@ namespace { ...@@ -24,27 +24,27 @@ namespace {
using std::string; using std::string;
class VP9WorkerThreadTest : public ::testing::TestWithParam<bool> { class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
protected: protected:
virtual ~VP9WorkerThreadTest() {} virtual ~VPxWorkerThreadTest() {}
virtual void SetUp() { virtual void SetUp() {
vp9_get_worker_interface()->init(&worker_); vpx_get_worker_interface()->init(&worker_);
} }
virtual void TearDown() { virtual void TearDown() {
vp9_get_worker_interface()->end(&worker_); vpx_get_worker_interface()->end(&worker_);
} }
void Run(VP9Worker* worker) { void Run(VPxWorker* worker) {
const bool synchronous = GetParam(); const bool synchronous = GetParam();
if (synchronous) { if (synchronous) {
vp9_get_worker_interface()->execute(worker); vpx_get_worker_interface()->execute(worker);
} else { } else {
vp9_get_worker_interface()->launch(worker); vpx_get_worker_interface()->launch(worker);
} }
} }
VP9Worker worker_; VPxWorker worker_;
}; };
int ThreadHook(void* data, void* return_value) { int ThreadHook(void* data, void* return_value) {
...@@ -53,12 +53,12 @@ int ThreadHook(void* data, void* return_value) { ...@@ -53,12 +53,12 @@ int ThreadHook(void* data, void* return_value) {
return *reinterpret_cast<int*>(return_value); return *reinterpret_cast<int*>(return_value);
} }
TEST_P(VP9WorkerThreadTest, HookSuccess) { TEST_P(VPxWorkerThreadTest, HookSuccess) {
// should be a no-op. // should be a no-op.
EXPECT_NE(vp9_get_worker_interface()->sync(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
EXPECT_NE(vp9_get_worker_interface()->reset(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
int hook_data = 0; int hook_data = 0;
int return_value = 1; // return successfully from the hook int return_value = 1; // return successfully from the hook
...@@ -67,17 +67,17 @@ TEST_P(VP9WorkerThreadTest, HookSuccess) { ...@@ -67,17 +67,17 @@ TEST_P(VP9WorkerThreadTest, HookSuccess) {
worker_.data2 = &return_value; worker_.data2 = &return_value;
Run(&worker_); Run(&worker_);
EXPECT_NE(vp9_get_worker_interface()->sync(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
EXPECT_FALSE(worker_.had_error); EXPECT_FALSE(worker_.had_error);
EXPECT_EQ(5, hook_data); EXPECT_EQ(5, hook_data);
// should be a no-op. // should be a no-op.
EXPECT_NE(vp9_get_worker_interface()->sync(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
} }
} }
TEST_P(VP9WorkerThreadTest, HookFailure) { TEST_P(VPxWorkerThreadTest, HookFailure) {
EXPECT_NE(vp9_get_worker_interface()->reset(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
int hook_data = 0; int hook_data = 0;
int return_value = 0; // return failure from the hook int return_value = 0; // return failure from the hook
...@@ -86,29 +86,29 @@ TEST_P(VP9WorkerThreadTest, HookFailure) { ...@@ -86,29 +86,29 @@ TEST_P(VP9WorkerThreadTest, HookFailure) {
worker_.data2 = &return_value; worker_.data2 = &return_value;
Run(&worker_); Run(&worker_);
EXPECT_FALSE(vp9_get_worker_interface()->sync(&worker_)); EXPECT_FALSE(vpx_get_worker_interface()->sync(&worker_));
EXPECT_EQ(1, worker_.had_error); EXPECT_EQ(1, worker_.had_error);
// Ensure _reset() clears the error and _launch() can be called again. // Ensure _reset() clears the error and _launch() can be called again.
return_value = 1; return_value = 1;
EXPECT_NE(vp9_get_worker_interface()->reset(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
EXPECT_FALSE(worker_.had_error); EXPECT_FALSE(worker_.had_error);
vp9_get_worker_interface()->launch(&worker_); vpx_get_worker_interface()->launch(&worker_);
EXPECT_NE(vp9_get_worker_interface()->sync(&worker_), 0); EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
EXPECT_FALSE(worker_.had_error); EXPECT_FALSE(worker_.had_error);
} }
TEST_P(VP9WorkerThreadTest, EndWithoutSync) { TEST_P(VPxWorkerThreadTest, EndWithoutSync) {
// Create a large number of threads to increase the chances of detecting a // Create a large number of threads to increase the chances of detecting a
// race. Doing more work in the hook is no guarantee as any race would occur // race. Doing more work in the hook is no guarantee as any race would occur
// post hook execution in the main thread loop driver. // post hook execution in the main thread loop driver.
static const int kNumWorkers = 64; static const int kNumWorkers = 64;
VP9Worker workers[kNumWorkers]; VPxWorker workers[kNumWorkers];
int hook_data[kNumWorkers]; int hook_data[kNumWorkers];
int return_value[kNumWorkers]; int return_value[kNumWorkers];
for (int n = 0; n < kNumWorkers; ++n) { for (int n = 0; n < kNumWorkers; ++n) {
vp9_get_worker_interface()->init(&workers[n]); vpx_get_worker_interface()->init(&workers[n]);
return_value[n] = 1; // return successfully from the hook return_value[n] = 1; // return successfully from the hook
workers[n].hook = ThreadHook; workers[n].hook = ThreadHook;
workers[n].data1 = &hook_data[n]; workers[n].data1 = &hook_data[n];
...@@ -117,7 +117,7 @@ TEST_P(VP9WorkerThreadTest, EndWithoutSync) { ...@@ -117,7 +117,7 @@ TEST_P(VP9WorkerThreadTest, EndWithoutSync) {
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
for (int n = 0; n < kNumWorkers; ++n) { for (int n = 0; n < kNumWorkers; ++n) {
EXPECT_NE(vp9_get_worker_interface()->reset(&workers[n]), 0); EXPECT_NE(vpx_get_worker_interface()->reset(&workers[n]), 0);
hook_data[n] = 0; hook_data[n] = 0;
} }
...@@ -126,16 +126,16 @@ TEST_P(VP9WorkerThreadTest, EndWithoutSync) { ...@@ -126,16 +126,16 @@ TEST_P(VP9WorkerThreadTest, EndWithoutSync) {
} }
for (int n = kNumWorkers - 1; n >= 0; --n) { for (int n = kNumWorkers - 1; n >= 0; --n) {
vp9_get_worker_interface()->end(&workers[n]); vpx_get_worker_interface()->end(&workers[n]);
} }
} }
} }
TEST(VP9WorkerThreadTest, TestInterfaceAPI) { TEST(VPxWorkerThreadTest, TestInterfaceAPI) {
EXPECT_EQ(0, vp9_set_worker_interface(NULL)); EXPECT_EQ(0, vpx_set_worker_interface(NULL));
EXPECT_TRUE(vp9_get_worker_interface() != NULL); EXPECT_TRUE(vpx_get_worker_interface() != NULL);
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
VP9WorkerInterface winterface = *vp9_get_worker_interface(); VPxWorkerInterface winterface = *vpx_get_worker_interface();
switch (i) { switch (i) {
default: default:
case 0: winterface.init = NULL; break; case 0: winterface.init = NULL; break;
...@@ -145,7 +145,7 @@ TEST(VP9WorkerThreadTest, TestInterfaceAPI) { ...@@ -145,7 +145,7 @@ TEST(VP9WorkerThreadTest, TestInterfaceAPI) {
case 4: winterface.execute = NULL; break; case 4: winterface.execute = NULL; break;
case 5: winterface.end = NULL; break; case 5: winterface.end = NULL; break;
} }
EXPECT_EQ(0, vp9_set_worker_interface(&winterface)); EXPECT_EQ(0, vpx_set_worker_interface(&winterface));
} }
} }
...@@ -202,21 +202,21 @@ void DecodeFiles(const FileList files[]) { ...@@ -202,21 +202,21 @@ void DecodeFiles(const FileList files[]) {
// hang. // hang.
namespace impl { namespace impl {
void Init(VP9Worker *const worker) { memset(worker, 0, sizeof(*worker)); } void Init(VPxWorker *const worker) { memset(worker, 0, sizeof(*worker)); }
int Reset(VP9Worker *const /*worker*/) { return 1; } int Reset(VPxWorker *const /*worker*/) { return 1; }
int Sync(VP9Worker *const worker) { return !worker->had_error; } int Sync(VPxWorker *const worker) { return !worker->had_error; }
void Execute(VP9Worker *const worker) { void Execute(VPxWorker *const worker) {
worker->had_error |= !worker->hook(worker->data1, worker->data2); worker->had_error |= !worker->hook(worker->data1, worker->data2);
} }
void Launch(VP9Worker *const worker) { Execute(worker); } void Launch(VPxWorker *const worker) { Execute(worker); }
void End(VP9Worker *const /*worker*/) {} void End(VPxWorker *const /*worker*/) {}
} // namespace impl } // namespace impl
TEST(VP9WorkerThreadTest, TestSerialInterface) { TEST(VPxWorkerThreadTest, TestSerialInterface) {
static const VP9WorkerInterface serial_interface = { static const VPxWorkerInterface serial_interface = {
impl::Init, impl::Reset, impl::Sync, impl::Launch, impl::Execute, impl::End impl::Init, impl::Reset, impl::Sync, impl::Launch, impl::Execute, impl::End
}; };
// TODO(jzern): Avoid using a file that will use the row-based thread // TODO(jzern): Avoid using a file that will use the row-based thread
...@@ -225,13 +225,13 @@ TEST(VP9WorkerThreadTest, TestSerialInterface) { ...@@ -225,13 +225,13 @@ TEST(VP9WorkerThreadTest, TestSerialInterface) {
// progress in the row above before proceeding. // progress in the row above before proceeding.
static const char expected_md5[] = "b35a1b707b28e82be025d960aba039bc"; static const char expected_md5[] = "b35a1b707b28e82be025d960aba039bc";
static const char filename[] = "vp90-2-03-size-226x226.webm"; static const char filename[] = "vp90-2-03-size-226x226.webm";
VP9WorkerInterface default_interface = *vp9_get_worker_interface(); VPxWorkerInterface default_interface = *vpx_get_worker_interface();
EXPECT_NE(vp9_set_worker_interface(&serial_interface), 0); EXPECT_NE(vpx_set_worker_interface(&serial_interface), 0);
EXPECT_EQ(expected_md5, DecodeFile(filename, 2)); EXPECT_EQ(expected_md5, DecodeFile(filename, 2));
// Reset the interface. // Reset the interface.
EXPECT_NE(vp9_set_worker_interface(&default_interface), 0); EXPECT_NE(vpx_set_worker_interface(&default_interface), 0);
EXPECT_EQ(expected_md5, DecodeFile(filename, 2)); EXPECT_EQ(expected_md5, DecodeFile(filename, 2));
} }
...@@ -309,6 +309,6 @@ TEST(VP9DecodeMultiThreadedTest, Decode3) { ...@@ -309,6 +309,6 @@ TEST(VP9DecodeMultiThreadedTest, Decode3) {
} }
#endif // CONFIG_WEBM_IO #endif // CONFIG_WEBM_IO
INSTANTIATE_TEST_CASE_P(Synchronous, VP9WorkerThreadTest, ::testing::Bool()); INSTANTIATE_TEST_CASE_P(Synchronous, VPxWorkerThreadTest, ::testing::Bool());
} // namespace } // namespace
...@@ -80,7 +80,7 @@ typedef struct { ...@@ -80,7 +80,7 @@ typedef struct {
// frame_worker_owner indicates which FrameWorker owns this buffer. NULL means // frame_worker_owner indicates which FrameWorker owns this buffer. NULL means
// that no FrameWorker owns, or is decoding, this buffer. // that no FrameWorker owns, or is decoding, this buffer.
VP9Worker *frame_worker_owner; VPxWorker *frame_worker_owner;
// row and col indicate which position frame has been decoded to in real // row and col indicate which position frame has been decoded to in real
// pixel unit. They are reset to -1 when decoding begins and set to INT_MAX // pixel unit. They are reset to -1 when decoding begins and set to INT_MAX
......
...@@ -157,9 +157,9 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, ...@@ -157,9 +157,9 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame,
VP9_COMMON *cm, VP9_COMMON *cm,
struct macroblockd_plane planes[MAX_MB_PLANE], struct macroblockd_plane planes[MAX_MB_PLANE],
int start, int stop, int y_only, int start, int stop, int y_only,
VP9Worker *workers, int nworkers, VPxWorker *workers, int nworkers,
VP9LfSync *lf_sync) { VP9LfSync *lf_sync) {
const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
// Number of superblock rows and cols // Number of superblock rows and cols
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2; const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
// Decoder may allocate more threads than number of tiles based on user's // Decoder may allocate more threads than number of tiles based on user's
...@@ -186,10 +186,10 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, ...@@ -186,10 +186,10 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame,
// because of contention. If the multithreading code changes in the future // because of contention. If the multithreading code changes in the future
// then the number of workers used by the loopfilter should be revisited. // then the number of workers used by the loopfilter should be revisited.
for (i = 0; i < num_workers; ++i) { for (i = 0; i < num_workers; ++i) {
VP9Worker *const worker = &workers[i]; VPxWorker *const worker = &workers[i];
LFWorkerData *const lf_data = &lf_sync->lfdata[i]; LFWorkerData *const lf_data = &lf_sync->lfdata[i];
worker->hook = (VP9WorkerHook)loop_filter_row_worker; worker->hook = (VPxWorkerHook)loop_filter_row_worker;
worker->data1 = lf_sync; worker->data1 = lf_sync;
worker->data2 = lf_data; worker->data2 = lf_data;
...@@ -218,7 +218,7 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, ...@@ -218,7 +218,7 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
struct macroblockd_plane planes[MAX_MB_PLANE], struct macroblockd_plane planes[MAX_MB_PLANE],
int frame_filter_level, int frame_filter_level,
int y_only, int partial_frame, int y_only, int partial_frame,
VP9Worker *workers, int num_workers, VPxWorker *workers, int num_workers,
VP9LfSync *lf_sync) { VP9LfSync *lf_sync) {
int start_mi_row, end_mi_row, mi_rows_to_filter; int start_mi_row, end_mi_row, mi_rows_to_filter;
......
...@@ -48,7 +48,7 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, ...@@ -48,7 +48,7 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
struct macroblockd_plane planes[MAX_MB_PLANE], struct macroblockd_plane planes[MAX_MB_PLANE],
int frame_filter_level, int frame_filter_level,
int y_only, int partial_frame, int y_only, int partial_frame,
VP9Worker *workers, int num_workers, VPxWorker *workers, int num_workers,
VP9LfSync *lf_sync); VP9LfSync *lf_sync);
void vp9_accumulate_frame_counts(struct VP9Common *cm, void vp9_accumulate_frame_counts(struct VP9Common *cm,
......
...@@ -1259,7 +1259,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, ...@@ -1259,7 +1259,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
const uint8_t *data, const uint8_t *data,
const uint8_t *data_end) { const uint8_t *data_end) {
VP9_COMMON *const cm = &pbi->common; VP9_COMMON *const cm = &pbi->common;
const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols); const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols);
const int tile_cols = 1 << cm->log2_tile_cols; const int tile_cols = 1 << cm->log2_tile_cols;
const int tile_rows = 1 << cm->log2_tile_rows; const int tile_rows = 1 << cm->log2_tile_rows;
...@@ -1272,7 +1272,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, ...@@ -1272,7 +1272,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
pbi->lf_worker.data1 == NULL) { pbi->lf_worker.data1 == NULL) {
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
vpx_memalign(32, sizeof(LFWorkerData))); vpx_memalign(32, sizeof(LFWorkerData)));
pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker; pbi->lf_worker.hook = (VPxWorkerHook)vp9_loop_filter_worker;
if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) { if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) {
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
"Loop filter thread creation failed"); "Loop filter thread creation failed");
...@@ -1434,7 +1434,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, ...@@ -1434,7 +1434,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
const uint8_t *data, const uint8_t *data,
const uint8_t *data_end) { const uint8_t *data_end) {
VP9_COMMON *const cm = &pbi->common; VP9_COMMON *const cm = &pbi->common;
const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
const uint8_t *bit_reader_end = NULL; const uint8_t *bit_reader_end = NULL;
const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols); const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
const int tile_cols = 1 << cm->log2_tile_cols; const int tile_cols = 1 << cm->log2_tile_cols;
...@@ -1464,7 +1464,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, ...@@ -1464,7 +1464,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
CHECK_MEM_ERROR(cm, pbi->tile_worker_info, CHECK_MEM_ERROR(cm, pbi->tile_worker_info,
vpx_malloc(num_threads * sizeof(*pbi->tile_worker_info))); vpx_malloc(num_threads * sizeof(*pbi->tile_worker_info)));
for (i = 0; i < num_threads; ++i) { for (i = 0; i < num_threads; ++i) {
VP9Worker *const worker = &pbi->tile_workers[i]; VPxWorker *const worker = &pbi->tile_workers[i];
++pbi->num_tile_workers; ++pbi->num_tile_workers;
winterface->init(worker); winterface->init(worker);
...@@ -1477,9 +1477,9 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, ...@@ -1477,9 +1477,9 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
// Reset tile decoding hook // Reset tile decoding hook
for (n = 0; n < num_workers; ++n) { for (n = 0; n < num_workers; ++n) {
VP9Worker *const worker = &pbi->tile_workers[n]; VPxWorker *const worker = &pbi->tile_workers[n];
winterface->sync(worker); winterface->sync(worker);
worker->hook = (VP9WorkerHook)tile_worker_hook; worker->hook = (VPxWorkerHook)tile_worker_hook;
worker->data1 = &pbi->tile_worker_data[n]; worker->data1 = &pbi->tile_worker_data[n];
worker->data2 = &pbi->tile_worker_info[n]; worker->data2 = &pbi->tile_worker_info[n];
} }
...@@ -1529,7 +1529,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, ...@@ -1529,7 +1529,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
while (n < tile_cols) { while (n < tile_cols) {
int i; int i;
for (i = 0; i < num_workers && n < tile_cols; ++i) { for (i = 0; i < num_workers && n < tile_cols; ++i) {
VP9Worker *const worker = &pbi->tile_workers[i]; VPxWorker *const worker = &pbi->tile_workers[i];
TileWorkerData *const tile_data = (TileWorkerData*)worker->data1; TileWorkerData *const tile_data = (TileWorkerData*)worker->data1;
TileInfo *const tile = (TileInfo*)worker->data2; TileInfo *const tile = (TileInfo*)worker->data2;
TileBuffer *const buf = &tile_buffers[0][n]; TileBuffer *const buf = &tile_buffers[0][n];
...@@ -1561,7 +1561,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, ...@@ -1561,7 +1561,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
} }
for (; i > 0; --i) { for (; i > 0; --i) {
VP9Worker *const worker = &pbi->tile_workers[i - 1]; VPxWorker *const worker = &pbi->tile_workers[i - 1];
// TODO(jzern): The tile may have specific error data associated with // TODO(jzern): The tile may have specific error data associated with
// its vpx_internal_error_info which could be propagated to the main info // its vpx_internal_error_info which could be propagated to the main info
// in cm. Additionally once the threads have been synced and an error is // in cm. Additionally once the threads have been synced and an error is
...@@ -2020,7 +2020,7 @@ void vp9_decode_frame(VP9Decoder *pbi, ...@@ -2020,7 +2020,7 @@ void vp9_decode_frame(VP9Decoder *pbi,
// If encoded in frame parallel mode, frame context is ready after decoding // If encoded in frame parallel mode, frame context is ready after decoding
// the frame header. // the frame header.
if (pbi->frame_parallel_decode && cm->frame_parallel_decoding_mode) { if (pbi->frame_parallel_decode && cm->frame_parallel_decoding_mode) {
VP9Worker *const worker = pbi->frame_worker_owner; VPxWorker *const worker = pbi->frame_worker_owner;
FrameWorkerData *const frame_worker_data = worker->data1; FrameWorkerData *const frame_worker_data = worker->data1;
if (cm->refresh_frame_context) { if (cm->refresh_frame_context) {
context_updated = 1; context_updated = 1;
......
...@@ -118,7 +118,7 @@ VP9Decoder *vp9_decoder_create(BufferPool *const pool) { ...@@ -118,7 +118,7 @@ VP9Decoder *vp9_decoder_create(BufferPool *const pool) {
cm->error.setjmp = 0; cm->error.setjmp = 0;
vp9_get_worker_interface()->init(&pbi->lf_worker); vpx_get_worker_interface()->init(&pbi->lf_worker);
return pbi; return pbi;
} }
...@@ -126,12 +126,12 @@ VP9Decoder *vp9_decoder_create(BufferPool *const pool) { ...@@ -126,12 +126,12 @@ VP9Decoder *vp9_decoder_create(BufferPool *const pool) {
void vp9_decoder_remove(VP9Decoder *pbi) { void vp9_decoder_remove(VP9Decoder *pbi) {
int i; int i;
vp9_get_worker_interface()->end(&pbi->lf_worker); vpx_get_worker_interface()->end(&pbi->lf_worker);
vpx_free(pbi->lf_worker.data1); vpx_free(pbi->lf_worker.data1);
vpx_free(pbi->tile_data); vpx_free(pbi->tile_data);
for (i = 0; i < pbi->num_tile_workers; ++i) { for (i = 0; i < pbi->num_tile_workers; ++i) {
VP9Worker *const worker = &pbi->tile_workers[i]; VPxWorker *const worker = &pbi->tile_workers[i];
vp9_get_worker_interface()->end(worker); vpx_get_worker_interface()->end(worker);
} }
vpx_free(pbi->tile_worker_data); vpx_free(pbi->tile_worker_data);
vpx_free(pbi->tile_worker_info); vpx_free(pbi->tile_worker_info);
...@@ -311,7 +311,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, ...@@ -311,7 +311,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi,
pbi->hold_ref_buf = 0; pbi->hold_ref_buf = 0;
if (pbi->frame_parallel_decode) { if (pbi->frame_parallel_decode) {
VP9Worker *const worker = pbi->frame_worker_owner; VPxWorker *const worker = pbi->frame_worker_owner;
vp9_frameworker_lock_stats(worker); vp9_frameworker_lock_stats(worker);
frame_bufs[cm->new_fb_idx].frame_worker_owner = worker; frame_bufs[cm->new_fb_idx].frame_worker_owner = worker;
// Reset decoding progress. // Reset decoding progress.
...@@ -325,7 +325,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, ...@@ -325,7 +325,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi,
if (setjmp(cm->error.jmp)) { if (setjmp(cm->error.jmp)) {
const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
int i; int i;
cm->error.setjmp = 0; cm->error.setjmp = 0;
...@@ -387,7 +387,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi, ...@@ -387,7 +387,7 @@ int vp9_receive_compressed_data(VP9Decoder *pbi,
if (pbi->frame_parallel_decode) { if (pbi->frame_parallel_decode) {
// Need to lock the mutex here as another thread may // Need to lock the mutex here as another thread may
// be accessing this buffer. // be accessing this buffer.
VP9Worker *const worker = pbi->frame_worker_owner; VPxWorker *const worker = pbi->frame_worker_owner;
FrameWorkerData *const frame_worker_data = worker->data1; FrameWorkerData *const frame_worker_data = worker->data1;
vp9_frameworker_lock_stats(worker); vp9_frameworker_lock_stats(worker);
......
...@@ -57,9 +57,9 @@ typedef struct VP9Decoder { ...@@ -57,9 +57,9 @@ typedef struct VP9Decoder {
// the same. // the same.
RefCntBuffer *cur_buf; // Current decoding frame buffer. RefCntBuffer *cur_buf; // Current decoding frame buffer.
VP9Worker *frame_worker_owner; // frame_worker that owns this pbi. VPxWorker *frame_worker_owner; // frame_worker that owns this pbi.
VP9Worker lf_worker; VPxWorker lf_worker;
VP9Worker *tile_workers; VPxWorker *tile_workers;
TileWorkerData *tile_worker_data; TileWorkerData *tile_worker_data;
TileInfo *tile_worker_info; TileInfo *tile_worker_info;
int num_tile_workers; int num_tile_workers;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// #define DEBUG_THREAD // #define DEBUG_THREAD
// TODO(hkuang): Clean up all the #ifdef in this file. // TODO(hkuang): Clean up all the #ifdef in this file.
void vp9_frameworker_lock_stats(VP9Worker *const worker) { void vp9_frameworker_lock_stats(VPxWorker *const worker) {
#if CONFIG_MULTITHREAD #if CONFIG_MULTITHREAD
FrameWorkerData *const worker_data = worker->data1; FrameWorkerData *const worker_data = worker->data1;
pthread_mutex_lock(&worker_data->stats_mutex); pthread_mutex_lock(&worker_data->stats_mutex);
...@@ -26,7 +26,7 @@ void vp9_frameworker_lock_stats(VP9Worker *const worker) { ...@@ -26,7 +26,7 @@ void vp9_frameworker_lock_stats(VP9Worker *const worker) {
#endif #endif
} }
void vp9_frameworker_unlock_stats(VP9Worker *const worker) { void vp9_frameworker_unlock_stats(VPxWorker *const worker) {
#if CONFIG_MULTITHREAD #if CONFIG_MULTITHREAD
FrameWorkerData *const worker_data = worker->data1; FrameWorkerData *const worker_data = worker->data1;
pthread_mutex_unlock(&worker_data->stats_mutex); pthread_mutex_unlock(&worker_data->stats_mutex);
...@@ -35,7 +35,7 @@ void vp9_frameworker_unlock_stats(VP9Worker *const worker) { ...@@ -35,7 +35,7 @@ void vp9_frameworker_unlock_stats(VP9Worker *const worker) {
#endif #endif
} }
void vp9_frameworker_signal_stats(VP9Worker *const worker) { void vp9_frameworker_signal_stats(VPxWorker *const worker) {
#if CONFIG_MULTITHREAD #if CONFIG_MULTITHREAD
FrameWorkerData *const worker_data = worker->data1; FrameWorkerData *const worker_data = worker->data1;
...@@ -59,7 +59,7 @@ void vp9_frameworker_signal_stats(VP9Worker *const worker) { ...@@ -59,7 +59,7 @@ void vp9_frameworker_signal_stats(VP9Worker *const worker) {
#endif #endif
// TODO(hkuang): Remove worker parameter as it is only used in debug code. // TODO(hkuang): Remove worker parameter as it is only used in debug code.
void vp9_frameworker_wait(VP9Worker *const worker, RefCntBuffer *const ref_buf, void vp9_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
int row) { int row) {
#if CONFIG_MULTITHREAD #if CONFIG_MULTITHREAD
if (!ref_buf) if (!ref_buf)
...@@ -74,7 +74,7 @@ void vp9_frameworker_wait(VP9Worker *const worker, RefCntBuffer *const ref_buf, ...@@ -74,7 +74,7 @@ void vp9_frameworker_wait(VP9Worker *const worker, RefCntBuffer *const ref_buf,