diff options
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_entropy.c | 155 | ||||
-rw-r--r-- | vp9/common/vp9_entropy.h | 2 | ||||
-rw-r--r-- | vp9/common/vp9_entropymv.h | 11 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodeframe.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_bitstream.c | 50 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemv.c | 14 | ||||
-rw-r--r-- | vp9/encoder/vp9_onyx_if.c | 74 | ||||
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 13 |
9 files changed, 31 insertions, 294 deletions
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c index 5ebe172f1..0f978cc95 100644 --- a/vp9/common/vp9_entropy.c +++ b/vp9/common/vp9_entropy.c @@ -172,143 +172,11 @@ const vp9_tree_index vp9_coefmodel_tree[6] = { // beta = 8 - -static const vp9_prob pareto8_probs[COEFPROB_MODELS][MODEL_NODES] = { - { 3, 86, 128, 6, 86, 23, 88, 29}, - { 9, 86, 129, 17, 88, 61, 94, 76}, - { 15, 87, 129, 28, 89, 93, 100, 110}, - { 20, 88, 130, 38, 91, 118, 106, 136}, - { 26, 89, 131, 48, 92, 139, 111, 156}, - { 31, 90, 131, 58, 94, 156, 117, 171}, - { 37, 90, 132, 66, 95, 171, 122, 184}, - { 42, 91, 132, 75, 97, 183, 127, 194}, - { 47, 92, 133, 83, 98, 193, 132, 202}, - { 52, 93, 133, 90, 100, 201, 137, 208}, - { 57, 94, 134, 98, 101, 208, 142, 214}, - { 62, 94, 135, 105, 103, 214, 146, 218}, - { 66, 95, 135, 111, 104, 219, 151, 222}, - { 71, 96, 136, 117, 106, 224, 155, 225}, - { 76, 97, 136, 123, 107, 227, 159, 228}, - { 80, 98, 137, 129, 109, 231, 162, 231}, - { 84, 98, 138, 134, 110, 234, 166, 233}, - { 89, 99, 138, 140, 112, 236, 170, 235}, - { 93, 100, 139, 145, 113, 238, 173, 236}, - { 97, 101, 140, 149, 115, 240, 176, 238}, - {101, 102, 140, 154, 116, 242, 179, 239}, - {105, 103, 141, 158, 118, 243, 182, 240}, - {109, 104, 141, 162, 119, 244, 185, 241}, - {113, 104, 142, 166, 120, 245, 187, 242}, - {116, 105, 143, 170, 122, 246, 190, 243}, - {120, 106, 143, 173, 123, 247, 192, 244}, - {123, 107, 144, 177, 125, 248, 195, 244}, - {127, 108, 145, 180, 126, 249, 197, 245}, - {130, 109, 145, 183, 128, 249, 199, 245}, - {134, 110, 146, 186, 129, 250, 201, 246}, - {137, 111, 147, 189, 131, 251, 203, 246}, - {140, 112, 147, 192, 132, 251, 205, 247}, - {143, 113, 148, 194, 133, 251, 207, 247}, - {146, 114, 149, 197, 135, 252, 208, 248}, - {149, 115, 149, 199, 136, 252, 210, 248}, - {152, 115, 150, 201, 138, 252, 211, 248}, - {155, 116, 151, 204, 139, 253, 213, 249}, - {158, 117, 151, 206, 140, 253, 214, 249}, - {161, 118, 152, 208, 142, 253, 216, 249}, - {163, 119, 153, 210, 143, 253, 217, 249}, - {166, 120, 153, 212, 144, 254, 218, 250}, - {168, 121, 154, 213, 146, 254, 220, 250}, - {171, 122, 155, 215, 147, 254, 221, 250}, - {173, 123, 155, 217, 148, 254, 222, 250}, - {176, 124, 156, 218, 150, 254, 223, 250}, - {178, 125, 157, 220, 151, 254, 224, 251}, - {180, 126, 157, 221, 152, 254, 225, 251}, - {183, 127, 158, 222, 153, 254, 226, 251}, - {185, 128, 159, 224, 155, 255, 227, 251}, - {187, 129, 160, 225, 156, 255, 228, 251}, - {189, 131, 160, 226, 157, 255, 228, 251}, - {191, 132, 161, 227, 159, 255, 229, 251}, - {193, 133, 162, 228, 160, 255, 230, 252}, - {195, 134, 163, 230, 161, 255, 231, 252}, - {197, 135, 163, 231, 162, 255, 231, 252}, - {199, 136, 164, 232, 163, 255, 232, 252}, - {201, 137, 165, 233, 165, 255, 233, 252}, - {202, 138, 166, 233, 166, 255, 233, 252}, - {204, 139, 166, 234, 167, 255, 234, 252}, - {206, 140, 167, 235, 168, 255, 235, 252}, - {207, 141, 168, 236, 169, 255, 235, 252}, - {209, 142, 169, 237, 171, 255, 236, 252}, - {210, 144, 169, 237, 172, 255, 236, 252}, - {212, 145, 170, 238, 173, 255, 237, 252}, - {214, 146, 171, 239, 174, 255, 237, 253}, - {215, 147, 172, 240, 175, 255, 238, 253}, - {216, 148, 173, 240, 176, 255, 238, 253}, - {218, 149, 173, 241, 177, 255, 239, 253}, - {219, 150, 174, 241, 179, 255, 239, 253}, - {220, 152, 175, 242, 180, 255, 240, 253}, - {222, 153, 176, 242, 181, 255, 240, 253}, - {223, 154, 177, 243, 182, 255, 240, 253}, - {224, 155, 178, 244, 183, 255, 241, 253}, - {225, 156, 178, 244, 184, 255, 241, 253}, - {226, 158, 179, 244, 185, 255, 242, 253}, - {228, 159, 180, 245, 186, 255, 242, 253}, - {229, 160, 181, 245, 187, 255, 242, 253}, - {230, 161, 182, 246, 188, 255, 243, 253}, - {231, 163, 183, 246, 189, 255, 243, 253}, - {232, 164, 184, 247, 190, 255, 243, 253}, - {233, 165, 185, 247, 191, 255, 244, 253}, - {234, 166, 185, 247, 192, 255, 244, 253}, - {235, 168, 186, 248, 193, 255, 244, 253}, - {236, 169, 187, 248, 194, 255, 244, 253}, - {236, 170, 188, 248, 195, 255, 245, 253}, - {237, 171, 189, 249, 196, 255, 245, 254}, - {238, 173, 190, 249, 197, 255, 245, 254}, - {239, 174, 191, 249, 198, 255, 245, 254}, - {240, 175, 192, 249, 199, 255, 246, 254}, - {240, 177, 193, 250, 200, 255, 246, 254}, - {241, 178, 194, 250, 201, 255, 246, 254}, - {242, 179, 195, 250, 202, 255, 246, 254}, - {242, 181, 196, 250, 203, 255, 247, 254}, - {243, 182, 197, 251, 204, 255, 247, 254}, - {244, 184, 198, 251, 205, 255, 247, 254}, - {244, 185, 199, 251, 206, 255, 247, 254}, - {245, 186, 200, 251, 207, 255, 247, 254}, - {246, 188, 201, 252, 207, 255, 248, 254}, - {246, 189, 202, 252, 208, 255, 248, 254}, - {247, 191, 203, 252, 209, 255, 248, 254}, - {247, 192, 204, 252, 210, 255, 248, 254}, - {248, 194, 205, 252, 211, 255, 248, 254}, - {248, 195, 206, 252, 212, 255, 249, 254}, - {249, 197, 207, 253, 213, 255, 249, 254}, - {249, 198, 208, 253, 214, 255, 249, 254}, - {250, 200, 210, 253, 215, 255, 249, 254}, - {250, 201, 211, 253, 215, 255, 249, 254}, - {250, 203, 212, 253, 216, 255, 249, 254}, - {251, 204, 213, 253, 217, 255, 250, 254}, - {251, 206, 214, 254, 218, 255, 250, 254}, - {252, 207, 216, 254, 219, 255, 250, 254}, - {252, 209, 217, 254, 220, 255, 250, 254}, - {252, 211, 218, 254, 221, 255, 250, 254}, - {253, 213, 219, 254, 222, 255, 250, 254}, - {253, 214, 221, 254, 223, 255, 250, 254}, - {253, 216, 222, 254, 224, 255, 251, 254}, - {253, 218, 224, 254, 225, 255, 251, 254}, - {254, 220, 225, 254, 225, 255, 251, 254}, - {254, 222, 227, 255, 226, 255, 251, 254}, - {254, 224, 228, 255, 227, 255, 251, 254}, - {254, 226, 230, 255, 228, 255, 251, 254}, - {255, 228, 231, 255, 230, 255, 251, 254}, - {255, 230, 233, 255, 231, 255, 252, 254}, - {255, 232, 235, 255, 232, 255, 252, 254}, - {255, 235, 237, 255, 233, 255, 252, 254}, - {255, 238, 240, 255, 235, 255, 252, 255}, - {255, 241, 243, 255, 236, 255, 252, 254}, - {255, 246, 247, 255, 239, 255, 253, 255} -}; - -// This table is an expansion of the table : modelcoefprobs_pareto8 -// to all 255 probabilities using the code as follows to do the expansion: -// tree_probs[i] = (model[l][i - UNCONSTRAINED_NODES] + -// model[l + 1][i - UNCONSTRAINED_NODES]) >> 1; -const vp9_prob vp9_pareto8_full[255][MODEL_NODES] = { +// Every odd line in this table can be generated from the even lines +// by averaging : +// vp9_pareto8_full[l][node] = ( vp9_pareto8_full[l-1][node] + +// vp9_pareto8_full[l+1][node] ) >> 1; +const vp9_prob vp9_pareto8_full[256][MODEL_NODES] = { { 3, 86, 128, 6, 86, 23, 88, 29}, { 6, 86, 128, 11, 87, 42, 91, 52}, { 9, 86, 129, 17, 88, 61, 94, 76}, @@ -564,19 +432,12 @@ const vp9_prob vp9_pareto8_full[255][MODEL_NODES] = { {255, 241, 243, 255, 236, 255, 252, 254}, {255, 243, 245, 255, 237, 255, 252, 254}, {255, 246, 247, 255, 239, 255, 253, 255}, + {255, 246, 247, 255, 239, 255, 253, 255}, }; static void extend_to_full_distribution(vp9_prob *probs, vp9_prob p) { - const int l = (p - 1) / 2; - if (p & 1) { - // Just copy - vpx_memcpy(probs, pareto8_probs[l], MODEL_NODES * sizeof(vp9_prob)); - } else { - // Interpolate - int i; - for (i = 0; i < MODEL_NODES; ++i) - probs[i] = (pareto8_probs[l][i] + pareto8_probs[l + 1][i]) >> 1; - } + vpx_memcpy(probs, vp9_pareto8_full[p = 0 ? 0 : p - 1], + MODEL_NODES * sizeof(vp9_prob)); } void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full) { diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h index d617caa56..b98bef0c6 100644 --- a/vp9/common/vp9_entropy.h +++ b/vp9/common/vp9_entropy.h @@ -145,7 +145,7 @@ static const uint8_t *get_band_translate(TX_SIZE tx_size) { #define PIVOT_NODE 2 // which node is pivot #define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES) -extern const vp9_prob vp9_pareto8_full[255][MODEL_NODES]; +extern const vp9_prob vp9_pareto8_full[256][MODEL_NODES]; typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS] [PREV_COEF_CONTEXTS] diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h index d843f5bfe..b62f7c42f 100644 --- a/vp9/common/vp9_entropymv.h +++ b/vp9/common/vp9_entropymv.h @@ -62,6 +62,7 @@ typedef enum { #define CLASS0_BITS 1 /* bits at integer precision for class 0 */ #define CLASS0_SIZE (1 << CLASS0_BITS) #define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2) +#define MV_FP_SIZE 4 #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) #define MV_MAX ((1 << MV_MAX_BITS) - 1) @@ -80,7 +81,7 @@ extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES]; extern const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)]; extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE]; -extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(4)]; +extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)]; extern struct vp9_token vp9_mv_fp_encodings[4]; typedef struct { @@ -88,8 +89,8 @@ typedef struct { vp9_prob classes[MV_CLASSES - 1]; vp9_prob class0[CLASS0_SIZE - 1]; vp9_prob bits[MV_OFFSET_BITS]; - vp9_prob class0_fp[CLASS0_SIZE][4 - 1]; - vp9_prob fp[4 - 1]; + vp9_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1]; + vp9_prob fp[MV_FP_SIZE - 1]; vp9_prob class0_hp; vp9_prob hp; } nmv_component; @@ -116,8 +117,8 @@ typedef struct { unsigned int classes[MV_CLASSES]; unsigned int class0[CLASS0_SIZE]; unsigned int bits[MV_OFFSET_BITS][2]; - unsigned int class0_fp[CLASS0_SIZE][4]; - unsigned int fp[4]; + unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE]; + unsigned int fp[MV_FP_SIZE]; unsigned int class0_hp[2]; unsigned int hp[2]; } nmv_component_counts; diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index dbcae7614..b64d98c37 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -159,7 +159,7 @@ static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) { int i; for (i = 0; i < n; ++i) if (vp9_read(r, NMV_UPDATE_PROB)) - p[i] = (vp9_read_literal(r, 7) << 1) | 1; + p[i] = (vp9_read_literal(r, 7) << 1) | 1; } static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) { @@ -178,7 +178,7 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) { for (i = 0; i < 2; ++i) { nmv_component *const comp_ctx = &ctx->comps[i]; for (j = 0; j < CLASS0_SIZE; ++j) - update_mv_probs(comp_ctx->class0_fp[j], 3, r); + update_mv_probs(comp_ctx->class0_fp[j], MV_FP_SIZE - 1, r); update_mv_probs(comp_ctx->fp, 3, r); } diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index baab77592..3a74bf1c3 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -1474,53 +1474,3 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) { *size = data - dest; } -#ifdef ENTROPY_STATS -static void print_tree_update_for_type(FILE *f, - vp9_coeff_stats *tree_update_hist, - int block_types, const char *header) { - int i, j, k, l, m; - - fprintf(f, "const vp9_coeff_prob %s = {\n", header); - for (i = 0; i < block_types; i++) { - fprintf(f, " { \n"); - for (j = 0; j < REF_TYPES; j++) { - fprintf(f, " { \n"); - for (k = 0; k < COEF_BANDS; k++) { - fprintf(f, " {\n"); - for (l = 0; l < PREV_COEF_CONTEXTS; l++) { - fprintf(f, " {"); - for (m = 0; m < ENTROPY_NODES; m++) { - fprintf(f, "%3d, ", - get_binary_prob(tree_update_hist[i][j][k][l][m][0], - tree_update_hist[i][j][k][l][m][1])); - } - fprintf(f, "},\n"); - } - fprintf(f, "},\n"); - } - fprintf(f, " },\n"); - } - fprintf(f, " },\n"); - } - fprintf(f, "};\n"); -} - -void print_tree_update_probs() { - FILE *f = fopen("coefupdprob.h", "w"); - fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n"); - - print_tree_update_for_type(f, tree_update_hist[TX_4X4], BLOCK_TYPES, - "vp9_coef_update_probs_4x4[BLOCK_TYPES]"); - print_tree_update_for_type(f, tree_update_hist[TX_8X8], BLOCK_TYPES, - "vp9_coef_update_probs_8x8[BLOCK_TYPES]"); - print_tree_update_for_type(f, tree_update_hist[TX_16X16], BLOCK_TYPES, - "vp9_coef_update_probs_16x16[BLOCK_TYPES]"); - print_tree_update_for_type(f, tree_update_hist[TX_32X32], BLOCK_TYPES, - "vp9_coef_update_probs_32x32[BLOCK_TYPES]"); - - fclose(f); - f = fopen("treeupdate.bin", "wb"); - fwrite(tree_update_hist, sizeof(tree_update_hist), 1, f); - fclose(f); -} -#endif diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 0e1523b84..4656a79bb 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -167,7 +167,7 @@ static void optimize_b(MACROBLOCK *mb, /* Now set up a Viterbi trellis to evaluate alternative roundings. */ rdmult = mb->rdmult * err_mult; - if (mb->e_mbd.mi_8x8[0]->mbmi.ref_frame[0] == INTRA_FRAME) + if (!is_inter_block(&mb->e_mbd.mi_8x8[0]->mbmi)) rdmult = (rdmult * 9) >> 4; rddiv = mb->rddiv; /* Initialize the sentinel node of the trellis. */ diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index 7e838c901..7dee808a1 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -68,7 +68,7 @@ static void build_nmv_component_cost_table(int *mvcost, int i, v; int sign_cost[2], class_cost[MV_CLASSES], class0_cost[CLASS0_SIZE]; int bits_cost[MV_OFFSET_BITS][2]; - int class0_fp_cost[CLASS0_SIZE][4], fp_cost[4]; + int class0_fp_cost[CLASS0_SIZE][MV_FP_SIZE], fp_cost[MV_FP_SIZE]; int class0_hp_cost[2], hp_cost[2]; sign_cost[0] = vp9_cost_zero(mvcomp->sign); @@ -145,8 +145,8 @@ static void counts_to_nmv_context( unsigned int (*branch_ct_classes)[MV_CLASSES - 1][2], unsigned int (*branch_ct_class0)[CLASS0_SIZE - 1][2], unsigned int (*branch_ct_bits)[MV_OFFSET_BITS][2], - unsigned int (*branch_ct_class0_fp)[CLASS0_SIZE][4 - 1][2], - unsigned int (*branch_ct_fp)[4 - 1][2], + unsigned int (*branch_ct_class0_fp)[CLASS0_SIZE][MV_FP_SIZE - 1][2], + unsigned int (*branch_ct_fp)[MV_FP_SIZE - 1][2], unsigned int (*branch_ct_class0_hp)[2], unsigned int (*branch_ct_hp)[2]) { int i, j, k; @@ -205,8 +205,8 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) { unsigned int branch_ct_classes[2][MV_CLASSES - 1][2]; unsigned int branch_ct_class0[2][CLASS0_SIZE - 1][2]; unsigned int branch_ct_bits[2][MV_OFFSET_BITS][2]; - unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][4 - 1][2]; - unsigned int branch_ct_fp[2][4 - 1][2]; + unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][MV_FP_SIZE - 1][2]; + unsigned int branch_ct_fp[2][MV_FP_SIZE - 1][2]; unsigned int branch_ct_class0_hp[2][2]; unsigned int branch_ct_hp[2][2]; nmv_context *mvc = &cpi->common.fc.nmvc; @@ -238,12 +238,12 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) { for (i = 0; i < 2; ++i) { for (j = 0; j < CLASS0_SIZE; ++j) { int k; - for (k = 0; k < 3; ++k) + for (k = 0; k < MV_FP_SIZE - 1; ++k) update_mv(bc, branch_ct_class0_fp[i][j][k], &mvc->comps[i].class0_fp[j][k], NMV_UPDATE_PROB); } - for (j = 0; j < 3; ++j) + for (j = 0; j < MV_FP_SIZE - 1; ++j) update_mv(bc, branch_ct_fp[i][j], &mvc->comps[i].fp[j], NMV_UPDATE_PROB); } diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index b7874d515..4588966ca 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -37,9 +37,6 @@ #include "vpx_ports/vpx_timer.h" - -extern void print_tree_update_probs(); - static void set_default_lf_deltas(struct loopfilter *lf); #define DEFAULT_INTERP_FILTER SWITCHABLE @@ -467,69 +464,6 @@ static void configure_static_seg_features(VP9_COMP *cpi) { } } -#ifdef ENTROPY_STATS -void vp9_update_mode_context_stats(VP9_COMP *cpi) { - VP9_COMMON *cm = &cpi->common; - int i, j; - unsigned int (*inter_mode_counts)[INTER_MODES - 1][2] = - cm->fc.inter_mode_counts; - int64_t (*mv_ref_stats)[INTER_MODES - 1][2] = cpi->mv_ref_stats; - FILE *f; - - // Read the past stats counters - f = fopen("mode_context.bin", "rb"); - if (!f) { - vpx_memset(cpi->mv_ref_stats, 0, sizeof(cpi->mv_ref_stats)); - } else { - fread(cpi->mv_ref_stats, sizeof(cpi->mv_ref_stats), 1, f); - fclose(f); - } - - // Add in the values for this frame - for (i = 0; i < INTER_MODE_CONTEXTS; i++) { - for (j = 0; j < INTER_MODES - 1; j++) { - mv_ref_stats[i][j][0] += (int64_t)inter_mode_counts[i][j][0]; - mv_ref_stats[i][j][1] += (int64_t)inter_mode_counts[i][j][1]; - } - } - - // Write back the accumulated stats - f = fopen("mode_context.bin", "wb"); - fwrite(cpi->mv_ref_stats, sizeof(cpi->mv_ref_stats), 1, f); - fclose(f); -} - -void print_mode_context(VP9_COMP *cpi) { - FILE *f = fopen("vp9_modecont.c", "a"); - int i, j; - - fprintf(f, "#include \"vp9_entropy.h\"\n"); - fprintf( - f, - "const int inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1] ="); - fprintf(f, "{\n"); - for (j = 0; j < INTER_MODE_CONTEXTS; j++) { - fprintf(f, " {/* %d */ ", j); - fprintf(f, " "); - for (i = 0; i < INTER_MODES - 1; i++) { - int this_prob; - int64_t count = cpi->mv_ref_stats[j][i][0] + cpi->mv_ref_stats[j][i][1]; - if (count) - this_prob = ((cpi->mv_ref_stats[j][i][0] * 256) + (count >> 1)) / count; - else - this_prob = 128; - - // context probs - fprintf(f, "%5d, ", this_prob); - } - fprintf(f, " },\n"); - } - - fprintf(f, "};\n"); - fclose(f); -} -#endif // ENTROPY_STATS - // DEBUG: Print out the segment id of each MB in the current frame. static void print_seg_map(VP9_COMP *cpi) { VP9_COMMON *cm = &cpi->common; @@ -1902,14 +1836,6 @@ void vp9_remove_compressor(VP9_PTR *ptr) { vp9_end_second_pass(cpi); } -#ifdef ENTROPY_STATS - if (cpi->pass != 1) { - print_context_counters(); - print_tree_update_probs(); - print_mode_context(cpi); - } -#endif - #ifdef MODE_STATS if (cpi->pass != 1) { write_tx_count_stats(); diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 5d37f8393..13788f9fe 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -567,8 +567,7 @@ static void dist_block(int plane, int block, TX_SIZE tx_size, void *arg) { &this_sse) >> shift; args->sse = this_sse >> shift; - if (x->skip_encode && - xd->mi_8x8[0]->mbmi.ref_frame[0] == INTRA_FRAME) { + if (x->skip_encode && !is_inter_block(&xd->mi_8x8[0]->mbmi)) { // TODO(jingning): tune the model to better capture the distortion. int64_t p = (pd->dequant[1] * pd->dequant[1] * (1 << ss_txfrm_size)) >> (shift + 2); @@ -3754,7 +3753,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, assert((cm->mcomp_filter_type == SWITCHABLE) || (cm->mcomp_filter_type == best_mbmode.interp_filter) || - (best_mbmode.ref_frame[0] == INTRA_FRAME)); + !is_inter_block(&best_mbmode)); // Updating rd_thresh_freq_fact[] here means that the different // partition/block sizes are handled independently based on the best @@ -4325,8 +4324,8 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, } // Keep record of best inter rd with single reference - if (xd->mi_8x8[0]->mbmi.ref_frame[0] > INTRA_FRAME && - xd->mi_8x8[0]->mbmi.ref_frame[1] == NONE && + if (is_inter_block(&xd->mi_8x8[0]->mbmi) && + !has_second_ref(&xd->mi_8x8[0]->mbmi) && !mode_excluded && this_rd < best_inter_rd) { best_inter_rd = this_rd; @@ -4489,7 +4488,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, assert((cm->mcomp_filter_type == SWITCHABLE) || (cm->mcomp_filter_type == best_mbmode.interp_filter) || - (best_mbmode.ref_frame[0] == INTRA_FRAME)); + !is_inter_block(&best_mbmode)); // Updating rd_thresh_freq_fact[] here means that the different // partition/block sizes are handled independently based on the best @@ -4515,7 +4514,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, // macroblock modes *mbmi = best_mbmode; x->skip |= best_skip2; - if (best_mbmode.ref_frame[0] == INTRA_FRAME) { + if (!is_inter_block(&best_mbmode)) { for (i = 0; i < 4; i++) xd->mi_8x8[0]->bmi[i].as_mode = best_bmodes[i].as_mode; } else { |