VP9->VPX for reference frame flags
Change-Id: Iff86d39bed4be9a97fdd78f25f3ac6e1728fe68d
This commit is contained in:
@@ -100,10 +100,10 @@ typedef enum {
|
||||
#define EXT_TX_SIZES 3 // number of sizes that use extended transforms
|
||||
|
||||
typedef enum {
|
||||
VP9_LAST_FLAG = 1 << 0,
|
||||
VP9_GOLD_FLAG = 1 << 1,
|
||||
VP9_ALT_FLAG = 1 << 2,
|
||||
} VP9_REFFRAME;
|
||||
VPX_LAST_FLAG = 1 << 0,
|
||||
VPX_GOLD_FLAG = 1 << 1,
|
||||
VPX_ALT_FLAG = 1 << 2,
|
||||
} VPX_REFFRAME;
|
||||
|
||||
typedef enum {
|
||||
PLANE_TYPE_Y = 0,
|
||||
|
@@ -18,7 +18,7 @@ int vp10_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
|
||||
vp10_free_internal_frame_buffers(list);
|
||||
|
||||
list->num_internal_frame_buffers =
|
||||
VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
VPX_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
list->int_fb =
|
||||
(InternalFrameBuffer *)vpx_calloc(list->num_internal_frame_buffers,
|
||||
sizeof(*list->int_fb));
|
||||
|
@@ -151,7 +151,7 @@ static int equal_dimensions(const YV12_BUFFER_CONFIG *a,
|
||||
}
|
||||
|
||||
vpx_codec_err_t vp10_copy_reference_dec(VP10Decoder *pbi,
|
||||
VP9_REFFRAME ref_frame_flag,
|
||||
VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd) {
|
||||
VP10_COMMON *cm = &pbi->common;
|
||||
|
||||
@@ -160,7 +160,7 @@ vpx_codec_err_t vp10_copy_reference_dec(VP10Decoder *pbi,
|
||||
* vpxenc --test-decode functionality working, and will be replaced in a
|
||||
* later commit that adds VP9-specific controls for this functionality.
|
||||
*/
|
||||
if (ref_frame_flag == VP9_LAST_FLAG) {
|
||||
if (ref_frame_flag == VPX_LAST_FLAG) {
|
||||
const YV12_BUFFER_CONFIG *const cfg = get_ref_frame(cm, 0);
|
||||
if (cfg == NULL) {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
|
||||
@@ -182,7 +182,7 @@ vpx_codec_err_t vp10_copy_reference_dec(VP10Decoder *pbi,
|
||||
|
||||
|
||||
vpx_codec_err_t vp10_set_reference_dec(VP10_COMMON *cm,
|
||||
VP9_REFFRAME ref_frame_flag,
|
||||
VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd) {
|
||||
RefBuffer *ref_buf = NULL;
|
||||
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
|
||||
@@ -191,11 +191,11 @@ vpx_codec_err_t vp10_set_reference_dec(VP10_COMMON *cm,
|
||||
// encoder is using the frame buffers for. This is just a stub to keep the
|
||||
// vpxenc --test-decode functionality working, and will be replaced in a
|
||||
// later commit that adds VP9-specific controls for this functionality.
|
||||
if (ref_frame_flag == VP9_LAST_FLAG) {
|
||||
if (ref_frame_flag == VPX_LAST_FLAG) {
|
||||
ref_buf = &cm->frame_refs[0];
|
||||
} else if (ref_frame_flag == VP9_GOLD_FLAG) {
|
||||
} else if (ref_frame_flag == VPX_GOLD_FLAG) {
|
||||
ref_buf = &cm->frame_refs[1];
|
||||
} else if (ref_frame_flag == VP9_ALT_FLAG) {
|
||||
} else if (ref_frame_flag == VPX_ALT_FLAG) {
|
||||
ref_buf = &cm->frame_refs[2];
|
||||
} else {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
|
||||
|
@@ -87,11 +87,11 @@ int vp10_receive_compressed_data(struct VP10Decoder *pbi,
|
||||
int vp10_get_raw_frame(struct VP10Decoder *pbi, YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
vpx_codec_err_t vp10_copy_reference_dec(struct VP10Decoder *pbi,
|
||||
VP9_REFFRAME ref_frame_flag,
|
||||
VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
vpx_codec_err_t vp10_set_reference_dec(VP10_COMMON *cm,
|
||||
VP9_REFFRAME ref_frame_flag,
|
||||
VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
static INLINE uint8_t read_marker(vpx_decrypt_cb decrypt_cb,
|
||||
|
@@ -2549,8 +2549,8 @@ static int check_dual_ref_flags(VP10_COMP *cpi) {
|
||||
if (segfeature_active(&cpi->common.seg, 1, SEG_LVL_REF_FRAME)) {
|
||||
return 0;
|
||||
} else {
|
||||
return (!!(ref_flags & VP9_GOLD_FLAG) + !!(ref_flags & VP9_LAST_FLAG)
|
||||
+ !!(ref_flags & VP9_ALT_FLAG)) >= 2;
|
||||
return (!!(ref_flags & VPX_GOLD_FLAG) + !!(ref_flags & VPX_LAST_FLAG)
|
||||
+ !!(ref_flags & VPX_ALT_FLAG)) >= 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2262,26 +2262,26 @@ int vp10_use_as_reference(VP10_COMP *cpi, int ref_frame_flags) {
|
||||
}
|
||||
|
||||
void vp10_update_reference(VP10_COMP *cpi, int ref_frame_flags) {
|
||||
cpi->ext_refresh_golden_frame = (ref_frame_flags & VP9_GOLD_FLAG) != 0;
|
||||
cpi->ext_refresh_alt_ref_frame = (ref_frame_flags & VP9_ALT_FLAG) != 0;
|
||||
cpi->ext_refresh_last_frame = (ref_frame_flags & VP9_LAST_FLAG) != 0;
|
||||
cpi->ext_refresh_golden_frame = (ref_frame_flags & VPX_GOLD_FLAG) != 0;
|
||||
cpi->ext_refresh_alt_ref_frame = (ref_frame_flags & VPX_ALT_FLAG) != 0;
|
||||
cpi->ext_refresh_last_frame = (ref_frame_flags & VPX_LAST_FLAG) != 0;
|
||||
cpi->ext_refresh_frame_flags_pending = 1;
|
||||
}
|
||||
|
||||
static YV12_BUFFER_CONFIG *get_vp10_ref_frame_buffer(VP10_COMP *cpi,
|
||||
VP9_REFFRAME ref_frame_flag) {
|
||||
VPX_REFFRAME ref_frame_flag) {
|
||||
MV_REFERENCE_FRAME ref_frame = NONE;
|
||||
if (ref_frame_flag == VP9_LAST_FLAG)
|
||||
if (ref_frame_flag == VPX_LAST_FLAG)
|
||||
ref_frame = LAST_FRAME;
|
||||
else if (ref_frame_flag == VP9_GOLD_FLAG)
|
||||
else if (ref_frame_flag == VPX_GOLD_FLAG)
|
||||
ref_frame = GOLDEN_FRAME;
|
||||
else if (ref_frame_flag == VP9_ALT_FLAG)
|
||||
else if (ref_frame_flag == VPX_ALT_FLAG)
|
||||
ref_frame = ALTREF_FRAME;
|
||||
|
||||
return ref_frame == NONE ? NULL : get_ref_frame_buffer(cpi, ref_frame);
|
||||
}
|
||||
|
||||
int vp10_copy_reference_enc(VP10_COMP *cpi, VP9_REFFRAME ref_frame_flag,
|
||||
int vp10_copy_reference_enc(VP10_COMP *cpi, VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd) {
|
||||
YV12_BUFFER_CONFIG *cfg = get_vp10_ref_frame_buffer(cpi, ref_frame_flag);
|
||||
if (cfg) {
|
||||
@@ -2292,7 +2292,7 @@ int vp10_copy_reference_enc(VP10_COMP *cpi, VP9_REFFRAME ref_frame_flag,
|
||||
}
|
||||
}
|
||||
|
||||
int vp10_set_reference_enc(VP10_COMP *cpi, VP9_REFFRAME ref_frame_flag,
|
||||
int vp10_set_reference_enc(VP10_COMP *cpi, VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd) {
|
||||
YV12_BUFFER_CONFIG *cfg = get_vp10_ref_frame_buffer(cpi, ref_frame_flag);
|
||||
if (cfg) {
|
||||
@@ -2667,10 +2667,10 @@ static INLINE void alloc_frame_mvs(const VP10_COMMON *cm,
|
||||
void vp10_scale_references(VP10_COMP *cpi) {
|
||||
VP10_COMMON *cm = &cpi->common;
|
||||
MV_REFERENCE_FRAME ref_frame;
|
||||
const VP9_REFFRAME ref_mask[3] = {VP9_LAST_FLAG, VP9_GOLD_FLAG, VP9_ALT_FLAG};
|
||||
const VPX_REFFRAME ref_mask[3] = {VPX_LAST_FLAG, VPX_GOLD_FLAG, VPX_ALT_FLAG};
|
||||
|
||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
|
||||
// Need to convert from VP9_REFFRAME to index into ref_mask (subtract 1).
|
||||
// Need to convert from VPX_REFFRAME to index into ref_mask (subtract 1).
|
||||
if (cpi->ref_frame_flags & ref_mask[ref_frame - 1]) {
|
||||
BufferPool *const pool = cm->buffer_pool;
|
||||
const YV12_BUFFER_CONFIG *const ref = get_ref_frame_buffer(cpi,
|
||||
@@ -3367,19 +3367,19 @@ static int get_ref_frame_flags(const VP10_COMP *cpi) {
|
||||
const int gold_is_last = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idx];
|
||||
const int alt_is_last = map[cpi->alt_fb_idx] == map[cpi->lst_fb_idx];
|
||||
const int gold_is_alt = map[cpi->gld_fb_idx] == map[cpi->alt_fb_idx];
|
||||
int flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
|
||||
int flags = VPX_ALT_FLAG | VPX_GOLD_FLAG | VPX_LAST_FLAG;
|
||||
|
||||
if (gold_is_last)
|
||||
flags &= ~VP9_GOLD_FLAG;
|
||||
flags &= ~VPX_GOLD_FLAG;
|
||||
|
||||
if (cpi->rc.frames_till_gf_update_due == INT_MAX)
|
||||
flags &= ~VP9_GOLD_FLAG;
|
||||
flags &= ~VPX_GOLD_FLAG;
|
||||
|
||||
if (alt_is_last)
|
||||
flags &= ~VP9_ALT_FLAG;
|
||||
flags &= ~VPX_ALT_FLAG;
|
||||
|
||||
if (gold_is_alt)
|
||||
flags &= ~VP9_ALT_FLAG;
|
||||
flags &= ~VPX_ALT_FLAG;
|
||||
|
||||
return flags;
|
||||
}
|
||||
@@ -4323,13 +4323,13 @@ void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags) {
|
||||
int ref = 7;
|
||||
|
||||
if (flags & VP8_EFLAG_NO_REF_LAST)
|
||||
ref ^= VP9_LAST_FLAG;
|
||||
ref ^= VPX_LAST_FLAG;
|
||||
|
||||
if (flags & VP8_EFLAG_NO_REF_GF)
|
||||
ref ^= VP9_GOLD_FLAG;
|
||||
ref ^= VPX_GOLD_FLAG;
|
||||
|
||||
if (flags & VP8_EFLAG_NO_REF_ARF)
|
||||
ref ^= VP9_ALT_FLAG;
|
||||
ref ^= VPX_ALT_FLAG;
|
||||
|
||||
vp10_use_as_reference(cpi, ref);
|
||||
}
|
||||
@@ -4340,13 +4340,13 @@ void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags) {
|
||||
int upd = 7;
|
||||
|
||||
if (flags & VP8_EFLAG_NO_UPD_LAST)
|
||||
upd ^= VP9_LAST_FLAG;
|
||||
upd ^= VPX_LAST_FLAG;
|
||||
|
||||
if (flags & VP8_EFLAG_NO_UPD_GF)
|
||||
upd ^= VP9_GOLD_FLAG;
|
||||
upd ^= VPX_GOLD_FLAG;
|
||||
|
||||
if (flags & VP8_EFLAG_NO_UPD_ARF)
|
||||
upd ^= VP9_ALT_FLAG;
|
||||
upd ^= VPX_ALT_FLAG;
|
||||
|
||||
vp10_update_reference(cpi, upd);
|
||||
}
|
||||
|
@@ -512,10 +512,10 @@ int vp10_use_as_reference(VP10_COMP *cpi, int ref_frame_flags);
|
||||
|
||||
void vp10_update_reference(VP10_COMP *cpi, int ref_frame_flags);
|
||||
|
||||
int vp10_copy_reference_enc(VP10_COMP *cpi, VP9_REFFRAME ref_frame_flag,
|
||||
int vp10_copy_reference_enc(VP10_COMP *cpi, VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
int vp10_set_reference_enc(VP10_COMP *cpi, VP9_REFFRAME ref_frame_flag,
|
||||
int vp10_set_reference_enc(VP10_COMP *cpi, VPX_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
int vp10_update_entropy(VP10_COMP *cpi, int update);
|
||||
|
@@ -2999,8 +2999,8 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
||||
int_mv single_newmv[MAX_REF_FRAMES] = { { 0 } };
|
||||
INTERP_FILTER single_inter_filter[MB_MODE_COUNT][MAX_REF_FRAMES];
|
||||
int single_skippable[MB_MODE_COUNT][MAX_REF_FRAMES];
|
||||
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
|
||||
VP9_ALT_FLAG };
|
||||
static const int flag_list[4] = { 0, VPX_LAST_FLAG, VPX_GOLD_FLAG,
|
||||
VPX_ALT_FLAG };
|
||||
int64_t best_rd = best_rd_so_far;
|
||||
int64_t best_pred_diff[REFERENCE_MODES];
|
||||
int64_t best_pred_rd[REFERENCE_MODES];
|
||||
@@ -3721,8 +3721,8 @@ void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
||||
int comp_pred, i;
|
||||
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
|
||||
struct buf_2d yv12_mb[4][MAX_MB_PLANE];
|
||||
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
|
||||
VP9_ALT_FLAG };
|
||||
static const int flag_list[4] = { 0, VPX_LAST_FLAG, VPX_GOLD_FLAG,
|
||||
VPX_ALT_FLAG };
|
||||
int64_t best_rd = best_rd_so_far;
|
||||
int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise
|
||||
int64_t best_pred_diff[REFERENCE_MODES];
|
||||
|
@@ -104,17 +104,17 @@ struct vpx_codec_alg_priv {
|
||||
BufferPool *buffer_pool;
|
||||
};
|
||||
|
||||
static VP9_REFFRAME ref_frame_to_vp10_reframe(vpx_ref_frame_type_t frame) {
|
||||
static VPX_REFFRAME ref_frame_to_vp10_reframe(vpx_ref_frame_type_t frame) {
|
||||
switch (frame) {
|
||||
case VP8_LAST_FRAME:
|
||||
return VP9_LAST_FLAG;
|
||||
return VPX_LAST_FLAG;
|
||||
case VP8_GOLD_FRAME:
|
||||
return VP9_GOLD_FLAG;
|
||||
return VPX_GOLD_FLAG;
|
||||
case VP8_ALTR_FRAME:
|
||||
return VP9_ALT_FLAG;
|
||||
return VPX_ALT_FLAG;
|
||||
}
|
||||
assert(0 && "Invalid Reference Frame");
|
||||
return VP9_LAST_FLAG;
|
||||
return VPX_LAST_FLAG;
|
||||
}
|
||||
|
||||
static vpx_codec_err_t update_error_state(vpx_codec_alg_priv_t *ctx,
|
||||
|
@@ -806,7 +806,7 @@ static vpx_codec_err_t ctrl_set_reference(vpx_codec_alg_priv_t *ctx,
|
||||
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
|
||||
image2yuvconfig(&frame->img, &sd);
|
||||
return vp10_set_reference_dec(&frame_worker_data->pbi->common,
|
||||
(VP9_REFFRAME)frame->frame_type, &sd);
|
||||
(VPX_REFFRAME)frame->frame_type, &sd);
|
||||
} else {
|
||||
return VPX_CODEC_INVALID_PARAM;
|
||||
}
|
||||
@@ -829,7 +829,7 @@ static vpx_codec_err_t ctrl_copy_reference(vpx_codec_alg_priv_t *ctx,
|
||||
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
|
||||
image2yuvconfig(&frame->img, &sd);
|
||||
return vp10_copy_reference_dec(frame_worker_data->pbi,
|
||||
(VP9_REFFRAME)frame->frame_type, &sd);
|
||||
(VPX_REFFRAME)frame->frame_type, &sd);
|
||||
} else {
|
||||
return VPX_CODEC_INVALID_PARAM;
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ extern "C" {
|
||||
|
||||
/*!\brief The maximum number of reference buffers that a VP9 encoder may use.
|
||||
*/
|
||||
#define VP9_MAXIMUM_REF_BUFFERS 8
|
||||
#define VPX_MAXIMUM_REF_BUFFERS 8
|
||||
|
||||
/*!\brief External frame buffer
|
||||
*
|
||||
|
Reference in New Issue
Block a user