Change-Id: If363eccaa8be7fb9f8cf41488bf3f5e6d4c00645
This commit is contained in:
Adrian Grange 2016-03-29 14:31:34 -07:00
Родитель 5082a369e4
Коммит 54e6676757
21 изменённых файлов: 118 добавлений и 118 удалений

Просмотреть файл

@ -406,7 +406,7 @@ typedef struct aom_codec_enc_cfg {
* trade-off is often acceptable, but for many applications is not. It can
* be disabled in these cases.
*
* Note that not all codecs support this feature. All aom VPx codecs do.
* Note that not all codecs support this feature. All aom AVx codecs do.
* For other codecs, consult the documentation for that algorithm.
*
* This threshold is described as a percentage of the target data buffer.
@ -842,11 +842,11 @@ aom_codec_err_t aom_codec_enc_config_set(aom_codec_ctx_t *ctx,
aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
#define AOM_DL_REALTIME (1)
/**< deadline parameter analogous to VPx REALTIME mode. */
/**< deadline parameter analogous to AVx REALTIME mode. */
#define AOM_DL_GOOD_QUALITY (1000000)
/**< deadline parameter analogous to VPx GOOD QUALITY mode. */
/**< deadline parameter analogous to AVx GOOD QUALITY mode. */
#define AOM_DL_BEST_QUALITY (0)
/**< deadline parameter analogous to VPx BEST QUALITY mode. */
/**< deadline parameter analogous to AVx BEST QUALITY mode. */
/*!\brief Encode a frame
*
* Encodes a video frame at the given "presentation time." The presentation
@ -858,7 +858,7 @@ aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
* implicit that limiting the available time to encode will degrade the
* output quality. The encoder can be given an unlimited time to produce the
* best possible frame by specifying a deadline of '0'. This deadline
* supercedes the VPx notion of "best quality, good quality, realtime".
* supercedes the AVx notion of "best quality, good quality, realtime".
* Applications that wish to map these former settings to the new deadline
* based system can use the symbols #AOM_DL_REALTIME, #AOM_DL_GOOD_QUALITY,
* and #AOM_DL_BEST_QUALITY.

Просмотреть файл

@ -107,9 +107,9 @@ extern aom_codec_iface_t *aom_codec_av1_cx(void);
*/
#define AOM_EFLAG_NO_UPD_ENTROPY (1 << 20)
/*!\brief VPx encoder control functions
/*!\brief AVx encoder control functions
*
* This set of macros define the control functions available for VPx
* This set of macros define the control functions available for AVx
* encoder interface.
*
* \sa #aom_codec_control

Просмотреть файл

@ -22,7 +22,7 @@
#if CONFIG_MULTITHREAD
struct VPxWorkerImpl {
struct AVxWorkerImpl {
pthread_mutex_t mutex_;
pthread_cond_t condition_;
pthread_t thread_;
@ -30,10 +30,10 @@ struct VPxWorkerImpl {
//------------------------------------------------------------------------------
static void execute(VPxWorker *const worker); // Forward declaration.
static void execute(AVxWorker *const worker); // Forward declaration.
static THREADFN thread_loop(void *ptr) {
VPxWorker *const worker = (VPxWorker *)ptr;
AVxWorker *const worker = (AVxWorker *)ptr;
int done = 0;
while (!done) {
pthread_mutex_lock(&worker->impl_->mutex_);
@ -54,7 +54,7 @@ static THREADFN thread_loop(void *ptr) {
}
// main thread state control
static void change_state(VPxWorker *const worker, VPxWorkerStatus new_status) {
static void change_state(AVxWorker *const worker, AVxWorkerStatus new_status) {
// No-op when attempting to change state on a thread that didn't come up.
// Checking status_ without acquiring the lock first would result in a data
// race.
@ -79,12 +79,12 @@ static void change_state(VPxWorker *const worker, VPxWorkerStatus new_status) {
//------------------------------------------------------------------------------
static void init(VPxWorker *const worker) {
static void init(AVxWorker *const worker) {
memset(worker, 0, sizeof(*worker));
worker->status_ = NOT_OK;
}
static int sync(VPxWorker *const worker) {
static int sync(AVxWorker *const worker) {
#if CONFIG_MULTITHREAD
change_state(worker, OK);
#endif
@ -92,12 +92,12 @@ static int sync(VPxWorker *const worker) {
return !worker->had_error;
}
static int reset(VPxWorker *const worker) {
static int reset(AVxWorker *const worker) {
int ok = 1;
worker->had_error = 0;
if (worker->status_ < OK) {
#if CONFIG_MULTITHREAD
worker->impl_ = (VPxWorkerImpl *)aom_calloc(1, sizeof(*worker->impl_));
worker->impl_ = (AVxWorkerImpl *)aom_calloc(1, sizeof(*worker->impl_));
if (worker->impl_ == NULL) {
return 0;
}
@ -130,13 +130,13 @@ static int reset(VPxWorker *const worker) {
return ok;
}
static void execute(VPxWorker *const worker) {
static void execute(AVxWorker *const worker) {
if (worker->hook != NULL) {
worker->had_error |= !worker->hook(worker->data1, worker->data2);
}
}
static void launch(VPxWorker *const worker) {
static void launch(AVxWorker *const worker) {
#if CONFIG_MULTITHREAD
change_state(worker, WORK);
#else
@ -144,7 +144,7 @@ static void launch(VPxWorker *const worker) {
#endif
}
static void end(VPxWorker *const worker) {
static void end(AVxWorker *const worker) {
#if CONFIG_MULTITHREAD
if (worker->impl_ != NULL) {
change_state(worker, NOT_OK);
@ -163,10 +163,10 @@ static void end(VPxWorker *const worker) {
//------------------------------------------------------------------------------
static VPxWorkerInterface g_worker_interface = { init, reset, sync,
static AVxWorkerInterface g_worker_interface = { init, reset, sync,
launch, execute, end };
int aom_set_worker_interface(const VPxWorkerInterface *const winterface) {
int aom_set_worker_interface(const AVxWorkerInterface *const winterface) {
if (winterface == NULL || winterface->init == NULL ||
winterface->reset == NULL || winterface->sync == NULL ||
winterface->launch == NULL || winterface->execute == NULL ||
@ -177,7 +177,7 @@ int aom_set_worker_interface(const VPxWorkerInterface *const winterface) {
return 1;
}
const VPxWorkerInterface *aom_get_worker_interface(void) {
const AVxWorkerInterface *aom_get_worker_interface(void) {
return &g_worker_interface;
}

Просмотреть файл

@ -158,59 +158,59 @@ typedef enum {
NOT_OK = 0, // object is unusable
OK, // ready to work
WORK // busy finishing the current task
} VPxWorkerStatus;
} AVxWorkerStatus;
// Function to be called by the worker thread. Takes two opaque pointers as
// arguments (data1 and data2), and should return false in case of error.
typedef int (*VPxWorkerHook)(void *, void *);
typedef int (*AVxWorkerHook)(void *, void *);
// Platform-dependent implementation details for the worker.
typedef struct VPxWorkerImpl VPxWorkerImpl;
typedef struct AVxWorkerImpl AVxWorkerImpl;
// Synchronization object used to launch job in the worker thread
typedef struct {
VPxWorkerImpl *impl_;
VPxWorkerStatus status_;
VPxWorkerHook hook; // hook to call
AVxWorkerImpl *impl_;
AVxWorkerStatus status_;
AVxWorkerHook hook; // hook to call
void *data1; // first argument passed to 'hook'
void *data2; // second argument passed to 'hook'
int had_error; // return value of the last call to 'hook'
} VPxWorker;
} AVxWorker;
// The interface for all thread-worker related functions. All these functions
// must be implemented.
typedef struct {
// Must be called first, before any other method.
void (*init)(VPxWorker *const worker);
void (*init)(AVxWorker *const worker);
// Must be called to initialize the object and spawn the thread. Re-entrant.
// Will potentially launch the thread. Returns false in case of error.
int (*reset)(VPxWorker *const worker);
int (*reset)(AVxWorker *const worker);
// Makes sure the previous work is finished. Returns true if worker->had_error
// was not set and no error condition was triggered by the working thread.
int (*sync)(VPxWorker *const worker);
int (*sync)(AVxWorker *const worker);
// Triggers the thread to call hook() with data1 and data2 arguments. These
// hook/data1/data2 values can be changed at any time before calling this
// function, but not be changed afterward until the next call to Sync().
void (*launch)(VPxWorker *const worker);
void (*launch)(AVxWorker *const worker);
// This function is similar to launch() except that it calls the
// hook directly instead of using a thread. Convenient to bypass the thread
// mechanism while still using the VPxWorker structs. sync() must
// mechanism while still using the AVxWorker structs. sync() must
// still be called afterward (for error reporting).
void (*execute)(VPxWorker *const worker);
void (*execute)(AVxWorker *const worker);
// Kill the thread and terminate the object. To use the object again, one
// must call reset() again.
void (*end)(VPxWorker *const worker);
} VPxWorkerInterface;
void (*end)(AVxWorker *const worker);
} AVxWorkerInterface;
// Install a new set of threading functions, overriding the defaults. This
// should be done before any workers are started, i.e., before any encoding or
// decoding takes place. The contents of the interface struct are copied, it
// is safe to free the corresponding memory after this call. This function is
// not thread-safe. Return false in case of invalid pointer or methods.
int aom_set_worker_interface(const VPxWorkerInterface *const winterface);
int aom_set_worker_interface(const AVxWorkerInterface *const winterface);
// Retrieve the currently set thread worker interface.
const VPxWorkerInterface *aom_get_worker_interface(void);
const AVxWorkerInterface *aom_get_worker_interface(void);
//------------------------------------------------------------------------------

Просмотреть файл

@ -59,7 +59,7 @@ struct aom_codec_alg_priv {
// Frame parallel related.
int frame_parallel_decode; // frame-based threading.
VPxWorker *frame_workers;
AVxWorker *frame_workers;
int num_frame_workers;
int next_submit_worker_id;
int last_submit_worker_id;
@ -114,7 +114,7 @@ static aom_codec_err_t decoder_destroy(aom_codec_alg_priv_t *ctx) {
if (ctx->frame_workers != NULL) {
int i;
for (i = 0; i < ctx->num_frame_workers; ++i) {
VPxWorker *const worker = &ctx->frame_workers[i];
AVxWorker *const worker = &ctx->frame_workers[i];
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
aom_get_worker_interface()->end(worker);
@ -267,7 +267,7 @@ static void init_buffer_callbacks(aom_codec_alg_priv_t *ctx) {
int i;
for (i = 0; i < ctx->num_frame_workers; ++i) {
VPxWorker *const worker = &ctx->frame_workers[i];
AVxWorker *const worker = &ctx->frame_workers[i];
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
AV1_COMMON *const cm = &frame_worker_data->pbi->common;
BufferPool *const pool = cm->buffer_pool;
@ -313,7 +313,7 @@ static int frame_worker_hook(void *arg1, void *arg2) {
// the compressed data.
if (frame_worker_data->result != 0 ||
frame_worker_data->data + frame_worker_data->data_size - 1 > data) {
VPxWorker *const worker = frame_worker_data->pbi->frame_worker_owner;
AVxWorker *const worker = frame_worker_data->pbi->frame_worker_owner;
BufferPool *const pool = frame_worker_data->pbi->common.buffer_pool;
// Signal all the other threads that are waiting for this frame.
av1_frameworker_lock_stats(worker);
@ -336,7 +336,7 @@ static int frame_worker_hook(void *arg1, void *arg2) {
static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
int i;
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
ctx->last_show_frame = -1;
ctx->next_submit_worker_id = 0;
@ -363,7 +363,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
}
#endif
ctx->frame_workers = (VPxWorker *)aom_malloc(ctx->num_frame_workers *
ctx->frame_workers = (AVxWorker *)aom_malloc(ctx->num_frame_workers *
sizeof(*ctx->frame_workers));
if (ctx->frame_workers == NULL) {
set_error_detail(ctx, "Failed to allocate frame_workers");
@ -371,7 +371,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
}
for (i = 0; i < ctx->num_frame_workers; ++i) {
VPxWorker *const worker = &ctx->frame_workers[i];
AVxWorker *const worker = &ctx->frame_workers[i];
FrameWorkerData *frame_worker_data = NULL;
winterface->init(worker);
worker->data1 = aom_memalign(32, sizeof(FrameWorkerData));
@ -410,7 +410,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
frame_worker_data->pbi->inv_tile_order = ctx->invert_tile_order;
frame_worker_data->pbi->common.frame_parallel_decode =
ctx->frame_parallel_decode;
worker->hook = (VPxWorkerHook)frame_worker_hook;
worker->hook = (AVxWorkerHook)frame_worker_hook;
if (!winterface->reset(worker)) {
set_error_detail(ctx, "Frame Worker thread creation failed");
return AOM_CODEC_MEM_ERROR;
@ -438,7 +438,7 @@ static INLINE void check_resync(aom_codec_alg_priv_t *const ctx,
static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
const uint8_t **data, unsigned int data_sz,
void *user_priv, int64_t deadline) {
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
(void)deadline;
// Determine the stream parameters. Note that we rely on peek_si to
@ -455,7 +455,7 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
}
if (!ctx->frame_parallel_decode) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
frame_worker_data->data = *data;
frame_worker_data->data_size = data_sz;
@ -478,7 +478,7 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
check_resync(ctx, frame_worker_data->pbi);
} else {
VPxWorker *const worker = &ctx->frame_workers[ctx->next_submit_worker_id];
AVxWorker *const worker = &ctx->frame_workers[ctx->next_submit_worker_id];
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
// Copy context from last worker thread to next worker thread.
if (ctx->next_submit_worker_id != ctx->last_submit_worker_id)
@ -525,8 +525,8 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
static void wait_worker_and_cache_frame(aom_codec_alg_priv_t *ctx) {
YV12_BUFFER_CONFIG sd;
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
VPxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
AVxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
ctx->next_output_worker_id =
(ctx->next_output_worker_id + 1) % ctx->num_frame_workers;
@ -707,8 +707,8 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
if (*iter == NULL && ctx->frame_workers != NULL) {
do {
YV12_BUFFER_CONFIG sd;
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
VPxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
AVxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
ctx->next_output_worker_id =
@ -774,7 +774,7 @@ static aom_codec_err_t ctrl_set_reference(aom_codec_alg_priv_t *ctx,
if (data) {
aom_ref_frame_t *const frame = (aom_ref_frame_t *)data;
YV12_BUFFER_CONFIG sd;
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
image2yuvconfig(&frame->img, &sd);
return av1_set_reference_dec(&frame_worker_data->pbi->common,
@ -797,7 +797,7 @@ static aom_codec_err_t ctrl_copy_reference(aom_codec_alg_priv_t *ctx,
if (data) {
aom_ref_frame_t *frame = (aom_ref_frame_t *)data;
YV12_BUFFER_CONFIG sd;
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
image2yuvconfig(&frame->img, &sd);
return av1_copy_reference_dec(frame_worker_data->pbi,
@ -819,7 +819,7 @@ static aom_codec_err_t ctrl_get_reference(aom_codec_alg_priv_t *ctx,
if (data) {
YV12_BUFFER_CONFIG *fb;
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
fb = get_ref_frame(&frame_worker_data->pbi->common, data->idx);
if (fb == NULL) return AOM_CODEC_ERROR;
@ -856,7 +856,7 @@ static aom_codec_err_t ctrl_get_last_ref_updates(aom_codec_alg_priv_t *ctx,
if (update_info) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
*update_info = frame_worker_data->pbi->refresh_frame_flags;
@ -875,7 +875,7 @@ static aom_codec_err_t ctrl_get_frame_corrupted(aom_codec_alg_priv_t *ctx,
if (corrupted) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
RefCntBuffer *const frame_bufs =
@ -905,7 +905,7 @@ static aom_codec_err_t ctrl_get_frame_size(aom_codec_alg_priv_t *ctx,
if (frame_size) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
const AV1_COMMON *const cm = &frame_worker_data->pbi->common;
@ -932,7 +932,7 @@ static aom_codec_err_t ctrl_get_render_size(aom_codec_alg_priv_t *ctx,
if (render_size) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
const AV1_COMMON *const cm = &frame_worker_data->pbi->common;
@ -950,7 +950,7 @@ static aom_codec_err_t ctrl_get_render_size(aom_codec_alg_priv_t *ctx,
static aom_codec_err_t ctrl_get_bit_depth(aom_codec_alg_priv_t *ctx,
va_list args) {
unsigned int *const bit_depth = va_arg(args, unsigned int *);
VPxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
AVxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
if (bit_depth) {
if (worker) {
@ -996,7 +996,7 @@ static aom_codec_err_t ctrl_set_byte_alignment(aom_codec_alg_priv_t *ctx,
ctx->byte_alignment = byte_alignment;
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
frame_worker_data->pbi->common.byte_alignment = byte_alignment;
}
@ -1008,7 +1008,7 @@ static aom_codec_err_t ctrl_set_skip_loop_filter(aom_codec_alg_priv_t *ctx,
ctx->skip_loop_filter = va_arg(args, int);
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
frame_worker_data->pbi->common.skip_loop_filter = ctx->skip_loop_filter;
}

Просмотреть файл

@ -93,7 +93,7 @@ typedef struct {
// frame_worker_owner indicates which FrameWorker owns this buffer. NULL means
// that no FrameWorker owns, or is decoding, this buffer.
VPxWorker *frame_worker_owner;
AVxWorker *frame_worker_owner;
// 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

Просмотреть файл

@ -153,9 +153,9 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
struct macroblockd_plane planes[MAX_MB_PLANE],
int start, int stop, int y_only,
VPxWorker *workers, int nworkers,
AVxWorker *workers, int nworkers,
AV1LfSync *lf_sync) {
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
// Number of superblock rows and cols
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
@ -182,10 +182,10 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// because of contention. If the multithreading code changes in the future
// then the number of workers used by the loopfilter should be revisited.
for (i = 0; i < num_workers; ++i) {
VPxWorker *const worker = &workers[i];
AVxWorker *const worker = &workers[i];
LFWorkerData *const lf_data = &lf_sync->lfdata[i];
worker->hook = (VPxWorkerHook)loop_filter_row_worker;
worker->hook = (AVxWorkerHook)loop_filter_row_worker;
worker->data1 = lf_sync;
worker->data2 = lf_data;
@ -212,7 +212,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
struct macroblockd_plane planes[MAX_MB_PLANE],
int frame_filter_level, int y_only,
int partial_frame, VPxWorker *workers,
int partial_frame, AVxWorker *workers,
int num_workers, AV1LfSync *lf_sync) {
int start_mi_row, end_mi_row, mi_rows_to_filter;

Просмотреть файл

@ -51,7 +51,7 @@ void av1_loop_filter_dealloc(AV1LfSync *lf_sync);
void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
struct macroblockd_plane planes[MAX_MB_PLANE],
int frame_filter_level, int y_only,
int partial_frame, VPxWorker *workers,
int partial_frame, AVxWorker *workers,
int num_workers, AV1LfSync *lf_sync);
void av1_accumulate_frame_counts(struct AV1Common *cm,

Просмотреть файл

@ -1491,7 +1491,7 @@ static void get_tile_buffers(AV1Decoder *pbi, const uint8_t *data,
static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
const uint8_t *data_end) {
AV1_COMMON *const cm = &pbi->common;
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols);
const int tile_cols = 1 << cm->log2_tile_cols;
const int tile_rows = 1 << cm->log2_tile_rows;
@ -1504,7 +1504,7 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
pbi->lf_worker.data1 == NULL) {
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
aom_memalign(32, sizeof(LFWorkerData)));
pbi->lf_worker.hook = (VPxWorkerHook)av1_loop_filter_worker;
pbi->lf_worker.hook = (AVxWorkerHook)av1_loop_filter_worker;
if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) {
aom_internal_error(&cm->error, AOM_CODEC_ERROR,
"Loop filter thread creation failed");
@ -1675,7 +1675,7 @@ static int compare_tile_buffers(const void *a, const void *b) {
static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
const uint8_t *data_end) {
AV1_COMMON *const cm = &pbi->common;
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
const uint8_t *bit_reader_end = NULL;
const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
const int tile_cols = 1 << cm->log2_tile_cols;
@ -1705,7 +1705,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
CHECK_MEM_ERROR(cm, pbi->tile_worker_info,
aom_malloc(num_threads * sizeof(*pbi->tile_worker_info)));
for (i = 0; i < num_threads; ++i) {
VPxWorker *const worker = &pbi->tile_workers[i];
AVxWorker *const worker = &pbi->tile_workers[i];
++pbi->num_tile_workers;
winterface->init(worker);
@ -1718,9 +1718,9 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
// Reset tile decoding hook
for (n = 0; n < num_workers; ++n) {
VPxWorker *const worker = &pbi->tile_workers[n];
AVxWorker *const worker = &pbi->tile_workers[n];
winterface->sync(worker);
worker->hook = (VPxWorkerHook)tile_worker_hook;
worker->hook = (AVxWorkerHook)tile_worker_hook;
worker->data1 = &pbi->tile_worker_data[n];
worker->data2 = &pbi->tile_worker_info[n];
}
@ -1770,7 +1770,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
while (n < tile_cols) {
int i;
for (i = 0; i < num_workers && n < tile_cols; ++i) {
VPxWorker *const worker = &pbi->tile_workers[i];
AVxWorker *const worker = &pbi->tile_workers[i];
TileWorkerData *const tile_data = (TileWorkerData *)worker->data1;
TileInfo *const tile = (TileInfo *)worker->data2;
TileBuffer *const buf = &tile_buffers[0][n];
@ -1807,7 +1807,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
}
for (; i > 0; --i) {
VPxWorker *const worker = &pbi->tile_workers[i - 1];
AVxWorker *const worker = &pbi->tile_workers[i - 1];
// TODO(jzern): The tile may have specific error data associated with
// its aom_internal_error_info which could be propagated to the main info
// in cm. Additionally once the threads have been synced and an error is
@ -2389,7 +2389,7 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
// the frame header.
if (cm->frame_parallel_decode &&
cm->refresh_frame_context != REFRESH_FRAME_CONTEXT_BACKWARD) {
VPxWorker *const worker = pbi->frame_worker_owner;
AVxWorker *const worker = pbi->frame_worker_owner;
FrameWorkerData *const frame_worker_data = worker->data1;
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_FORWARD) {
context_updated = 1;

Просмотреть файл

@ -130,7 +130,7 @@ void av1_decoder_remove(AV1Decoder *pbi) {
aom_free(pbi->lf_worker.data1);
aom_free(pbi->tile_data);
for (i = 0; i < pbi->num_tile_workers; ++i) {
VPxWorker *const worker = &pbi->tile_workers[i];
AVxWorker *const worker = &pbi->tile_workers[i];
aom_get_worker_interface()->end(worker);
}
aom_free(pbi->tile_worker_data);
@ -306,7 +306,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
pbi->hold_ref_buf = 0;
if (cm->frame_parallel_decode) {
VPxWorker *const worker = pbi->frame_worker_owner;
AVxWorker *const worker = pbi->frame_worker_owner;
av1_frameworker_lock_stats(worker);
frame_bufs[cm->new_fb_idx].frame_worker_owner = worker;
// Reset decoding progress.
@ -319,7 +319,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
}
if (setjmp(cm->error.jmp)) {
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
int i;
cm->error.setjmp = 0;
@ -381,7 +381,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
if (cm->frame_parallel_decode) {
// Need to lock the mutex here as another thread may
// be accessing this buffer.
VPxWorker *const worker = pbi->frame_worker_owner;
AVxWorker *const worker = pbi->frame_worker_owner;
FrameWorkerData *const frame_worker_data = worker->data1;
av1_frameworker_lock_stats(worker);

Просмотреть файл

@ -61,9 +61,9 @@ typedef struct AV1Decoder {
// the same.
RefCntBuffer *cur_buf; // Current decoding frame buffer.
VPxWorker *frame_worker_owner; // frame_worker that owns this pbi.
VPxWorker lf_worker;
VPxWorker *tile_workers;
AVxWorker *frame_worker_owner; // frame_worker that owns this pbi.
AVxWorker lf_worker;
AVxWorker *tile_workers;
TileWorkerData *tile_worker_data;
TileInfo *tile_worker_info;
int num_tile_workers;

Просмотреть файл

@ -18,7 +18,7 @@
// #define DEBUG_THREAD
// TODO(hkuang): Clean up all the #ifdef in this file.
void av1_frameworker_lock_stats(VPxWorker *const worker) {
void av1_frameworker_lock_stats(AVxWorker *const worker) {
#if CONFIG_MULTITHREAD
FrameWorkerData *const worker_data = worker->data1;
pthread_mutex_lock(&worker_data->stats_mutex);
@ -27,7 +27,7 @@ void av1_frameworker_lock_stats(VPxWorker *const worker) {
#endif
}
void av1_frameworker_unlock_stats(VPxWorker *const worker) {
void av1_frameworker_unlock_stats(AVxWorker *const worker) {
#if CONFIG_MULTITHREAD
FrameWorkerData *const worker_data = worker->data1;
pthread_mutex_unlock(&worker_data->stats_mutex);
@ -36,7 +36,7 @@ void av1_frameworker_unlock_stats(VPxWorker *const worker) {
#endif
}
void av1_frameworker_signal_stats(VPxWorker *const worker) {
void av1_frameworker_signal_stats(AVxWorker *const worker) {
#if CONFIG_MULTITHREAD
FrameWorkerData *const worker_data = worker->data1;
@ -60,7 +60,7 @@ void av1_frameworker_signal_stats(VPxWorker *const worker) {
#endif
// TODO(hkuang): Remove worker parameter as it is only used in debug code.
void av1_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
void av1_frameworker_wait(AVxWorker *const worker, RefCntBuffer *const ref_buf,
int row) {
#if CONFIG_MULTITHREAD
if (!ref_buf) return;
@ -74,7 +74,7 @@ void av1_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
{
// Find the worker thread that owns the reference frame. If the reference
// frame has been fully decoded, it may not have owner.
VPxWorker *const ref_worker = ref_buf->frame_worker_owner;
AVxWorker *const ref_worker = ref_buf->frame_worker_owner;
FrameWorkerData *const ref_worker_data =
(FrameWorkerData *)ref_worker->data1;
const AV1Decoder *const pbi = ref_worker_data->pbi;
@ -114,7 +114,7 @@ void av1_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
void av1_frameworker_broadcast(RefCntBuffer *const buf, int row) {
#if CONFIG_MULTITHREAD
VPxWorker *worker = buf->frame_worker_owner;
AVxWorker *worker = buf->frame_worker_owner;
#ifdef DEBUG_THREAD
{
@ -134,8 +134,8 @@ void av1_frameworker_broadcast(RefCntBuffer *const buf, int row) {
#endif // CONFIG_MULTITHREAD
}
void av1_frameworker_copy_context(VPxWorker *const dst_worker,
VPxWorker *const src_worker) {
void av1_frameworker_copy_context(AVxWorker *const dst_worker,
AVxWorker *const src_worker) {
#if CONFIG_MULTITHREAD
FrameWorkerData *const src_worker_data = (FrameWorkerData *)src_worker->data1;
FrameWorkerData *const dst_worker_data = (FrameWorkerData *)dst_worker->data1;

Просмотреть файл

@ -49,15 +49,15 @@ typedef struct FrameWorkerData {
int frame_decoded; // Finished decoding current frame.
} FrameWorkerData;
void av1_frameworker_lock_stats(VPxWorker *const worker);
void av1_frameworker_unlock_stats(VPxWorker *const worker);
void av1_frameworker_signal_stats(VPxWorker *const worker);
void av1_frameworker_lock_stats(AVxWorker *const worker);
void av1_frameworker_unlock_stats(AVxWorker *const worker);
void av1_frameworker_signal_stats(AVxWorker *const worker);
// Wait until ref_buf has been decoded to row in real pixel unit.
// Note: worker may already finish decoding ref_buf and release it in order to
// start decoding next frame. So need to check whether worker is still decoding
// ref_buf.
void av1_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
void av1_frameworker_wait(AVxWorker *const worker, RefCntBuffer *const ref_buf,
int row);
// FrameWorker broadcasts its decoding progress so other workers that are
@ -65,8 +65,8 @@ void av1_frameworker_wait(VPxWorker *const worker, RefCntBuffer *const ref_buf,
void av1_frameworker_broadcast(RefCntBuffer *const buf, int row);
// Copy necessary decoding context from src worker to dst worker.
void av1_frameworker_copy_context(VPxWorker *const dst_worker,
VPxWorker *const src_worker);
void av1_frameworker_copy_context(AVxWorker *const dst_worker,
AVxWorker *const src_worker);
#ifdef __cplusplus
} // extern "C"

Просмотреть файл

@ -1724,7 +1724,7 @@ void av1_remove_compressor(AV1_COMP *cpi) {
}
for (t = 0; t < cpi->num_workers; ++t) {
VPxWorker *const worker = &cpi->workers[t];
AVxWorker *const worker = &cpi->workers[t];
EncWorkerData *const thread_data = &cpi->tile_thr_data[t];
// Deallocate allocated threads.

Просмотреть файл

@ -482,7 +482,7 @@ typedef struct AV1_COMP {
// Multi-threading
int num_workers;
VPxWorker *workers;
AVxWorker *workers;
struct EncWorkerData *tile_thr_data;
AV1LfSync lf_row_sync;
} AV1_COMP;

Просмотреть файл

@ -60,7 +60,7 @@ static int enc_worker_hook(EncWorkerData *const thread_data, void *unused) {
void av1_encode_tiles_mt(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
const int tile_cols = 1 << cm->log2_tile_cols;
const VPxWorkerInterface *const winterface = aom_get_worker_interface();
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
const int num_workers = AOMMIN(cpi->oxcf.max_threads, tile_cols);
int i;
@ -77,7 +77,7 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
aom_calloc(allocated_workers, sizeof(*cpi->tile_thr_data)));
for (i = 0; i < allocated_workers; i++) {
VPxWorker *const worker = &cpi->workers[i];
AVxWorker *const worker = &cpi->workers[i];
EncWorkerData *thread_data = &cpi->tile_thr_data[i];
++cpi->num_workers;
@ -115,10 +115,10 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
}
for (i = 0; i < num_workers; i++) {
VPxWorker *const worker = &cpi->workers[i];
AVxWorker *const worker = &cpi->workers[i];
EncWorkerData *thread_data;
worker->hook = (VPxWorkerHook)enc_worker_hook;
worker->hook = (AVxWorkerHook)enc_worker_hook;
worker->data1 = &cpi->tile_thr_data[i];
worker->data2 = NULL;
thread_data = (EncWorkerData *)worker->data1;
@ -136,7 +136,7 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
// Encode a frame
for (i = 0; i < num_workers; i++) {
VPxWorker *const worker = &cpi->workers[i];
AVxWorker *const worker = &cpi->workers[i];
EncWorkerData *const thread_data = (EncWorkerData *)worker->data1;
// Set the starting tile for each thread.
@ -150,12 +150,12 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
// Encoding ends.
for (i = 0; i < num_workers; i++) {
VPxWorker *const worker = &cpi->workers[i];
AVxWorker *const worker = &cpi->workers[i];
winterface->sync(worker);
}
for (i = 0; i < num_workers; i++) {
VPxWorker *const worker = &cpi->workers[i];
AVxWorker *const worker = &cpi->workers[i];
EncWorkerData *const thread_data = (EncWorkerData *)worker->data1;
// Accumulate counters.

Просмотреть файл

@ -8,7 +8,7 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
## This script generates 'AOM.framework'. An iOS app can encode and decode VPx
## This script generates 'AOM.framework'. An iOS app can encode and decode AVx
## video by including 'AOM.framework'.
##
## Run iosbuild.sh to create 'AOM.framework' in the current directory.

Просмотреть файл

@ -9,7 +9,7 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
// This is an example demonstrating how to implement a multi-layer VPx
// This is an example demonstrating how to implement a multi-layer AVx
// encoding scheme based on temporal scalability for video applications
// that benefit from a scalable bitstream.

Просмотреть файл

@ -37,7 +37,7 @@
// Determining the codec interface to use is handled by AvxVideoReader and the
// functions prefixed with aom_video_reader_. Discussion of those functions is
// beyond the scope of this example, but the main gist is to open the input file
// and parse just enough of it to determine if it's a VPx file and which VPx
// and parse just enough of it to determine if it's a AVx file and which AVx
// codec is contained within the file.
// Note the NULL pointer passed to aom_codec_dec_init(). We do that in this
// example because we want the algorithm to determine the stream configuration

Просмотреть файл

@ -295,7 +295,7 @@ aom.pc: config.mk libs.mk
$(qexec)echo 'includedir=$${prefix}/include' >> $@
$(qexec)echo '' >> $@
$(qexec)echo 'Name: aom' >> $@
$(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
$(qexec)echo 'Description: WebM Project AVx codec implementation' >> $@
$(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
$(qexec)echo 'Requires:' >> $@
$(qexec)echo 'Conflicts:' >> $@

Просмотреть файл

@ -20,11 +20,11 @@
#include "test/y4m_video_source.h"
namespace {
class VPxEncoderThreadTest
class AVxEncoderThreadTest
: public ::libaom_test::EncoderTest,
public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int> {
protected:
VPxEncoderThreadTest()
AVxEncoderThreadTest()
: EncoderTest(GET_PARAM(0)), encoder_initialized_(false), tiles_(2),
encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) {
init_flags_ = AOM_CODEC_USE_PSNR;
@ -35,7 +35,7 @@ class VPxEncoderThreadTest
md5_.clear();
}
virtual ~VPxEncoderThreadTest() { delete decoder_; }
virtual ~AVxEncoderThreadTest() { delete decoder_; }
virtual void SetUp() {
InitializeConfig();
@ -102,7 +102,7 @@ class VPxEncoderThreadTest
std::vector<std::string> md5_;
};
TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
TEST_P(AVxEncoderThreadTest, EncoderResultTest) {
std::vector<std::string> single_thr_md5, multi_thr_md5;
::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 15, 20);
@ -126,7 +126,7 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
ASSERT_EQ(single_thr_md5, multi_thr_md5);
}
AV1_INSTANTIATE_TEST_CASE(VPxEncoderThreadTest,
AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest,
::testing::Values(::libaom_test::kTwoPassGood,
::libaom_test::kOnePassGood),
::testing::Range(1, 3));