Merge changes Ib1e853f9,Ifd75c809,If3e83404
* changes: consistently name VP9_COMMON variables #3 consistently name VP9_COMMON variables #2 consistently name VP9_COMMON variables #1
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "vp9_rtcd.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
|
||||
void vp9_machine_specific_config(VP9_COMMON *ctx) {
|
||||
void vp9_machine_specific_config(VP9_COMMON *cm) {
|
||||
(void)cm;
|
||||
vp9_rtcd();
|
||||
}
|
||||
|
@@ -47,26 +47,26 @@ void vp9_update_mode_info_in_image(VP9_COMMON *cm, MODE_INFO *mi) {
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_free_frame_buffers(VP9_COMMON *oci) {
|
||||
void vp9_free_frame_buffers(VP9_COMMON *cm) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
vp9_free_frame_buffer(&oci->yv12_fb[i]);
|
||||
vp9_free_frame_buffer(&cm->yv12_fb[i]);
|
||||
|
||||
vp9_free_frame_buffer(&oci->post_proc_buffer);
|
||||
vp9_free_frame_buffer(&cm->post_proc_buffer);
|
||||
|
||||
vpx_free(oci->mip);
|
||||
vpx_free(oci->prev_mip);
|
||||
vpx_free(oci->above_seg_context);
|
||||
vpx_free(oci->last_frame_seg_map);
|
||||
vpx_free(cm->mip);
|
||||
vpx_free(cm->prev_mip);
|
||||
vpx_free(cm->above_seg_context);
|
||||
vpx_free(cm->last_frame_seg_map);
|
||||
|
||||
vpx_free(oci->above_context[0]);
|
||||
vpx_free(cm->above_context[0]);
|
||||
for (i = 0; i < MAX_MB_PLANE; i++)
|
||||
oci->above_context[i] = 0;
|
||||
oci->mip = NULL;
|
||||
oci->prev_mip = NULL;
|
||||
oci->above_seg_context = NULL;
|
||||
oci->last_frame_seg_map = NULL;
|
||||
cm->above_context[i] = 0;
|
||||
cm->mip = NULL;
|
||||
cm->prev_mip = NULL;
|
||||
cm->above_seg_context = NULL;
|
||||
cm->last_frame_seg_map = NULL;
|
||||
}
|
||||
|
||||
static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
|
||||
@@ -93,95 +93,95 @@ static void setup_mi(VP9_COMMON *cm) {
|
||||
vp9_update_mode_info_in_image(cm, cm->prev_mi);
|
||||
}
|
||||
|
||||
int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
|
||||
int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
|
||||
int i, mi_cols;
|
||||
|
||||
const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2);
|
||||
const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2);
|
||||
const int ss_x = oci->subsampling_x;
|
||||
const int ss_y = oci->subsampling_y;
|
||||
const int ss_x = cm->subsampling_x;
|
||||
const int ss_y = cm->subsampling_y;
|
||||
int mi_size;
|
||||
|
||||
vp9_free_frame_buffers(oci);
|
||||
vp9_free_frame_buffers(cm);
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++) {
|
||||
oci->fb_idx_ref_cnt[i] = 0;
|
||||
if (vp9_alloc_frame_buffer(&oci->yv12_fb[i], width, height, ss_x, ss_y,
|
||||
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;
|
||||
}
|
||||
|
||||
oci->new_fb_idx = NUM_YV12_BUFFERS - 1;
|
||||
oci->fb_idx_ref_cnt[oci->new_fb_idx] = 1;
|
||||
cm->new_fb_idx = NUM_YV12_BUFFERS - 1;
|
||||
cm->fb_idx_ref_cnt[cm->new_fb_idx] = 1;
|
||||
|
||||
for (i = 0; i < ALLOWED_REFS_PER_FRAME; i++)
|
||||
oci->active_ref_idx[i] = i;
|
||||
cm->active_ref_idx[i] = i;
|
||||
|
||||
for (i = 0; i < NUM_REF_FRAMES; i++) {
|
||||
oci->ref_frame_map[i] = i;
|
||||
oci->fb_idx_ref_cnt[i] = 1;
|
||||
cm->ref_frame_map[i] = i;
|
||||
cm->fb_idx_ref_cnt[i] = 1;
|
||||
}
|
||||
|
||||
if (vp9_alloc_frame_buffer(&oci->post_proc_buffer, width, height, ss_x, ss_y,
|
||||
if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y,
|
||||
VP9BORDERINPIXELS) < 0)
|
||||
goto fail;
|
||||
|
||||
set_mb_mi(oci, aligned_width, aligned_height);
|
||||
set_mb_mi(cm, aligned_width, aligned_height);
|
||||
|
||||
// Allocation
|
||||
mi_size = oci->mode_info_stride * (oci->mi_rows + MI_BLOCK_SIZE);
|
||||
mi_size = cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE);
|
||||
|
||||
oci->mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
|
||||
if (!oci->mip)
|
||||
cm->mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
|
||||
if (!cm->mip)
|
||||
goto fail;
|
||||
|
||||
oci->prev_mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
|
||||
if (!oci->prev_mip)
|
||||
cm->prev_mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
|
||||
if (!cm->prev_mip)
|
||||
goto fail;
|
||||
|
||||
setup_mi(oci);
|
||||
setup_mi(cm);
|
||||
|
||||
// FIXME(jkoleszar): allocate subsampled arrays for U/V once subsampling
|
||||
// information is exposed at this level
|
||||
mi_cols = mi_cols_aligned_to_sb(oci->mi_cols);
|
||||
mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
|
||||
|
||||
// 2 contexts per 'mi unit', so that we have one context per 4x4 txfm
|
||||
// block where mi unit size is 8x8.
|
||||
oci->above_context[0] = vpx_calloc(sizeof(ENTROPY_CONTEXT) * MAX_MB_PLANE *
|
||||
cm->above_context[0] = vpx_calloc(sizeof(ENTROPY_CONTEXT) * MAX_MB_PLANE *
|
||||
(2 * mi_cols), 1);
|
||||
if (!oci->above_context[0])
|
||||
if (!cm->above_context[0])
|
||||
goto fail;
|
||||
|
||||
oci->above_seg_context = vpx_calloc(sizeof(PARTITION_CONTEXT) * mi_cols, 1);
|
||||
if (!oci->above_seg_context)
|
||||
cm->above_seg_context = vpx_calloc(sizeof(PARTITION_CONTEXT) * mi_cols, 1);
|
||||
if (!cm->above_seg_context)
|
||||
goto fail;
|
||||
|
||||
// Create the segmentation map structure and set to 0.
|
||||
oci->last_frame_seg_map = vpx_calloc(oci->mi_rows * oci->mi_cols, 1);
|
||||
if (!oci->last_frame_seg_map)
|
||||
cm->last_frame_seg_map = vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
|
||||
if (!cm->last_frame_seg_map)
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
vp9_free_frame_buffers(oci);
|
||||
vp9_free_frame_buffers(cm);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void vp9_create_common(VP9_COMMON *oci) {
|
||||
vp9_machine_specific_config(oci);
|
||||
void vp9_create_common(VP9_COMMON *cm) {
|
||||
vp9_machine_specific_config(cm);
|
||||
|
||||
vp9_init_mbmode_probs(oci);
|
||||
vp9_init_mbmode_probs(cm);
|
||||
|
||||
oci->tx_mode = ONLY_4X4;
|
||||
oci->comp_pred_mode = HYBRID_PREDICTION;
|
||||
cm->tx_mode = ONLY_4X4;
|
||||
cm->comp_pred_mode = HYBRID_PREDICTION;
|
||||
|
||||
// Initialize reference frame sign bias structure to defaults
|
||||
vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
|
||||
vpx_memset(cm->ref_frame_sign_bias, 0, sizeof(cm->ref_frame_sign_bias));
|
||||
}
|
||||
|
||||
void vp9_remove_common(VP9_COMMON *oci) {
|
||||
vp9_free_frame_buffers(oci);
|
||||
void vp9_remove_common(VP9_COMMON *cm) {
|
||||
vp9_free_frame_buffers(cm);
|
||||
}
|
||||
|
||||
void vp9_initialize_common() {
|
||||
|
@@ -16,14 +16,14 @@
|
||||
|
||||
void vp9_initialize_common();
|
||||
|
||||
void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi);
|
||||
void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi);
|
||||
void vp9_update_mode_info_border(VP9_COMMON *cm, MODE_INFO *mi);
|
||||
void vp9_update_mode_info_in_image(VP9_COMMON *cm, MODE_INFO *mi);
|
||||
|
||||
void vp9_create_common(VP9_COMMON *oci);
|
||||
void vp9_remove_common(VP9_COMMON *oci);
|
||||
void vp9_create_common(VP9_COMMON *cm);
|
||||
void vp9_remove_common(VP9_COMMON *cm);
|
||||
|
||||
int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height);
|
||||
void vp9_free_frame_buffers(VP9_COMMON *oci);
|
||||
int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height);
|
||||
void vp9_free_frame_buffers(VP9_COMMON *cm);
|
||||
|
||||
|
||||
void vp9_update_frame_size(VP9_COMMON *cm);
|
||||
|
@@ -22,17 +22,17 @@ static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) {
|
||||
* and uses the passed in member offset to print out the value of an integer
|
||||
* for each mbmi member value in the mi structure.
|
||||
*/
|
||||
static void print_mi_data(VP9_COMMON *common, FILE *file, char *descriptor,
|
||||
static void print_mi_data(VP9_COMMON *cm, FILE *file, char *descriptor,
|
||||
size_t member_offset) {
|
||||
int mi_row;
|
||||
int mi_col;
|
||||
int mi_index = 0;
|
||||
MODE_INFO *mi = common->mi;
|
||||
int rows = common->mi_rows;
|
||||
int cols = common->mi_cols;
|
||||
MODE_INFO *mi = cm->mi;
|
||||
int rows = cm->mi_rows;
|
||||
int cols = cm->mi_cols;
|
||||
char prefix = descriptor[0];
|
||||
|
||||
log_frame_info(common, descriptor, file);
|
||||
log_frame_info(cm, descriptor, file);
|
||||
mi_index = 0;
|
||||
for (mi_row = 0; mi_row < rows; mi_row++) {
|
||||
fprintf(file, "%c ", prefix);
|
||||
|
@@ -436,11 +436,11 @@ const vp9_extra_bit vp9_extra_bits[12] = {
|
||||
|
||||
#include "vp9/common/vp9_default_coef_probs.h"
|
||||
|
||||
void vp9_default_coef_probs(VP9_COMMON *pc) {
|
||||
vp9_copy(pc->fc.coef_probs[TX_4X4], default_coef_probs_4x4);
|
||||
vp9_copy(pc->fc.coef_probs[TX_8X8], default_coef_probs_8x8);
|
||||
vp9_copy(pc->fc.coef_probs[TX_16X16], default_coef_probs_16x16);
|
||||
vp9_copy(pc->fc.coef_probs[TX_32X32], default_coef_probs_32x32);
|
||||
void vp9_default_coef_probs(VP9_COMMON *cm) {
|
||||
vp9_copy(cm->fc.coef_probs[TX_4X4], default_coef_probs_4x4);
|
||||
vp9_copy(cm->fc.coef_probs[TX_8X8], default_coef_probs_8x8);
|
||||
vp9_copy(cm->fc.coef_probs[TX_16X16], default_coef_probs_16x16);
|
||||
vp9_copy(cm->fc.coef_probs[TX_32X32], default_coef_probs_32x32);
|
||||
}
|
||||
|
||||
// Neighborhood 5-tuples for various scans and blocksizes,
|
||||
|
@@ -95,7 +95,7 @@ typedef vp9_prob vp9_coeff_probs[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
#define MODULUS_PARAM 13 /* Modulus parameter */
|
||||
|
||||
struct VP9Common;
|
||||
void vp9_default_coef_probs(struct VP9Common *);
|
||||
void vp9_default_coef_probs(struct VP9Common *cm);
|
||||
extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_4x4[16]);
|
||||
|
||||
extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_4x4[16]);
|
||||
@@ -154,7 +154,7 @@ extern DECLARE_ALIGNED(16, int16_t,
|
||||
vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
|
||||
|
||||
void vp9_coef_tree_initialize(void);
|
||||
void vp9_adapt_coef_probs(struct VP9Common *);
|
||||
void vp9_adapt_coef_probs(struct VP9Common *cm);
|
||||
|
||||
static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) {
|
||||
int i;
|
||||
|
@@ -58,9 +58,9 @@ void vp9_entropy_mode_init();
|
||||
|
||||
void vp9_setup_past_independence(struct VP9Common *cm);
|
||||
|
||||
void vp9_init_mbmode_probs(struct VP9Common *x);
|
||||
void vp9_init_mbmode_probs(struct VP9Common *cm);
|
||||
|
||||
void vp9_adapt_mode_probs(struct VP9Common *);
|
||||
void vp9_adapt_mode_probs(struct VP9Common *cm);
|
||||
|
||||
void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p,
|
||||
unsigned int (*ct_32x32p)[2]);
|
||||
|
@@ -36,7 +36,7 @@ static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
|
||||
xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
|
||||
}
|
||||
|
||||
void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *pc,
|
||||
void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm,
|
||||
MACROBLOCKD *xd,
|
||||
int_mv *dst_nearest,
|
||||
int_mv *dst_near,
|
||||
|
@@ -630,21 +630,21 @@ static void constrain_line(int x0, int *x1, int y0, int *y1,
|
||||
}
|
||||
}
|
||||
|
||||
int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
int vp9_post_proc_frame(struct VP9Common *cm,
|
||||
YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *ppflags) {
|
||||
int q = oci->lf.filter_level * 10 / 6;
|
||||
int q = cm->lf.filter_level * 10 / 6;
|
||||
int flags = ppflags->post_proc_flag;
|
||||
int deblock_level = ppflags->deblocking_level;
|
||||
int noise_level = ppflags->noise_level;
|
||||
|
||||
if (!oci->frame_to_show)
|
||||
if (!cm->frame_to_show)
|
||||
return -1;
|
||||
|
||||
if (q > 63)
|
||||
q = 63;
|
||||
|
||||
if (!flags) {
|
||||
*dest = *oci->frame_to_show;
|
||||
*dest = *cm->frame_to_show;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -653,52 +653,52 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
#endif
|
||||
|
||||
if (flags & VP9D_DEMACROBLOCK) {
|
||||
deblock_and_de_macro_block(oci->frame_to_show, &oci->post_proc_buffer,
|
||||
deblock_and_de_macro_block(cm->frame_to_show, &cm->post_proc_buffer,
|
||||
q + (deblock_level - 5) * 10, 1, 0);
|
||||
} else if (flags & VP9D_DEBLOCK) {
|
||||
vp9_deblock(oci->frame_to_show, &oci->post_proc_buffer, q);
|
||||
vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, q);
|
||||
} else {
|
||||
vp8_yv12_copy_frame(oci->frame_to_show, &oci->post_proc_buffer);
|
||||
vp8_yv12_copy_frame(cm->frame_to_show, &cm->post_proc_buffer);
|
||||
}
|
||||
|
||||
if (flags & VP9D_ADDNOISE) {
|
||||
if (oci->postproc_state.last_q != q
|
||||
|| oci->postproc_state.last_noise != noise_level) {
|
||||
fillrd(&oci->postproc_state, 63 - q, noise_level);
|
||||
if (cm->postproc_state.last_q != q
|
||||
|| cm->postproc_state.last_noise != noise_level) {
|
||||
fillrd(&cm->postproc_state, 63 - q, noise_level);
|
||||
}
|
||||
|
||||
vp9_plane_add_noise(oci->post_proc_buffer.y_buffer,
|
||||
oci->postproc_state.noise,
|
||||
oci->postproc_state.blackclamp,
|
||||
oci->postproc_state.whiteclamp,
|
||||
oci->postproc_state.bothclamp,
|
||||
oci->post_proc_buffer.y_width,
|
||||
oci->post_proc_buffer.y_height,
|
||||
oci->post_proc_buffer.y_stride);
|
||||
vp9_plane_add_noise(cm->post_proc_buffer.y_buffer,
|
||||
cm->postproc_state.noise,
|
||||
cm->postproc_state.blackclamp,
|
||||
cm->postproc_state.whiteclamp,
|
||||
cm->postproc_state.bothclamp,
|
||||
cm->post_proc_buffer.y_width,
|
||||
cm->post_proc_buffer.y_height,
|
||||
cm->post_proc_buffer.y_stride);
|
||||
}
|
||||
|
||||
#if 0 && CONFIG_POSTPROC_VISUALIZER
|
||||
if (flags & VP9D_DEBUG_TXT_FRAME_INFO) {
|
||||
char message[512];
|
||||
sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d",
|
||||
(oci->frame_type == KEY_FRAME),
|
||||
oci->refresh_golden_frame,
|
||||
oci->base_qindex,
|
||||
oci->filter_level,
|
||||
(cm->frame_type == KEY_FRAME),
|
||||
cm->refresh_golden_frame,
|
||||
cm->base_qindex,
|
||||
cm->filter_level,
|
||||
flags,
|
||||
oci->mb_cols, oci->mb_rows);
|
||||
vp9_blit_text(message, oci->post_proc_buffer.y_buffer,
|
||||
oci->post_proc_buffer.y_stride);
|
||||
cm->mb_cols, cm->mb_rows);
|
||||
vp9_blit_text(message, cm->post_proc_buffer.y_buffer,
|
||||
cm->post_proc_buffer.y_stride);
|
||||
}
|
||||
|
||||
if (flags & VP9D_DEBUG_TXT_MBLK_MODES) {
|
||||
int i, j;
|
||||
uint8_t *y_ptr;
|
||||
YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG *post = &cm->post_proc_buffer;
|
||||
int mb_rows = post->y_height >> 4;
|
||||
int mb_cols = post->y_width >> 4;
|
||||
int mb_index = 0;
|
||||
MODE_INFO *mi = oci->mi;
|
||||
MODE_INFO *mi = cm->mi;
|
||||
|
||||
y_ptr = post->y_buffer + 4 * post->y_stride + 4;
|
||||
|
||||
@@ -723,11 +723,11 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
if (flags & VP9D_DEBUG_TXT_DC_DIFF) {
|
||||
int i, j;
|
||||
uint8_t *y_ptr;
|
||||
YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG *post = &cm->post_proc_buffer;
|
||||
int mb_rows = post->y_height >> 4;
|
||||
int mb_cols = post->y_width >> 4;
|
||||
int mb_index = 0;
|
||||
MODE_INFO *mi = oci->mi;
|
||||
MODE_INFO *mi = cm->mi;
|
||||
|
||||
y_ptr = post->y_buffer + 4 * post->y_stride + 4;
|
||||
|
||||
@@ -739,7 +739,7 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
mi[mb_index].mbmi.mode != SPLITMV &&
|
||||
mi[mb_index].mbmi.skip_coeff);
|
||||
|
||||
if (oci->frame_type == KEY_FRAME)
|
||||
if (cm->frame_type == KEY_FRAME)
|
||||
sprintf(zz, "a");
|
||||
else
|
||||
sprintf(zz, "%c", dc_diff + '0');
|
||||
@@ -759,19 +759,19 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
char message[512];
|
||||
snprintf(message, sizeof(message),
|
||||
"Bitrate: %10.2f framerate: %10.2f ",
|
||||
oci->bitrate, oci->framerate);
|
||||
vp9_blit_text(message, oci->post_proc_buffer.y_buffer,
|
||||
oci->post_proc_buffer.y_stride);
|
||||
cm->bitrate, cm->framerate);
|
||||
vp9_blit_text(message, cm->post_proc_buffer.y_buffer,
|
||||
cm->post_proc_buffer.y_stride);
|
||||
}
|
||||
|
||||
/* Draw motion vectors */
|
||||
if ((flags & VP9D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) {
|
||||
YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG *post = &cm->post_proc_buffer;
|
||||
int width = post->y_width;
|
||||
int height = post->y_height;
|
||||
uint8_t *y_buffer = oci->post_proc_buffer.y_buffer;
|
||||
int y_stride = oci->post_proc_buffer.y_stride;
|
||||
MODE_INFO *mi = oci->mi;
|
||||
uint8_t *y_buffer = cm->post_proc_buffer.y_buffer;
|
||||
int y_stride = cm->post_proc_buffer.y_stride;
|
||||
MODE_INFO *mi = cm->mi;
|
||||
int x0, y0;
|
||||
|
||||
for (y0 = 0; y0 < height; y0 += 16) {
|
||||
@@ -908,14 +908,14 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
if ((flags & VP9D_DEBUG_CLR_BLK_MODES)
|
||||
&& (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag)) {
|
||||
int y, x;
|
||||
YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG *post = &cm->post_proc_buffer;
|
||||
int width = post->y_width;
|
||||
int height = post->y_height;
|
||||
uint8_t *y_ptr = oci->post_proc_buffer.y_buffer;
|
||||
uint8_t *u_ptr = oci->post_proc_buffer.u_buffer;
|
||||
uint8_t *v_ptr = oci->post_proc_buffer.v_buffer;
|
||||
int y_stride = oci->post_proc_buffer.y_stride;
|
||||
MODE_INFO *mi = oci->mi;
|
||||
uint8_t *y_ptr = cm->post_proc_buffer.y_buffer;
|
||||
uint8_t *u_ptr = cm->post_proc_buffer.u_buffer;
|
||||
uint8_t *v_ptr = cm->post_proc_buffer.v_buffer;
|
||||
int y_stride = cm->post_proc_buffer.y_stride;
|
||||
MODE_INFO *mi = cm->mi;
|
||||
|
||||
for (y = 0; y < height; y += 16) {
|
||||
for (x = 0; x < width; x += 16) {
|
||||
@@ -973,14 +973,14 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
if ((flags & VP9D_DEBUG_CLR_FRM_REF_BLKS) &&
|
||||
ppflags->display_ref_frame_flag) {
|
||||
int y, x;
|
||||
YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG *post = &cm->post_proc_buffer;
|
||||
int width = post->y_width;
|
||||
int height = post->y_height;
|
||||
uint8_t *y_ptr = oci->post_proc_buffer.y_buffer;
|
||||
uint8_t *u_ptr = oci->post_proc_buffer.u_buffer;
|
||||
uint8_t *v_ptr = oci->post_proc_buffer.v_buffer;
|
||||
int y_stride = oci->post_proc_buffer.y_stride;
|
||||
MODE_INFO *mi = oci->mi;
|
||||
uint8_t *y_ptr = cm->post_proc_buffer.y_buffer;
|
||||
uint8_t *u_ptr = cm->post_proc_buffer.u_buffer;
|
||||
uint8_t *v_ptr = cm->post_proc_buffer.v_buffer;
|
||||
int y_stride = cm->post_proc_buffer.y_stride;
|
||||
MODE_INFO *mi = cm->mi;
|
||||
|
||||
for (y = 0; y < height; y += 16) {
|
||||
for (x = 0; x < width; x += 16) {
|
||||
@@ -1006,11 +1006,11 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
}
|
||||
#endif
|
||||
|
||||
*dest = oci->post_proc_buffer;
|
||||
*dest = cm->post_proc_buffer;
|
||||
|
||||
/* handle problem with extending borders */
|
||||
dest->y_width = oci->width;
|
||||
dest->y_height = oci->height;
|
||||
dest->y_width = cm->width;
|
||||
dest->y_height = cm->height;
|
||||
dest->uv_height = dest->y_height / 2;
|
||||
|
||||
return 0;
|
||||
|
@@ -26,7 +26,7 @@ struct postproc_state {
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
#include "vp9/common/vp9_ppflags.h"
|
||||
|
||||
int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
int vp9_post_proc_frame(struct VP9Common *cm,
|
||||
YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *flags);
|
||||
|
||||
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
|
||||
|
@@ -34,6 +34,6 @@ static int round(double x) {
|
||||
#endif
|
||||
|
||||
struct VP9Common;
|
||||
void vp9_machine_specific_config(struct VP9Common *);
|
||||
void vp9_machine_specific_config(struct VP9Common *cm);
|
||||
|
||||
#endif // VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
|
||||
|
@@ -255,13 +255,13 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
|
||||
|
||||
static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
|
||||
vp9_reader* r, BLOCK_SIZE bsize) {
|
||||
VP9_COMMON *const pc = &pbi->common;
|
||||
VP9_COMMON *const cm = &pbi->common;
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
|
||||
PARTITION_TYPE partition = PARTITION_NONE;
|
||||
BLOCK_SIZE subsize;
|
||||
|
||||
if (mi_row >= pc->mi_rows || mi_col >= pc->mi_cols)
|
||||
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
||||
return;
|
||||
|
||||
if (bsize < BLOCK_8X8) {
|
||||
@@ -269,21 +269,21 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
|
||||
return;
|
||||
} else {
|
||||
int pl;
|
||||
const int idx = check_bsize_coverage(hbs, pc->mi_rows, pc->mi_cols,
|
||||
const int idx = check_bsize_coverage(hbs, cm->mi_rows, cm->mi_cols,
|
||||
mi_row, mi_col);
|
||||
set_partition_seg_context(pc, xd, mi_row, mi_col);
|
||||
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||
pl = partition_plane_context(xd, bsize);
|
||||
|
||||
if (idx == 0)
|
||||
partition = treed_read(r, vp9_partition_tree,
|
||||
pc->fc.partition_prob[pc->frame_type][pl]);
|
||||
cm->fc.partition_prob[cm->frame_type][pl]);
|
||||
else if (idx > 0 &&
|
||||
!vp9_read(r, pc->fc.partition_prob[pc->frame_type][pl][idx]))
|
||||
!vp9_read(r, cm->fc.partition_prob[cm->frame_type][pl][idx]))
|
||||
partition = (idx == 1) ? PARTITION_HORZ : PARTITION_VERT;
|
||||
else
|
||||
partition = PARTITION_SPLIT;
|
||||
|
||||
pc->counts.partition[pl][partition]++;
|
||||
cm->counts.partition[pl][partition]++;
|
||||
}
|
||||
|
||||
subsize = get_subsize(bsize, partition);
|
||||
@@ -296,13 +296,13 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
|
||||
case PARTITION_HORZ:
|
||||
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
|
||||
*get_sb_index(xd, subsize) = 1;
|
||||
if (mi_row + hbs < pc->mi_rows)
|
||||
if (mi_row + hbs < cm->mi_rows)
|
||||
decode_modes_b(pbi, mi_row + hbs, mi_col, r, subsize);
|
||||
break;
|
||||
case PARTITION_VERT:
|
||||
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
|
||||
*get_sb_index(xd, subsize) = 1;
|
||||
if (mi_col + hbs < pc->mi_cols)
|
||||
if (mi_col + hbs < cm->mi_cols)
|
||||
decode_modes_b(pbi, mi_row, mi_col + hbs, r, subsize);
|
||||
break;
|
||||
case PARTITION_SPLIT: {
|
||||
@@ -320,7 +320,7 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
|
||||
// update partition context
|
||||
if (bsize >= BLOCK_8X8 &&
|
||||
(bsize == BLOCK_8X8 || partition != PARTITION_SPLIT)) {
|
||||
set_partition_seg_context(pc, xd, mi_row, mi_col);
|
||||
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||
update_partition_context(xd, subsize, bsize);
|
||||
}
|
||||
}
|
||||
@@ -328,18 +328,18 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
|
||||
static void setup_token_decoder(VP9D_COMP *pbi,
|
||||
const uint8_t *data, size_t read_size,
|
||||
vp9_reader *r) {
|
||||
VP9_COMMON *pc = &pbi->common;
|
||||
VP9_COMMON *cm = &pbi->common;
|
||||
const uint8_t *data_end = pbi->source + pbi->source_sz;
|
||||
|
||||
// Validate the calculated partition length. If the buffer
|
||||
// described by the partition can't be fully read, then restrict
|
||||
// it to the portion that can be (for EC mode) or throw an error.
|
||||
if (!read_is_valid(data, read_size, data_end))
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Truncated packet or corrupt tile length");
|
||||
|
||||
if (vp9_reader_init(r, data, read_size))
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate bool decoder %d", 1);
|
||||
}
|
||||
|
||||
@@ -571,28 +571,28 @@ static void setup_frame_size_with_refs(VP9D_COMP *pbi,
|
||||
|
||||
static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
|
||||
const int num_threads = pbi->oxcf.max_threads;
|
||||
VP9_COMMON *const pc = &pbi->common;
|
||||
VP9_COMMON *const cm = &pbi->common;
|
||||
int mi_row, mi_col;
|
||||
YV12_BUFFER_CONFIG *const fb = &pc->yv12_fb[pc->new_fb_idx];
|
||||
YV12_BUFFER_CONFIG *const fb = &cm->yv12_fb[cm->new_fb_idx];
|
||||
|
||||
if (pbi->do_loopfilter_inline) {
|
||||
if (num_threads > 1) {
|
||||
LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
|
||||
lf_data->frame_buffer = fb;
|
||||
lf_data->cm = pc;
|
||||
lf_data->cm = cm;
|
||||
lf_data->xd = pbi->mb;
|
||||
lf_data->stop = 0;
|
||||
lf_data->y_only = 0;
|
||||
}
|
||||
vp9_loop_filter_frame_init(pc, pc->lf.filter_level);
|
||||
vp9_loop_filter_frame_init(cm, cm->lf.filter_level);
|
||||
}
|
||||
|
||||
for (mi_row = pc->cur_tile_mi_row_start; mi_row < pc->cur_tile_mi_row_end;
|
||||
for (mi_row = cm->cur_tile_mi_row_start; mi_row < cm->cur_tile_mi_row_end;
|
||||
mi_row += MI_BLOCK_SIZE) {
|
||||
// For a SB there are 2 left contexts, each pertaining to a MB row within
|
||||
vp9_zero(pc->left_context);
|
||||
vp9_zero(pc->left_seg_context);
|
||||
for (mi_col = pc->cur_tile_mi_col_start; mi_col < pc->cur_tile_mi_col_end;
|
||||
vp9_zero(cm->left_context);
|
||||
vp9_zero(cm->left_seg_context);
|
||||
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
|
||||
mi_col += MI_BLOCK_SIZE)
|
||||
decode_modes_sb(pbi, mi_row, mi_col, r, BLOCK_64X64);
|
||||
|
||||
@@ -605,7 +605,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
|
||||
LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
|
||||
|
||||
// decoding has completed: finish up the loop filter in this thread.
|
||||
if (mi_row + MI_BLOCK_SIZE >= pc->cur_tile_mi_row_end) continue;
|
||||
if (mi_row + MI_BLOCK_SIZE >= cm->cur_tile_mi_row_end) continue;
|
||||
|
||||
vp9_worker_sync(&pbi->lf_worker);
|
||||
lf_data->start = lf_start;
|
||||
@@ -613,7 +613,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
|
||||
pbi->lf_worker.hook = vp9_loop_filter_worker;
|
||||
vp9_worker_launch(&pbi->lf_worker);
|
||||
} else {
|
||||
vp9_loop_filter_rows(fb, pc, &pbi->mb, lf_start, mi_row, 0);
|
||||
vp9_loop_filter_rows(fb, cm, &pbi->mb, lf_start, mi_row, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -628,8 +628,8 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
|
||||
} else {
|
||||
lf_start = mi_row - MI_BLOCK_SIZE;
|
||||
}
|
||||
vp9_loop_filter_rows(fb, pc, &pbi->mb,
|
||||
lf_start, pc->mi_rows, 0);
|
||||
vp9_loop_filter_rows(fb, cm, &pbi->mb,
|
||||
lf_start, cm->mi_rows, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,20 +652,20 @@ static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
|
||||
static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) {
|
||||
vp9_reader residual_bc;
|
||||
|
||||
VP9_COMMON *const pc = &pbi->common;
|
||||
VP9_COMMON *const cm = &pbi->common;
|
||||
|
||||
const uint8_t *const data_end = pbi->source + pbi->source_sz;
|
||||
const int aligned_mi_cols = mi_cols_aligned_to_sb(pc->mi_cols);
|
||||
const int tile_cols = 1 << pc->log2_tile_cols;
|
||||
const int tile_rows = 1 << pc->log2_tile_rows;
|
||||
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;
|
||||
int tile_row, tile_col;
|
||||
|
||||
// Note: this memset assumes above_context[0], [1] and [2]
|
||||
// are allocated as part of the same buffer.
|
||||
vpx_memset(pc->above_context[0], 0,
|
||||
vpx_memset(cm->above_context[0], 0,
|
||||
sizeof(ENTROPY_CONTEXT) * MAX_MB_PLANE * (2 * aligned_mi_cols));
|
||||
|
||||
vpx_memset(pc->above_seg_context, 0,
|
||||
vpx_memset(cm->above_seg_context, 0,
|
||||
sizeof(PARTITION_CONTEXT) * aligned_mi_cols);
|
||||
|
||||
if (pbi->oxcf.inv_tile_order) {
|
||||
@@ -690,9 +690,9 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) {
|
||||
}
|
||||
|
||||
for (tile_row = 0; tile_row < tile_rows; tile_row++) {
|
||||
vp9_get_tile_row_offsets(pc, tile_row);
|
||||
vp9_get_tile_row_offsets(cm, tile_row);
|
||||
for (tile_col = tile_cols - 1; tile_col >= 0; tile_col--) {
|
||||
vp9_get_tile_col_offsets(pc, tile_col);
|
||||
vp9_get_tile_col_offsets(cm, tile_col);
|
||||
setup_token_decoder(pbi, data_ptr2[tile_row][tile_col],
|
||||
data_end - data_ptr2[tile_row][tile_col],
|
||||
&residual_bc);
|
||||
@@ -706,16 +706,16 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) {
|
||||
int has_more;
|
||||
|
||||
for (tile_row = 0; tile_row < tile_rows; tile_row++) {
|
||||
vp9_get_tile_row_offsets(pc, tile_row);
|
||||
vp9_get_tile_row_offsets(cm, tile_row);
|
||||
for (tile_col = 0; tile_col < tile_cols; tile_col++) {
|
||||
size_t size;
|
||||
|
||||
vp9_get_tile_col_offsets(pc, tile_col);
|
||||
vp9_get_tile_col_offsets(cm, tile_col);
|
||||
|
||||
has_more = tile_col < tile_cols - 1 || tile_row < tile_rows - 1;
|
||||
if (has_more) {
|
||||
if (!read_is_valid(data, 4, data_end))
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Truncated packet or corrupt tile length");
|
||||
|
||||
size = read_be32(data);
|
||||
@@ -928,17 +928,17 @@ void vp9_init_dequantizer(VP9_COMMON *cm) {
|
||||
|
||||
int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
|
||||
int i;
|
||||
VP9_COMMON *const pc = &pbi->common;
|
||||
VP9_COMMON *const cm = &pbi->common;
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
|
||||
const uint8_t *data = pbi->source;
|
||||
const uint8_t *data_end = pbi->source + pbi->source_sz;
|
||||
|
||||
struct vp9_read_bit_buffer rb = { data, data_end, 0,
|
||||
pc, error_handler };
|
||||
cm, error_handler };
|
||||
const size_t first_partition_size = read_uncompressed_header(pbi, &rb);
|
||||
const int keyframe = pc->frame_type == KEY_FRAME;
|
||||
YV12_BUFFER_CONFIG *new_fb = &pc->yv12_fb[pc->new_fb_idx];
|
||||
const int keyframe = cm->frame_type == KEY_FRAME;
|
||||
YV12_BUFFER_CONFIG *new_fb = &cm->yv12_fb[cm->new_fb_idx];
|
||||
|
||||
if (!first_partition_size) {
|
||||
// showing a frame directly
|
||||
@@ -949,39 +949,39 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
|
||||
xd->corrupted = 0;
|
||||
new_fb->corrupted = 0;
|
||||
pbi->do_loopfilter_inline =
|
||||
(pc->log2_tile_rows | pc->log2_tile_cols) == 0 && pc->lf.filter_level;
|
||||
(cm->log2_tile_rows | cm->log2_tile_cols) == 0 && cm->lf.filter_level;
|
||||
|
||||
if (!pbi->decoded_key_frame && !keyframe)
|
||||
return -1;
|
||||
|
||||
if (!read_is_valid(data, first_partition_size, data_end))
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Truncated packet or corrupt header length");
|
||||
|
||||
xd->mode_info_context = pc->mi;
|
||||
xd->prev_mode_info_context = pc->prev_mi;
|
||||
xd->mode_info_stride = pc->mode_info_stride;
|
||||
xd->mode_info_context = cm->mi;
|
||||
xd->prev_mode_info_context = cm->prev_mi;
|
||||
xd->mode_info_stride = cm->mode_info_stride;
|
||||
|
||||
init_dequantizer(pc, &pbi->mb);
|
||||
init_dequantizer(cm, &pbi->mb);
|
||||
|
||||
pc->fc = pc->frame_contexts[pc->frame_context_idx];
|
||||
cm->fc = cm->frame_contexts[cm->frame_context_idx];
|
||||
|
||||
vp9_zero(pc->counts);
|
||||
vp9_zero(cm->counts);
|
||||
|
||||
new_fb->corrupted |= read_compressed_header(pbi, data, first_partition_size);
|
||||
|
||||
setup_block_dptrs(xd, pc->subsampling_x, pc->subsampling_y);
|
||||
setup_block_dptrs(xd, cm->subsampling_x, cm->subsampling_y);
|
||||
|
||||
// clear out the coeff buffer
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i)
|
||||
vp9_zero(xd->plane[i].qcoeff);
|
||||
|
||||
set_prev_mi(pc);
|
||||
set_prev_mi(cm);
|
||||
|
||||
*p_data_end = decode_tiles(pbi, data + first_partition_size);
|
||||
|
||||
pc->last_width = pc->width;
|
||||
pc->last_height = pc->height;
|
||||
cm->last_width = cm->width;
|
||||
cm->last_height = cm->height;
|
||||
|
||||
new_fb->corrupted |= xd->corrupted;
|
||||
|
||||
@@ -989,21 +989,21 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
|
||||
if (keyframe && !new_fb->corrupted)
|
||||
pbi->decoded_key_frame = 1;
|
||||
else
|
||||
vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"A stream must start with a complete key frame");
|
||||
}
|
||||
|
||||
if (!pc->error_resilient_mode && !pc->frame_parallel_decoding_mode) {
|
||||
vp9_adapt_coef_probs(pc);
|
||||
if (!cm->error_resilient_mode && !cm->frame_parallel_decoding_mode) {
|
||||
vp9_adapt_coef_probs(cm);
|
||||
|
||||
if (!keyframe && !pc->intra_only) {
|
||||
vp9_adapt_mode_probs(pc);
|
||||
vp9_adapt_mv_probs(pc, xd->allow_high_precision_mv);
|
||||
if (!keyframe && !cm->intra_only) {
|
||||
vp9_adapt_mode_probs(cm);
|
||||
vp9_adapt_mv_probs(cm, xd->allow_high_precision_mv);
|
||||
}
|
||||
}
|
||||
|
||||
if (pc->refresh_frame_context)
|
||||
pc->frame_contexts[pc->frame_context_idx] = pc->fc;
|
||||
if (cm->refresh_frame_context)
|
||||
cm->frame_contexts[cm->frame_context_idx] = cm->fc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
struct VP9Common;
|
||||
struct VP9Decompressor;
|
||||
|
||||
void vp9_init_dequantizer(struct VP9Common *pc);
|
||||
void vp9_init_dequantizer(struct VP9Common *cm);
|
||||
int vp9_decode_frame(struct VP9Decompressor *cpi, const uint8_t **p_data_end);
|
||||
|
||||
#endif // VP9_DECODER_VP9_DECODFRAME_H_
|
||||
|
@@ -237,7 +237,7 @@ static void write_intra_mode(vp9_writer *bc, int m, const vp9_prob *p) {
|
||||
|
||||
static void update_switchable_interp_probs(VP9_COMP *const cpi,
|
||||
vp9_writer* const bc) {
|
||||
VP9_COMMON *const pc = &cpi->common;
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
unsigned int branch_ct[SWITCHABLE_FILTERS + 1]
|
||||
[SWITCHABLE_FILTERS - 1][2];
|
||||
vp9_prob new_prob[SWITCHABLE_FILTERS + 1][SWITCHABLE_FILTERS - 1];
|
||||
@@ -246,21 +246,21 @@ static void update_switchable_interp_probs(VP9_COMP *const cpi,
|
||||
vp9_tree_probs_from_distribution(
|
||||
vp9_switchable_interp_tree,
|
||||
new_prob[j], branch_ct[j],
|
||||
pc->counts.switchable_interp[j], 0);
|
||||
cm->counts.switchable_interp[j], 0);
|
||||
}
|
||||
for (j = 0; j <= SWITCHABLE_FILTERS; ++j) {
|
||||
for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i) {
|
||||
vp9_cond_prob_diff_update(bc, &pc->fc.switchable_interp_prob[j][i],
|
||||
vp9_cond_prob_diff_update(bc, &cm->fc.switchable_interp_prob[j][i],
|
||||
MODE_UPDATE_PROB, branch_ct[j][i]);
|
||||
}
|
||||
}
|
||||
#ifdef MODE_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
update_switchable_interp_stats(pc);
|
||||
update_switchable_interp_stats(cm);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void update_inter_mode_probs(VP9_COMMON *pc, vp9_writer* const bc) {
|
||||
static void update_inter_mode_probs(VP9_COMMON *cm, vp9_writer* const bc) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
|
||||
@@ -269,10 +269,10 @@ static void update_inter_mode_probs(VP9_COMMON *pc, vp9_writer* const bc) {
|
||||
|
||||
vp9_tree_probs_from_distribution(vp9_inter_mode_tree,
|
||||
new_prob, branch_ct,
|
||||
pc->counts.inter_mode[i], NEARESTMV);
|
||||
cm->counts.inter_mode[i], NEARESTMV);
|
||||
|
||||
for (j = 0; j < INTER_MODES - 1; ++j)
|
||||
vp9_cond_prob_diff_update(bc, &pc->fc.inter_mode_probs[i][j],
|
||||
vp9_cond_prob_diff_update(bc, &cm->fc.inter_mode_probs[i][j],
|
||||
MODE_UPDATE_PROB, branch_ct[j]);
|
||||
}
|
||||
}
|
||||
@@ -356,39 +356,39 @@ static void write_segment_id(vp9_writer *w, const struct segmentation *seg,
|
||||
|
||||
// This function encodes the reference frame
|
||||
static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
|
||||
VP9_COMMON *const pc = &cpi->common;
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
MACROBLOCK *const x = &cpi->mb;
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
MB_MODE_INFO *mi = &xd->mode_info_context->mbmi;
|
||||
const int segment_id = mi->segment_id;
|
||||
int seg_ref_active = vp9_segfeature_active(&pc->seg, segment_id,
|
||||
int seg_ref_active = vp9_segfeature_active(&cm->seg, segment_id,
|
||||
SEG_LVL_REF_FRAME);
|
||||
// If segment level coding of this signal is disabled...
|
||||
// or the segment allows multiple reference frame options
|
||||
if (!seg_ref_active) {
|
||||
// does the feature use compound prediction or not
|
||||
// (if not specified at the frame/segment level)
|
||||
if (pc->comp_pred_mode == HYBRID_PREDICTION) {
|
||||
if (cm->comp_pred_mode == HYBRID_PREDICTION) {
|
||||
vp9_write(bc, mi->ref_frame[1] > INTRA_FRAME,
|
||||
vp9_get_pred_prob_comp_inter_inter(pc, xd));
|
||||
vp9_get_pred_prob_comp_inter_inter(cm, xd));
|
||||
} else {
|
||||
assert((mi->ref_frame[1] <= INTRA_FRAME) ==
|
||||
(pc->comp_pred_mode == SINGLE_PREDICTION_ONLY));
|
||||
(cm->comp_pred_mode == SINGLE_PREDICTION_ONLY));
|
||||
}
|
||||
|
||||
if (mi->ref_frame[1] > INTRA_FRAME) {
|
||||
vp9_write(bc, mi->ref_frame[0] == GOLDEN_FRAME,
|
||||
vp9_get_pred_prob_comp_ref_p(pc, xd));
|
||||
vp9_get_pred_prob_comp_ref_p(cm, xd));
|
||||
} else {
|
||||
vp9_write(bc, mi->ref_frame[0] != LAST_FRAME,
|
||||
vp9_get_pred_prob_single_ref_p1(pc, xd));
|
||||
vp9_get_pred_prob_single_ref_p1(cm, xd));
|
||||
if (mi->ref_frame[0] != LAST_FRAME)
|
||||
vp9_write(bc, mi->ref_frame[0] != GOLDEN_FRAME,
|
||||
vp9_get_pred_prob_single_ref_p2(pc, xd));
|
||||
vp9_get_pred_prob_single_ref_p2(cm, xd));
|
||||
}
|
||||
} else {
|
||||
assert(mi->ref_frame[1] <= INTRA_FRAME);
|
||||
assert(vp9_get_segdata(&pc->seg, segment_id, SEG_LVL_REF_FRAME) ==
|
||||
assert(vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) ==
|
||||
mi->ref_frame[0]);
|
||||
}
|
||||
|
||||
@@ -397,11 +397,11 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
|
||||
}
|
||||
|
||||
static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
VP9_COMMON *const pc = &cpi->common;
|
||||
const nmv_context *nmvc = &pc->fc.nmvc;
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
const nmv_context *nmvc = &cm->fc.nmvc;
|
||||
MACROBLOCK *const x = &cpi->mb;
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
struct segmentation *seg = &pc->seg;
|
||||
struct segmentation *seg = &cm->seg;
|
||||
MB_MODE_INFO *const mi = &m->mbmi;
|
||||
const MV_REFERENCE_FRAME rf = mi->ref_frame[0];
|
||||
const MB_PREDICTION_MODE mode = mi->mode;
|
||||
@@ -410,7 +410,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
const BLOCK_SIZE bsize = mi->sb_type;
|
||||
const int allow_hp = xd->allow_high_precision_mv;
|
||||
|
||||
x->partition_info = x->pi + (m - pc->mi);
|
||||
x->partition_info = x->pi + (m - cm->mi);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
active_section = 9;
|
||||
@@ -432,9 +432,9 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
|
||||
if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
|
||||
vp9_write(bc, rf != INTRA_FRAME,
|
||||
vp9_get_pred_prob_intra_inter(pc, xd));
|
||||
vp9_get_pred_prob_intra_inter(cm, xd));
|
||||
|
||||
if (bsize >= BLOCK_8X8 && pc->tx_mode == TX_MODE_SELECT &&
|
||||
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
|
||||
!(rf != INTRA_FRAME &&
|
||||
(skip_coeff || vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)))) {
|
||||
write_selected_tx_size(cpi, mi->tx_size, bsize, bc);
|
||||
@@ -446,7 +446,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
#endif
|
||||
|
||||
if (bsize >= BLOCK_8X8) {
|
||||
write_intra_mode(bc, mode, pc->fc.y_mode_prob[size_group_lookup[bsize]]);
|
||||
write_intra_mode(bc, mode, cm->fc.y_mode_prob[size_group_lookup[bsize]]);
|
||||
} else {
|
||||
int idx, idy;
|
||||
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
@@ -454,11 +454,11 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
const MB_PREDICTION_MODE bm = m->bmi[idy * 2 + idx].as_mode;
|
||||
write_intra_mode(bc, bm, pc->fc.y_mode_prob[0]);
|
||||
write_intra_mode(bc, bm, cm->fc.y_mode_prob[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
write_intra_mode(bc, mi->uv_mode, pc->fc.uv_mode_prob[mode]);
|
||||
write_intra_mode(bc, mi->uv_mode, cm->fc.uv_mode_prob[mode]);
|
||||
} else {
|
||||
vp9_prob *mv_ref_p;
|
||||
encode_ref_frame(cpi, bc);
|
||||
@@ -472,18 +472,18 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)) {
|
||||
if (bsize >= BLOCK_8X8) {
|
||||
write_sb_mv_ref(bc, mode, mv_ref_p);
|
||||
++pc->counts.inter_mode[mi->mode_context[rf]]
|
||||
++cm->counts.inter_mode[mi->mode_context[rf]]
|
||||
[inter_mode_offset(mode)];
|
||||
}
|
||||
}
|
||||
|
||||
if (pc->mcomp_filter_type == SWITCHABLE) {
|
||||
if (cm->mcomp_filter_type == SWITCHABLE) {
|
||||
const int ctx = vp9_get_pred_context_switchable_interp(xd);
|
||||
write_token(bc, vp9_switchable_interp_tree,
|
||||
pc->fc.switchable_interp_prob[ctx],
|
||||
cm->fc.switchable_interp_prob[ctx],
|
||||
&vp9_switchable_interp_encodings[mi->interp_filter]);
|
||||
} else {
|
||||
assert(mi->interp_filter == pc->mcomp_filter_type);
|
||||
assert(mi->interp_filter == cm->mcomp_filter_type);
|
||||
}
|
||||
|
||||
if (bsize < BLOCK_8X8) {
|
||||
@@ -499,7 +499,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
blockmode = x->partition_info->bmi[j].mode;
|
||||
blockmv = m->bmi[j].as_mv[0];
|
||||
write_sb_mv_ref(bc, blockmode, mv_ref_p);
|
||||
++pc->counts.inter_mode[mi->mode_context[rf]]
|
||||
++cm->counts.inter_mode[mi->mode_context[rf]]
|
||||
[inter_mode_offset(blockmode)];
|
||||
|
||||
if (blockmode == NEWMV) {
|
||||
@@ -533,11 +533,11 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
|
||||
|
||||
static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO *m,
|
||||
vp9_writer *bc) {
|
||||
const VP9_COMMON *const c = &cpi->common;
|
||||
const VP9_COMMON *const cm = &cpi->common;
|
||||
const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
|
||||
const struct segmentation *const seg = &c->seg;
|
||||
const struct segmentation *const seg = &cm->seg;
|
||||
const int ym = m->mbmi.mode;
|
||||
const int mis = c->mode_info_stride;
|
||||
const int mis = cm->mode_info_stride;
|
||||
const int segment_id = m->mbmi.segment_id;
|
||||
|
||||
if (seg->update_map)
|
||||
@@ -545,7 +545,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO *m,
|
||||
|
||||
write_skip_coeff(cpi, segment_id, m, bc);
|
||||
|
||||
if (m->mbmi.sb_type >= BLOCK_8X8 && c->tx_mode == TX_MODE_SELECT)
|
||||
if (m->mbmi.sb_type >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
|
||||
write_selected_tx_size(cpi, m->mbmi.tx_size, m->mbmi.sb_type, bc);
|
||||
|
||||
if (m->mbmi.sb_type >= BLOCK_8X8) {
|
||||
@@ -684,18 +684,18 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
|
||||
|
||||
static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
|
||||
TOKENEXTRA **tok, TOKENEXTRA *tok_end) {
|
||||
VP9_COMMON *const c = &cpi->common;
|
||||
const int mis = c->mode_info_stride;
|
||||
MODE_INFO *m, *m_ptr = c->mi;
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
const int mis = cm->mode_info_stride;
|
||||
MODE_INFO *m, *m_ptr = cm->mi;
|
||||
int mi_row, mi_col;
|
||||
|
||||
m_ptr += c->cur_tile_mi_col_start + c->cur_tile_mi_row_start * mis;
|
||||
m_ptr += cm->cur_tile_mi_col_start + cm->cur_tile_mi_row_start * mis;
|
||||
|
||||
for (mi_row = c->cur_tile_mi_row_start; mi_row < c->cur_tile_mi_row_end;
|
||||
for (mi_row = cm->cur_tile_mi_row_start; mi_row < cm->cur_tile_mi_row_end;
|
||||
mi_row += 8, m_ptr += 8 * mis) {
|
||||
m = m_ptr;
|
||||
vp9_zero(c->left_seg_context);
|
||||
for (mi_col = c->cur_tile_mi_col_start; mi_col < c->cur_tile_mi_col_end;
|
||||
vp9_zero(cm->left_seg_context);
|
||||
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
|
||||
mi_col += MI_BLOCK_SIZE, m += MI_BLOCK_SIZE)
|
||||
write_modes_sb(cpi, m, bc, tok, tok_end, mi_row, mi_col, BLOCK_64X64);
|
||||
}
|
||||
@@ -1458,7 +1458,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
|
||||
vp9_compute_update_table();
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
if (pc->frame_type == INTER_FRAME)
|
||||
if (cm->frame_type == INTER_FRAME)
|
||||
active_section = 0;
|
||||
else
|
||||
active_section = 7;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
void vp9_init_mode_costs(VP9_COMP *c) {
|
||||
VP9_COMMON *x = &c->common;
|
||||
VP9_COMMON *const cm = &c->common;
|
||||
const vp9_tree_p KT = vp9_intra_mode_tree;
|
||||
int i, j;
|
||||
|
||||
@@ -28,16 +28,16 @@ void vp9_init_mode_costs(VP9_COMP *c) {
|
||||
}
|
||||
|
||||
// TODO(rbultje) separate tables for superblock costing?
|
||||
vp9_cost_tokens(c->mb.mbmode_cost, x->fc.y_mode_prob[1],
|
||||
vp9_cost_tokens(c->mb.mbmode_cost, cm->fc.y_mode_prob[1],
|
||||
vp9_intra_mode_tree);
|
||||
vp9_cost_tokens(c->mb.intra_uv_mode_cost[1],
|
||||
x->fc.uv_mode_prob[INTRA_MODES - 1], vp9_intra_mode_tree);
|
||||
cm->fc.uv_mode_prob[INTRA_MODES - 1], vp9_intra_mode_tree);
|
||||
vp9_cost_tokens(c->mb.intra_uv_mode_cost[0],
|
||||
vp9_kf_uv_mode_prob[INTRA_MODES - 1],
|
||||
vp9_intra_mode_tree);
|
||||
|
||||
for (i = 0; i <= SWITCHABLE_FILTERS; ++i)
|
||||
vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i],
|
||||
x->fc.switchable_interp_prob[i],
|
||||
cm->fc.switchable_interp_prob[i],
|
||||
vp9_switchable_interp_tree);
|
||||
}
|
||||
|
Reference in New Issue
Block a user