Merge "Renaming constants."
This commit is contained in:
commit
8eac2ca840
@ -34,7 +34,7 @@ void vp9_update_mode_info_border(VP9_COMMON *cm, MODE_INFO *mi) {
|
||||
void vp9_free_frame_buffers(VP9_COMMON *cm) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
for (i = 0; i < FRAME_BUFFERS; i++)
|
||||
vp9_free_frame_buffer(&cm->yv12_fb[i]);
|
||||
|
||||
vp9_free_frame_buffer(&cm->post_proc_buffer);
|
||||
@ -140,20 +140,20 @@ int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
|
||||
|
||||
vp9_free_frame_buffers(cm);
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++) {
|
||||
for (i = 0; i < FRAME_BUFFERS; i++) {
|
||||
cm->fb_idx_ref_cnt[i] = 0;
|
||||
if (vp9_alloc_frame_buffer(&cm->yv12_fb[i], width, height, ss_x, ss_y,
|
||||
VP9BORDERINPIXELS) < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
cm->new_fb_idx = NUM_YV12_BUFFERS - 1;
|
||||
cm->new_fb_idx = FRAME_BUFFERS - 1;
|
||||
cm->fb_idx_ref_cnt[cm->new_fb_idx] = 1;
|
||||
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; i++)
|
||||
for (i = 0; i < REFS_PER_FRAME; i++)
|
||||
cm->active_ref_idx[i] = i;
|
||||
|
||||
for (i = 0; i < NUM_REF_FRAMES; i++) {
|
||||
for (i = 0; i < REF_FRAMES; i++) {
|
||||
cm->ref_frame_map[i] = i;
|
||||
cm->fb_idx_ref_cnt[i] = 1;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm) {
|
||||
if (cm->frame_type == KEY_FRAME ||
|
||||
cm->error_resilient_mode || cm->reset_frame_context == 3) {
|
||||
// Reset all frame contexts.
|
||||
for (i = 0; i < NUM_FRAME_CONTEXTS; ++i)
|
||||
for (i = 0; i < FRAME_CONTEXTS; ++i)
|
||||
cm->frame_contexts[i] = cm->fc;
|
||||
} else if (cm->reset_frame_context == 2) {
|
||||
// Reset only the frame context specified in the frame header.
|
||||
|
@ -25,18 +25,18 @@
|
||||
#include "vp9/common/vp9_postproc.h"
|
||||
#endif
|
||||
|
||||
#define ALLOWED_REFS_PER_FRAME 3
|
||||
#define REFS_PER_FRAME 3
|
||||
|
||||
#define NUM_REF_FRAMES_LOG2 3
|
||||
#define NUM_REF_FRAMES (1 << NUM_REF_FRAMES_LOG2)
|
||||
#define REF_FRAMES_LOG2 3
|
||||
#define REF_FRAMES (1 << REF_FRAMES_LOG2)
|
||||
|
||||
// 1 scratch frame for the new frame, 3 for scaled references on the encoder
|
||||
// TODO(jkoleszar): These 3 extra references could probably come from the
|
||||
// normal reference pool.
|
||||
#define NUM_YV12_BUFFERS (NUM_REF_FRAMES + 4)
|
||||
#define FRAME_BUFFERS (REF_FRAMES + 4)
|
||||
|
||||
#define NUM_FRAME_CONTEXTS_LOG2 2
|
||||
#define NUM_FRAME_CONTEXTS (1 << NUM_FRAME_CONTEXTS_LOG2)
|
||||
#define FRAME_CONTEXTS_LOG2 2
|
||||
#define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2)
|
||||
|
||||
extern const struct {
|
||||
PARTITION_CONTEXT above;
|
||||
@ -113,17 +113,17 @@ typedef struct VP9Common {
|
||||
|
||||
YV12_BUFFER_CONFIG *frame_to_show;
|
||||
|
||||
YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
|
||||
int fb_idx_ref_cnt[NUM_YV12_BUFFERS]; /* reference counts */
|
||||
int ref_frame_map[NUM_REF_FRAMES]; /* maps fb_idx to reference slot */
|
||||
YV12_BUFFER_CONFIG yv12_fb[FRAME_BUFFERS];
|
||||
int fb_idx_ref_cnt[FRAME_BUFFERS]; /* reference counts */
|
||||
int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */
|
||||
|
||||
// TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and
|
||||
// roll new_fb_idx into it.
|
||||
|
||||
// Each frame can reference ALLOWED_REFS_PER_FRAME buffers
|
||||
int active_ref_idx[ALLOWED_REFS_PER_FRAME];
|
||||
struct scale_factors active_ref_scale[ALLOWED_REFS_PER_FRAME];
|
||||
struct scale_factors_common active_ref_scale_comm[ALLOWED_REFS_PER_FRAME];
|
||||
// Each frame can reference REFS_PER_FRAME buffers
|
||||
int active_ref_idx[REFS_PER_FRAME];
|
||||
struct scale_factors active_ref_scale[REFS_PER_FRAME];
|
||||
struct scale_factors_common active_ref_scale_comm[REFS_PER_FRAME];
|
||||
int new_fb_idx;
|
||||
|
||||
YV12_BUFFER_CONFIG post_proc_buffer;
|
||||
@ -198,7 +198,7 @@ typedef struct VP9Common {
|
||||
REFERENCE_MODE comp_pred_mode;
|
||||
|
||||
FRAME_CONTEXT fc; /* this frame entropy */
|
||||
FRAME_CONTEXT frame_contexts[NUM_FRAME_CONTEXTS];
|
||||
FRAME_CONTEXT frame_contexts[FRAME_CONTEXTS];
|
||||
unsigned int frame_context_idx; /* Context to use/update */
|
||||
FRAME_COUNTS counts;
|
||||
|
||||
@ -228,11 +228,11 @@ static YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) {
|
||||
|
||||
static int get_free_fb(VP9_COMMON *cm) {
|
||||
int i;
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
for (i = 0; i < FRAME_BUFFERS; i++)
|
||||
if (cm->fb_idx_ref_cnt[i] == 0)
|
||||
break;
|
||||
|
||||
assert(i < NUM_YV12_BUFFERS);
|
||||
assert(i < FRAME_BUFFERS);
|
||||
cm->fb_idx_ref_cnt[i] = 1;
|
||||
return i;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void vp9_setup_scale_factors(VP9_COMMON *cm, int i) {
|
||||
const int ref = cm->active_ref_idx[i];
|
||||
struct scale_factors *const sf = &cm->active_ref_scale[i];
|
||||
struct scale_factors_common *const sfc = &cm->active_ref_scale_comm[i];
|
||||
if (ref >= NUM_YV12_BUFFERS) {
|
||||
if (ref >= FRAME_BUFFERS) {
|
||||
vp9_zero(*sf);
|
||||
vp9_zero(*sfc);
|
||||
} else {
|
||||
|
@ -50,7 +50,7 @@ static int read_be32(const uint8_t *p) {
|
||||
|
||||
static int is_compound_reference_allowed(const VP9_COMMON *cm) {
|
||||
int i;
|
||||
for (i = 1; i < ALLOWED_REFS_PER_FRAME; ++i)
|
||||
for (i = 1; i < REFS_PER_FRAME; ++i)
|
||||
if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1])
|
||||
return 1;
|
||||
|
||||
@ -719,7 +719,7 @@ static void setup_frame_size_with_refs(VP9D_COMP *pbi,
|
||||
|
||||
int width, height;
|
||||
int found = 0, i;
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
if (vp9_rb_read_bit(rb)) {
|
||||
YV12_BUFFER_CONFIG *const cfg = get_frame_ref_buffer(cm, i);
|
||||
width = cfg->y_crop_width;
|
||||
@ -1096,9 +1096,9 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
}
|
||||
}
|
||||
|
||||
pbi->refresh_frame_flags = (1 << NUM_REF_FRAMES) - 1;
|
||||
pbi->refresh_frame_flags = (1 << REF_FRAMES) - 1;
|
||||
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i)
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i)
|
||||
cm->active_ref_idx[i] = cm->new_fb_idx;
|
||||
|
||||
setup_frame_size(pbi, rb);
|
||||
@ -1111,13 +1111,13 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
if (cm->intra_only) {
|
||||
check_sync_code(cm, rb);
|
||||
|
||||
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, NUM_REF_FRAMES);
|
||||
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES);
|
||||
setup_frame_size(pbi, rb);
|
||||
} else {
|
||||
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, NUM_REF_FRAMES);
|
||||
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES);
|
||||
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||
const int ref = vp9_rb_read_literal(rb, NUM_REF_FRAMES_LOG2);
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
const int ref = vp9_rb_read_literal(rb, REF_FRAMES_LOG2);
|
||||
cm->active_ref_idx[i] = cm->ref_frame_map[ref];
|
||||
cm->ref_frame_sign_bias[LAST_FRAME + i] = vp9_rb_read_bit(rb);
|
||||
}
|
||||
@ -1127,7 +1127,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
cm->allow_high_precision_mv = vp9_rb_read_bit(rb);
|
||||
cm->mcomp_filter_type = read_interp_filter_type(rb);
|
||||
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
vp9_setup_scale_factors(cm, i);
|
||||
if (vp9_is_scaled(&cm->active_ref_scale_comm[i]))
|
||||
vp9_extend_frame_borders(&cm->yv12_fb[cm->active_ref_idx[i]],
|
||||
@ -1146,7 +1146,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
|
||||
// This flag will be overridden by the call to vp9_setup_past_independence
|
||||
// below, forcing the use of context 0 for those frame types.
|
||||
cm->frame_context_idx = vp9_rb_read_literal(rb, NUM_FRAME_CONTEXTS_LOG2);
|
||||
cm->frame_context_idx = vp9_rb_read_literal(rb, FRAME_CONTEXTS_LOG2);
|
||||
|
||||
if (frame_is_intra_only(cm) || cm->error_resilient_mode)
|
||||
vp9_setup_past_independence(cm);
|
||||
|
@ -261,7 +261,7 @@ int vp9_get_reference_dec(VP9D_PTR ptr, int index, YV12_BUFFER_CONFIG **fb) {
|
||||
VP9D_COMP *pbi = (VP9D_COMP *) ptr;
|
||||
VP9_COMMON *cm = &pbi->common;
|
||||
|
||||
if (index < 0 || index >= NUM_REF_FRAMES)
|
||||
if (index < 0 || index >= REF_FRAMES)
|
||||
return -1;
|
||||
|
||||
*fb = &cm->yv12_fb[cm->ref_frame_map[index]];
|
||||
|
@ -1104,11 +1104,11 @@ static void write_frame_size(VP9_COMP *cpi,
|
||||
static void write_frame_size_with_refs(VP9_COMP *cpi,
|
||||
struct vp9_write_bit_buffer *wb) {
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
int refs[ALLOWED_REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
int refs[REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
int i, found = 0;
|
||||
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->ref_frame_map[refs[i]]];
|
||||
found = cm->width == cfg->y_crop_width &&
|
||||
cm->height == cfg->y_crop_height;
|
||||
@ -1173,8 +1173,8 @@ static void write_uncompressed_header(VP9_COMP *cpi,
|
||||
|
||||
write_frame_size(cpi, wb);
|
||||
} else {
|
||||
const int refs[ALLOWED_REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
const int refs[REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
if (!cm->show_frame)
|
||||
vp9_wb_write_bit(wb, cm->intra_only);
|
||||
|
||||
@ -1184,13 +1184,13 @@ static void write_uncompressed_header(VP9_COMP *cpi,
|
||||
if (cm->intra_only) {
|
||||
write_sync_code(wb);
|
||||
|
||||
vp9_wb_write_literal(wb, get_refresh_mask(cpi), NUM_REF_FRAMES);
|
||||
vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
|
||||
write_frame_size(cpi, wb);
|
||||
} else {
|
||||
int i;
|
||||
vp9_wb_write_literal(wb, get_refresh_mask(cpi), NUM_REF_FRAMES);
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||
vp9_wb_write_literal(wb, refs[i], NUM_REF_FRAMES_LOG2);
|
||||
vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
vp9_wb_write_literal(wb, refs[i], REF_FRAMES_LOG2);
|
||||
vp9_wb_write_bit(wb, cm->ref_frame_sign_bias[LAST_FRAME + i]);
|
||||
}
|
||||
|
||||
@ -1208,7 +1208,7 @@ static void write_uncompressed_header(VP9_COMP *cpi,
|
||||
vp9_wb_write_bit(wb, cm->frame_parallel_decoding_mode);
|
||||
}
|
||||
|
||||
vp9_wb_write_literal(wb, cm->frame_context_idx, NUM_FRAME_CONTEXTS_LOG2);
|
||||
vp9_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
|
||||
|
||||
encode_loopfilter(&cm->lf, wb);
|
||||
encode_quantization(cm, wb);
|
||||
|
@ -2151,7 +2151,7 @@ int vp9_get_reference_enc(VP9_PTR ptr, int index, YV12_BUFFER_CONFIG **fb) {
|
||||
VP9_COMP *cpi = (VP9_COMP *)(ptr);
|
||||
VP9_COMMON *cm = &cpi->common;
|
||||
|
||||
if (index < 0 || index >= NUM_REF_FRAMES)
|
||||
if (index < 0 || index >= REF_FRAMES)
|
||||
return -1;
|
||||
|
||||
*fb = &cm->yv12_fb[cm->ref_frame_map[index]];
|
||||
@ -2551,8 +2551,8 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
|
||||
static void scale_references(VP9_COMP *cpi) {
|
||||
VP9_COMMON *cm = &cpi->common;
|
||||
int i;
|
||||
int refs[ALLOWED_REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
int refs[REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
YV12_BUFFER_CONFIG *ref = &cm->yv12_fb[cm->ref_frame_map[refs[i]]];
|
||||
@ -3558,7 +3558,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
|
||||
VP9BORDERINPIXELS);
|
||||
|
||||
// Calculate scaling factors for each of the 3 available references
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
vp9_setup_scale_factors(cm, i);
|
||||
if (vp9_is_scaled(&cm->active_ref_scale_comm[i]))
|
||||
vp9_extend_frame_borders(&cm->yv12_fb[cm->active_ref_idx[i]],
|
||||
|
@ -366,7 +366,7 @@ typedef struct VP9_COMP {
|
||||
struct lookahead_ctx *lookahead;
|
||||
struct lookahead_entry *source;
|
||||
#if CONFIG_MULTIPLE_ARF
|
||||
struct lookahead_entry *alt_ref_source[NUM_REF_FRAMES];
|
||||
struct lookahead_entry *alt_ref_source[REF_FRAMES];
|
||||
#else
|
||||
struct lookahead_entry *alt_ref_source;
|
||||
#endif
|
||||
@ -394,7 +394,7 @@ typedef struct VP9_COMP {
|
||||
int use_svc;
|
||||
|
||||
#if CONFIG_MULTIPLE_ARF
|
||||
int alt_ref_fb_idx[NUM_REF_FRAMES - 3];
|
||||
int alt_ref_fb_idx[REF_FRAMES - 3];
|
||||
#endif
|
||||
int refresh_last_frame;
|
||||
int refresh_golden_frame;
|
||||
|
@ -199,7 +199,7 @@ void vp9_setup_inter_frame(VP9_COMP *cpi) {
|
||||
if (cm->error_resilient_mode || cm->intra_only)
|
||||
vp9_setup_past_independence(cm);
|
||||
|
||||
assert(cm->frame_context_idx < NUM_FRAME_CONTEXTS);
|
||||
assert(cm->frame_context_idx < FRAME_CONTEXTS);
|
||||
cm->fc = cm->frame_contexts[cm->frame_context_idx];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user