diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h index 2c8188a63..67cb77c51 100644 --- a/vp8/common/onyx.h +++ b/vp8/common/onyx.h @@ -37,14 +37,6 @@ extern "C" } VPX_SCALING; - typedef enum - { - VP8_LAST_FLAG = 1, - VP8_GOLD_FLAG = 2, - VP8_ALT_FLAG = 4 - } VP8_REFFRAME; - - typedef enum { USAGE_STREAM_FROM_SERVER = 0x0, @@ -244,8 +236,8 @@ extern "C" int vp8_use_as_reference(struct VP8_COMP* comp, int ref_frame_flags); int vp8_update_reference(struct VP8_COMP* comp, int ref_frame_flags); - int vp8_get_reference(struct VP8_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - int vp8_set_reference(struct VP8_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + int vp8_get_reference(struct VP8_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd); + int vp8_set_reference(struct VP8_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd); int vp8_update_entropy(struct VP8_COMP* comp, int update); int vp8_set_roimap(struct VP8_COMP* comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]); int vp8_set_active_map(struct VP8_COMP* comp, unsigned char *map, unsigned int rows, unsigned int cols); diff --git a/vp8/common/onyxd.h b/vp8/common/onyxd.h index 35a8b6e55..60af1cc4f 100644 --- a/vp8/common/onyxd.h +++ b/vp8/common/onyxd.h @@ -22,6 +22,7 @@ extern "C" #include "ppflags.h" #include "vpx_ports/mem.h" #include "vpx/vpx_codec.h" +#include "vpx/vp8.h" struct VP8D_COMP; @@ -35,12 +36,6 @@ extern "C" int error_concealment; int input_fragments; } VP8D_CONFIG; - typedef enum - { - VP8_LAST_FLAG = 1, - VP8_GOLD_FLAG = 2, - VP8_ALT_FLAG = 4 - } VP8_REFFRAME; typedef enum { @@ -56,8 +51,8 @@ extern "C" int vp8dx_receive_compressed_data(struct VP8D_COMP* comp, unsigned long size, const unsigned char *dest, int64_t time_stamp); int vp8dx_get_raw_frame(struct VP8D_COMP* comp, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags); - vpx_codec_err_t vp8dx_get_reference(struct VP8D_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - vpx_codec_err_t vp8dx_set_reference(struct VP8D_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + vpx_codec_err_t vp8dx_get_reference(struct VP8D_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd); + vpx_codec_err_t vp8dx_set_reference(struct VP8D_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd); struct VP8D_COMP* vp8dx_create_decompressor(VP8D_CONFIG *oxcf); diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index e9d1a560f..1c67e71d7 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -125,16 +125,16 @@ void vp8dx_remove_decompressor(VP8D_COMP *pbi) } -vpx_codec_err_t vp8dx_get_reference(VP8D_COMP *pbi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +vpx_codec_err_t vp8dx_get_reference(VP8D_COMP *pbi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd) { VP8_COMMON *cm = &pbi->common; int ref_fb_idx; - if (ref_frame_flag == VP8_LAST_FLAG) + if (ref_frame_flag == VP8_LAST_FRAME) ref_fb_idx = cm->lst_fb_idx; - else if (ref_frame_flag == VP8_GOLD_FLAG) + else if (ref_frame_flag == VP8_GOLD_FRAME) ref_fb_idx = cm->gld_fb_idx; - else if (ref_frame_flag == VP8_ALT_FLAG) + else if (ref_frame_flag == VP8_ALTR_FRAME) ref_fb_idx = cm->alt_fb_idx; else{ vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR, @@ -156,17 +156,17 @@ vpx_codec_err_t vp8dx_get_reference(VP8D_COMP *pbi, VP8_REFFRAME ref_frame_flag, } -vpx_codec_err_t vp8dx_set_reference(VP8D_COMP *pbi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +vpx_codec_err_t vp8dx_set_reference(VP8D_COMP *pbi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd) { VP8_COMMON *cm = &pbi->common; int *ref_fb_ptr = NULL; int free_fb; - if (ref_frame_flag == VP8_LAST_FLAG) + if (ref_frame_flag == VP8_LAST_FRAME) ref_fb_ptr = &cm->lst_fb_idx; - else if (ref_frame_flag == VP8_GOLD_FLAG) + else if (ref_frame_flag == VP8_GOLD_FRAME) ref_fb_ptr = &cm->gld_fb_idx; - else if (ref_frame_flag == VP8_ALT_FLAG) + else if (ref_frame_flag == VP8_ALTR_FRAME) ref_fb_ptr = &cm->alt_fb_idx; else{ vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR, diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 2cef01e4f..dce37a7ee 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -644,15 +644,15 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi) sizeof(ENTROPY_CONTEXT_PLANES) * cm->mb_cols); // Special case treatment when GF and ARF are not sensible options for reference - if (cpi->ref_frame_flags == VP8_LAST_FLAG) + if (cpi->ref_frame_flags == VP8_LAST_FRAME) vp8_calc_ref_frame_costs(x->ref_frame_cost, cpi->prob_intra_coded,255,128); else if ((cpi->oxcf.number_of_layers > 1) && - (cpi->ref_frame_flags == VP8_GOLD_FLAG)) + (cpi->ref_frame_flags == VP8_GOLD_FRAME)) vp8_calc_ref_frame_costs(x->ref_frame_cost, cpi->prob_intra_coded,1,255); else if ((cpi->oxcf.number_of_layers > 1) && - (cpi->ref_frame_flags == VP8_ALT_FLAG)) + (cpi->ref_frame_flags == VP8_ALTR_FRAME)) vp8_calc_ref_frame_costs(x->ref_frame_cost, cpi->prob_intra_coded,1,1); else diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index df1663792..df1252f81 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -703,11 +703,11 @@ void vp8_set_speed_features(VP8_COMP *cpi) /* Count enabled references */ ref_frames = 1; - if (cpi->ref_frame_flags & VP8_LAST_FLAG) + if (cpi->ref_frame_flags & VP8_LAST_FRAME) ref_frames++; - if (cpi->ref_frame_flags & VP8_GOLD_FLAG) + if (cpi->ref_frame_flags & VP8_GOLD_FRAME) ref_frames++; - if (cpi->ref_frame_flags & VP8_ALT_FLAG) + if (cpi->ref_frame_flags & VP8_ALTR_FRAME) ref_frames++; /* Convert speed to continuous range, with clamping */ @@ -1514,7 +1514,7 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf) cpi->baseline_gf_interval = cpi->oxcf.alt_freq ? cpi->oxcf.alt_freq : DEFAULT_GF_INTERVAL; - cpi->ref_frame_flags = VP8_ALT_FLAG | VP8_GOLD_FLAG | VP8_LAST_FLAG; + cpi->ref_frame_flags = VP8_ALTR_FRAME | VP8_GOLD_FRAME | VP8_LAST_FRAME; //cpi->use_golden_frame_only = 0; //cpi->use_last_frame_only = 0; @@ -2486,28 +2486,28 @@ int vp8_update_reference(VP8_COMP *cpi, int ref_frame_flags) cpi->common.refresh_alt_ref_frame = 0; cpi->common.refresh_last_frame = 0; - if (ref_frame_flags & VP8_LAST_FLAG) + if (ref_frame_flags & VP8_LAST_FRAME) cpi->common.refresh_last_frame = 1; - if (ref_frame_flags & VP8_GOLD_FLAG) + if (ref_frame_flags & VP8_GOLD_FRAME) cpi->common.refresh_golden_frame = 1; - if (ref_frame_flags & VP8_ALT_FLAG) + if (ref_frame_flags & VP8_ALTR_FRAME) cpi->common.refresh_alt_ref_frame = 1; return 0; } -int vp8_get_reference(VP8_COMP *cpi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +int vp8_get_reference(VP8_COMP *cpi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd) { VP8_COMMON *cm = &cpi->common; int ref_fb_idx; - if (ref_frame_flag == VP8_LAST_FLAG) + if (ref_frame_flag == VP8_LAST_FRAME) ref_fb_idx = cm->lst_fb_idx; - else if (ref_frame_flag == VP8_GOLD_FLAG) + else if (ref_frame_flag == VP8_GOLD_FRAME) ref_fb_idx = cm->gld_fb_idx; - else if (ref_frame_flag == VP8_ALT_FLAG) + else if (ref_frame_flag == VP8_ALTR_FRAME) ref_fb_idx = cm->alt_fb_idx; else return -1; @@ -2516,17 +2516,17 @@ int vp8_get_reference(VP8_COMP *cpi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CO return 0; } -int vp8_set_reference(VP8_COMP *cpi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +int vp8_set_reference(VP8_COMP *cpi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd) { VP8_COMMON *cm = &cpi->common; int ref_fb_idx; - if (ref_frame_flag == VP8_LAST_FLAG) + if (ref_frame_flag == VP8_LAST_FRAME) ref_fb_idx = cm->lst_fb_idx; - else if (ref_frame_flag == VP8_GOLD_FLAG) + else if (ref_frame_flag == VP8_GOLD_FRAME) ref_fb_idx = cm->gld_fb_idx; - else if (ref_frame_flag == VP8_ALT_FLAG) + else if (ref_frame_flag == VP8_ALTR_FRAME) ref_fb_idx = cm->alt_fb_idx; else return -1; @@ -3033,10 +3033,10 @@ static void update_reference_frames(VP8_COMMON *cm) if (cm->frame_type == KEY_FRAME) { - yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FLAG | VP8_ALT_FLAG ; + yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FRAME | VP8_ALTR_FRAME ; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME; cm->alt_fb_idx = cm->gld_fb_idx = cm->new_fb_idx; } @@ -3046,8 +3046,8 @@ static void update_reference_frames(VP8_COMMON *cm) { assert(!cm->copy_buffer_to_arf); - cm->yv12_fb[cm->new_fb_idx].flags |= VP8_ALT_FLAG; - cm->yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + cm->yv12_fb[cm->new_fb_idx].flags |= VP8_ALTR_FRAME; + cm->yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME; cm->alt_fb_idx = cm->new_fb_idx; } else if (cm->copy_buffer_to_arf) @@ -3058,8 +3058,8 @@ static void update_reference_frames(VP8_COMMON *cm) { if(cm->alt_fb_idx != cm->lst_fb_idx) { - yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + yv12_fb[cm->lst_fb_idx].flags |= VP8_ALTR_FRAME; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME; cm->alt_fb_idx = cm->lst_fb_idx; } } @@ -3067,8 +3067,8 @@ static void update_reference_frames(VP8_COMMON *cm) { if(cm->alt_fb_idx != cm->gld_fb_idx) { - yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + yv12_fb[cm->gld_fb_idx].flags |= VP8_ALTR_FRAME; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME; cm->alt_fb_idx = cm->gld_fb_idx; } } @@ -3078,8 +3078,8 @@ static void update_reference_frames(VP8_COMMON *cm) { assert(!cm->copy_buffer_to_gf); - cm->yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FLAG; - cm->yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + cm->yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FRAME; + cm->yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME; cm->gld_fb_idx = cm->new_fb_idx; } else if (cm->copy_buffer_to_gf) @@ -3090,8 +3090,8 @@ static void update_reference_frames(VP8_COMMON *cm) { if(cm->gld_fb_idx != cm->lst_fb_idx) { - yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FRAME; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME; cm->gld_fb_idx = cm->lst_fb_idx; } } @@ -3099,8 +3099,8 @@ static void update_reference_frames(VP8_COMMON *cm) { if(cm->alt_fb_idx != cm->gld_fb_idx) { - yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FRAME; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME; cm->gld_fb_idx = cm->alt_fb_idx; } } @@ -3109,8 +3109,8 @@ static void update_reference_frames(VP8_COMMON *cm) if (cm->refresh_last_frame) { - cm->yv12_fb[cm->new_fb_idx].flags |= VP8_LAST_FLAG; - cm->yv12_fb[cm->lst_fb_idx].flags &= ~VP8_LAST_FLAG; + cm->yv12_fb[cm->new_fb_idx].flags |= VP8_LAST_FRAME; + cm->yv12_fb[cm->lst_fb_idx].flags &= ~VP8_LAST_FRAME; cm->lst_fb_idx = cm->new_fb_idx; } } @@ -4527,16 +4527,16 @@ static void encode_frame_to_data_rate else if (cm->refresh_alt_ref_frame ^ cm->refresh_golden_frame) // 1 refreshed but not the other cpi->gold_is_alt = 0; - cpi->ref_frame_flags = VP8_ALT_FLAG | VP8_GOLD_FLAG | VP8_LAST_FLAG; + cpi->ref_frame_flags = VP8_ALTR_FRAME | VP8_GOLD_FRAME | VP8_LAST_FRAME; if (cpi->gold_is_last) - cpi->ref_frame_flags &= ~VP8_GOLD_FLAG; + cpi->ref_frame_flags &= ~VP8_GOLD_FRAME; if (cpi->alt_is_last) - cpi->ref_frame_flags &= ~VP8_ALT_FLAG; + cpi->ref_frame_flags &= ~VP8_ALTR_FRAME; if (cpi->gold_is_alt) - cpi->ref_frame_flags &= ~VP8_ALT_FLAG; + cpi->ref_frame_flags &= ~VP8_ALTR_FRAME; if (!cpi->oxcf.error_resilient_mode) diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index cf70231c4..8deee3481 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -25,6 +25,7 @@ #include "vp8/common/threading.h" #include "vpx_ports/mem.h" #include "vpx/internal/vpx_codec_internal.h" +#include "vpx/vp8.h" #include "mcomp.h" #include "vp8/common/findnearmv.h" #include "lookahead.h" diff --git a/vp8/encoder/rdopt.h b/vp8/encoder/rdopt.h index db939f96c..bbcb59f67 100644 --- a/vp8/encoder/rdopt.h +++ b/vp8/encoder/rdopt.h @@ -86,15 +86,15 @@ static void get_predictor_pointers(const VP8_COMP *cpi, unsigned int recon_yoffset, unsigned int recon_uvoffset) { - if (cpi->ref_frame_flags & VP8_LAST_FLAG) + if (cpi->ref_frame_flags & VP8_LAST_FRAME) get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx], plane[LAST_FRAME], recon_yoffset, recon_uvoffset); - if (cpi->ref_frame_flags & VP8_GOLD_FLAG) + if (cpi->ref_frame_flags & VP8_GOLD_FRAME) get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx], plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset); - if (cpi->ref_frame_flags & VP8_ALT_FLAG) + if (cpi->ref_frame_flags & VP8_ALTR_FRAME) get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx], plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset); } @@ -106,11 +106,11 @@ static void get_reference_search_order(const VP8_COMP *cpi, int i=0; ref_frame_map[i++] = INTRA_FRAME; - if (cpi->ref_frame_flags & VP8_LAST_FLAG) + if (cpi->ref_frame_flags & VP8_LAST_FRAME) ref_frame_map[i++] = LAST_FRAME; - if (cpi->ref_frame_flags & VP8_GOLD_FLAG) + if (cpi->ref_frame_flags & VP8_GOLD_FRAME) ref_frame_map[i++] = GOLDEN_FRAME; - if (cpi->ref_frame_flags & VP8_ALT_FLAG) + if (cpi->ref_frame_flags & VP8_ALTR_FRAME) ref_frame_map[i++] = ALTREF_FRAME; for(; i<4; i++) ref_frame_map[i] = -1; diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index ca06648fb..472db6e37 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -771,13 +771,13 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx, int ref = 7; if (flags & VP8_EFLAG_NO_REF_LAST) - ref ^= VP8_LAST_FLAG; + ref ^= VP8_LAST_FRAME; if (flags & VP8_EFLAG_NO_REF_GF) - ref ^= VP8_GOLD_FLAG; + ref ^= VP8_GOLD_FRAME; if (flags & VP8_EFLAG_NO_REF_ARF) - ref ^= VP8_ALT_FLAG; + ref ^= VP8_ALTR_FRAME; vp8_use_as_reference(ctx->cpi, ref); } @@ -789,13 +789,13 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx, int upd = 7; if (flags & VP8_EFLAG_NO_UPD_LAST) - upd ^= VP8_LAST_FLAG; + upd ^= VP8_LAST_FRAME; if (flags & VP8_EFLAG_NO_UPD_GF) - upd ^= VP8_GOLD_FLAG; + upd ^= VP8_GOLD_FRAME; if (flags & VP8_EFLAG_NO_UPD_ARF) - upd ^= VP8_ALT_FLAG; + upd ^= VP8_ALTR_FRAME; vp8_update_reference(ctx->cpi, upd); }