Removing VP9DecoderConfig.
We only used two members from that struct: max_threads and inv_tile_order. Moving them directly to VP9Decoder struct. Change-Id: If696a4e5b5b41868a55f3cc971e1d7c1dd9d5f69
This commit is contained in:
parent
55e4b76569
commit
0dacecaf20
@ -677,7 +677,7 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
|
||||
|
||||
static void decode_tile(VP9Decoder *pbi, const TileInfo *const tile,
|
||||
vp9_reader *r) {
|
||||
const int num_threads = pbi->oxcf.max_threads;
|
||||
const int num_threads = pbi->max_threads;
|
||||
VP9_COMMON *const cm = &pbi->common;
|
||||
int mi_row, mi_col;
|
||||
MACROBLOCKD *xd = &pbi->mb;
|
||||
@ -828,8 +828,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
|
||||
// Decode tiles using data from tile_buffers
|
||||
for (tile_row = 0; tile_row < tile_rows; ++tile_row) {
|
||||
for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
|
||||
const int col = pbi->oxcf.inv_tile_order ? tile_cols - tile_col - 1
|
||||
: tile_col;
|
||||
const int col = pbi->inv_tile_order ? tile_cols - tile_col - 1 : tile_col;
|
||||
const int last_tile = tile_row == tile_rows - 1 &&
|
||||
col == tile_cols - 1;
|
||||
const TileBuffer *const buf = &tile_buffers[tile_row][col];
|
||||
@ -887,7 +886,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
|
||||
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_rows = 1 << cm->log2_tile_rows;
|
||||
const int num_workers = MIN(pbi->oxcf.max_threads & ~1, tile_cols);
|
||||
const int num_workers = MIN(pbi->max_threads & ~1, tile_cols);
|
||||
TileBuffer tile_buffers[1 << 6];
|
||||
int n;
|
||||
int final_worker = -1;
|
||||
@ -899,7 +898,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
|
||||
// TODO(jzern): See if we can remove the restriction of passing in max
|
||||
// threads to the decoder.
|
||||
if (pbi->num_tile_workers == 0) {
|
||||
const int num_threads = pbi->oxcf.max_threads & ~1;
|
||||
const int num_threads = pbi->max_threads & ~1;
|
||||
int i;
|
||||
// TODO(jzern): Allocate one less worker, as in the current code we only
|
||||
// use num_threads - 1 workers.
|
||||
@ -1328,7 +1327,7 @@ int vp9_decode_frame(VP9Decoder *pbi,
|
||||
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
|
||||
vpx_memalign(32, sizeof(LFWorkerData)));
|
||||
pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
|
||||
if (pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) {
|
||||
if (pbi->max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
|
||||
"Loop filter thread creation failed");
|
||||
}
|
||||
@ -1353,7 +1352,7 @@ int vp9_decode_frame(VP9Decoder *pbi,
|
||||
|
||||
// TODO(jzern): remove frame_parallel_decoding_mode restriction for
|
||||
// single-frame tile decoding.
|
||||
if (pbi->oxcf.max_threads > 1 && tile_rows == 1 && tile_cols > 1 &&
|
||||
if (pbi->max_threads > 1 && tile_rows == 1 && tile_cols > 1 &&
|
||||
cm->frame_parallel_decoding_mode) {
|
||||
*p_data_end = decode_tiles_mt(pbi, data + first_partition_size, data_end);
|
||||
} else {
|
||||
|
@ -42,7 +42,7 @@ void vp9_initialize_dec() {
|
||||
}
|
||||
}
|
||||
|
||||
VP9Decoder *vp9_decoder_create(const VP9DecoderConfig *oxcf) {
|
||||
VP9Decoder *vp9_decoder_create() {
|
||||
VP9Decoder *const pbi = vpx_memalign(32, sizeof(*pbi));
|
||||
VP9_COMMON *const cm = pbi ? &pbi->common : NULL;
|
||||
|
||||
@ -66,7 +66,6 @@ VP9Decoder *vp9_decoder_create(const VP9DecoderConfig *oxcf) {
|
||||
vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
|
||||
|
||||
cm->current_video_frame = 0;
|
||||
pbi->oxcf = *oxcf;
|
||||
pbi->ready_for_new_data = 1;
|
||||
pbi->decoded_key_frame = 0;
|
||||
|
||||
|
@ -27,21 +27,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct VP9DecoderConfig {
|
||||
int width;
|
||||
int height;
|
||||
int version;
|
||||
int max_threads;
|
||||
int inv_tile_order;
|
||||
} VP9DecoderConfig;
|
||||
|
||||
typedef struct VP9Decoder {
|
||||
DECLARE_ALIGNED(16, MACROBLOCKD, mb);
|
||||
|
||||
DECLARE_ALIGNED(16, VP9_COMMON, common);
|
||||
|
||||
VP9DecoderConfig oxcf;
|
||||
|
||||
int64_t last_time_stamp;
|
||||
int ready_for_new_data;
|
||||
|
||||
@ -59,6 +49,9 @@ typedef struct VP9Decoder {
|
||||
|
||||
vpx_decrypt_cb decrypt_cb;
|
||||
void *decrypt_state;
|
||||
|
||||
int max_threads;
|
||||
int inv_tile_order;
|
||||
} VP9Decoder;
|
||||
|
||||
void vp9_initialize_dec();
|
||||
@ -83,8 +76,7 @@ vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
|
||||
int vp9_get_reference_dec(struct VP9Decoder *pbi,
|
||||
int index, YV12_BUFFER_CONFIG **fb);
|
||||
|
||||
|
||||
struct VP9Decoder *vp9_decoder_create(const VP9DecoderConfig *oxcf);
|
||||
struct VP9Decoder *vp9_decoder_create();
|
||||
|
||||
void vp9_decoder_remove(struct VP9Decoder *pbi);
|
||||
|
||||
|
@ -140,7 +140,7 @@ void vp9_loop_filter_frame_mt(VP9Decoder *pbi,
|
||||
// Number of superblock rows and cols
|
||||
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int num_workers = MIN(pbi->oxcf.max_threads & ~1, tile_cols);
|
||||
const int num_workers = MIN(pbi->max_threads & ~1, tile_cols);
|
||||
int i;
|
||||
|
||||
// Allocate memory used in thread synchronization.
|
||||
|
@ -245,17 +245,13 @@ static void set_ppflags(const vpx_codec_alg_priv_t *ctx,
|
||||
}
|
||||
|
||||
static void init_decoder(vpx_codec_alg_priv_t *ctx) {
|
||||
VP9DecoderConfig oxcf;
|
||||
oxcf.width = ctx->si.w;
|
||||
oxcf.height = ctx->si.h;
|
||||
oxcf.version = 9;
|
||||
oxcf.max_threads = ctx->cfg.threads;
|
||||
oxcf.inv_tile_order = ctx->invert_tile_order;
|
||||
|
||||
ctx->pbi = vp9_decoder_create(&oxcf);
|
||||
ctx->pbi = vp9_decoder_create();
|
||||
if (ctx->pbi == NULL)
|
||||
return;
|
||||
|
||||
ctx->pbi->max_threads = ctx->cfg.threads;
|
||||
ctx->pbi->inv_tile_order = ctx->invert_tile_order;
|
||||
|
||||
vp9_initialize_dec();
|
||||
|
||||
// If postprocessing was enabled by the application and a
|
||||
|
Loading…
Reference in New Issue
Block a user