]> granicus.if.org Git - libvpx/commitdiff
fix more merge issues
authorYaowu Xu <yaowu@google.com>
Wed, 20 Jul 2011 21:21:24 +0000 (14:21 -0700)
committerYaowu Xu <yaowu@google.com>
Thu, 21 Jul 2011 16:01:53 +0000 (09:01 -0700)
With this fix, the experimental branch now builds and encodes correctly
with the following two configure options respectively:
--enable-experimental --enable-t8x8
--enable-experimental

Change-Id: I3147c33c503fe713a85fd371e4f1a974805778bf

29 files changed:
vp8/common/blockd.h
vp8/common/coefupdateprobs.h
vp8/common/defaultcoefcounts.c
vp8/common/entropy.c
vp8/common/entropy.h
vp8/common/idct.h
vp8/common/idctllm.c
vp8/common/onyx.h
vp8/common/recon.c
vp8/common/reconinter.c
vp8/decoder/decodemv.c
vp8/decoder/decodframe.c
vp8/decoder/dequantize.c
vp8/decoder/dequantize.h
vp8/decoder/detokenize.c
vp8/decoder/idct_blk.c
vp8/decoder/onyxd_if.c
vp8/decoder/onyxd_int.h
vp8/encoder/bitstream.c
vp8/encoder/dct.c
vp8/encoder/encodeframe.c
vp8/encoder/encodemb.c
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/encoder/quantize.c
vp8/encoder/quantize.h
vp8/encoder/rdopt.c
vp8/encoder/tokenize.c
vp8/encoder/tokenize.h

index 6482b2a894daabe235b5f365ba1db712d506c1db..d2ef84256147bae26e85b48123c65e4965b50290 100644 (file)
@@ -94,14 +94,14 @@ typedef enum
     MB_MODE_COUNT
 } MB_PREDICTION_MODE;
 
-// Macroblock level features
+/* Macroblock level features */
 typedef enum
 {
-    MB_LVL_ALT_Q = 0,               // Use alternate Quantizer ....
-    MB_LVL_ALT_LF = 1,              // Use alternate loop filter value...
-    MB_LVL_MAX = 2,                 // Number of MB level features supported
-} MB_LVL_FEATURES;
+    MB_LVL_ALT_Q = 0,               /* Use alternate Quantizer .... */
+    MB_LVL_ALT_LF = 1,              /* Use alternate loop filter value... */
+    MB_LVL_MAX = 2                  /* Number of MB level features supported */
 
+} MB_LVL_FEATURES;
 
 /* Segment Feature Masks */
 #define SEGMENT_ALTQ    0x01
@@ -163,8 +163,9 @@ typedef struct
     MB_PREDICTION_MODE mode, uv_mode;
     MV_REFERENCE_FRAME ref_frame;
     int_mv mv;
+#if CONFIG_SEGMENTATION
     unsigned char segment_flag;
-
+#endif
     unsigned char partitioning;
     unsigned char mb_skip_coeff;                                /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
     unsigned char need_to_clamp_mvs;
@@ -237,11 +238,11 @@ typedef struct
     /* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
     unsigned char mb_segement_abs_delta;
 
-    unsigned char temporal_update;
     /* Per frame flags that define which MB level features (such as quantizer or loop filter level) */
     /* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
 #if CONFIG_SEGMENTATION
     vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS + 3];         // Probability Tree used to code Segment number
+    unsigned char temporal_update;
 #else
     vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
 #endif
@@ -275,7 +276,6 @@ typedef struct
 
     void *current_bc;
 
-
     int corrupted;
 
 #if CONFIG_RUNTIME_CPU_DETECT
index 029941440d4f582cb6606cf08382f683e40784ae..6fe5fcc6fb894892b3b65bc2118980f9a8dcf78e 100644 (file)
@@ -183,8 +183,11 @@ const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTE
         },
     },
 };
-
-const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] =
+#if CONFIG_T8X8
+const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES]
+                                         [COEF_BANDS]
+                                         [PREV_COEF_CONTEXTS]
+                                         [ENTROPY_NODES] =
 {
     {
       {
@@ -356,3 +359,4 @@ const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_C
     },
 
 };
+#endif
\ No newline at end of file
index a0258bd034b898f724f92638b202634a1b52abec..34d1fb1d510b16dd8c558f5e19cf3d90343f153d 100644 (file)
@@ -225,6 +225,7 @@ const unsigned int vp8_default_coef_counts[BLOCK_TYPES]
 };
 
 
+#if CONFIG_T8X8
 const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES]
                                               [COEF_BANDS]
                                               [PREV_COEF_CONTEXTS]
@@ -400,3 +401,4 @@ const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES]
       }
     }
   };
+#endif
\ No newline at end of file
index 58328ceb51862decf6e7b9e64cd49691729cc03d..ca37aab22abd44b54245dbc4795c3f7333601eb0 100644 (file)
@@ -120,14 +120,21 @@ static const Prob Pcat2[] = { 165, 145};
 static const Prob Pcat3[] = { 173, 148, 140};
 static const Prob Pcat4[] = { 176, 155, 140, 135};
 static const Prob Pcat5[] = { 180, 157, 141, 134, 130};
+#if CONFIG_EXTEND_QRANGE
 static const Prob Pcat6[] =
 { 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129};
+#else
+static const Prob Pcat6[] =
+{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129};
+
+#endif
 
 static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[22];
 
 void vp8_init_scan_order_mask()
 {
     int i;
+
     for (i = 0; i < 16; i++)
     {
         vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
@@ -160,7 +167,11 @@ static void init_bit_trees()
     init_bit_tree(cat3, 3);
     init_bit_tree(cat4, 4);
     init_bit_tree(cat5, 5);
+#if CONFIG_EXTEND_QRANGE
     init_bit_tree(cat6, 13);
+#else
+    init_bit_tree(cat6, 11);
+#endif
 }
 
 vp8_extra_bit_struct vp8_extra_bits[12] =
@@ -175,7 +186,11 @@ vp8_extra_bit_struct vp8_extra_bits[12] =
     { cat3, Pcat3, 3, 11},
     { cat4, Pcat4, 4, 19},
     { cat5, Pcat5, 5, 35},
+#if CONFIG_EXTEND_QRANGE
     { cat6, Pcat6, 13, 67},
+#else
+    { cat6, Pcat6, 11, 67},
+#endif
     { 0, 0, 0, 0}
 };
 #include "defaultcoefcounts.h"
@@ -183,6 +198,7 @@ vp8_extra_bit_struct vp8_extra_bits[12] =
 void vp8_default_coef_probs(VP8_COMMON *pc)
 {
     int h = 0;
+
     do
     {
         int i = 0;
@@ -234,6 +250,7 @@ void vp8_default_coef_probs(VP8_COMMON *pc)
 #endif
 }
 
+
 void vp8_coef_tree_initialize()
 {
     init_bit_trees();
index 78645271229d99a44e212d8896f01837ceebcaa4..d3e841c3e9e71abe76e0a6d7ba8f1bad32e4b8fe 100644 (file)
@@ -50,8 +50,11 @@ extern vp8_extra_bit_struct vp8_extra_bits[12];    /* indexed by token value */
 #define PROB_UPDATE_BASELINE_COST   7
 
 #define MAX_PROB                255
+#if CONFIG_EXTEND_QRANGE
 #define DCT_MAX_VALUE           8192
-
+#else
+#define DCT_MAX_VALUE           2048
+#endif
 
 /* Coefficients are predicted via a 3-dimensional probability table. */
 
@@ -104,6 +107,6 @@ extern DECLARE_ALIGNED(64, const int, vp8_default_zig_zag1d_8x8[64]);
 extern short vp8_default_zig_zag_mask_8x8[64];//int64_t
 #endif
 extern const int vp8_mb_feature_data_bits[MB_LVL_MAX];
-void vp8_coef_tree_initialize(void);
 
+void vp8_coef_tree_initialize(void);
 #endif
index aa1fb5e42306a57ce82b61c873b910a47e33c1cb..d1890b9e5735fe376015c0622799331eab13b6ad 100644 (file)
@@ -74,6 +74,7 @@ extern prototype_idct(vp8_idct_idct16);
 #endif
 extern prototype_idct_scalar_add(vp8_idct_idct1_scalar_add);
 
+
 #ifndef vp8_idct_iwalsh1
 #define vp8_idct_iwalsh1 vp8_short_inv_walsh4x4_1_c
 #endif
index 9d3e30413c32b4458f9bbd34443c959e2f38f2b5..4f3a01b1b2765763e091b0009cd26b16249436c3 100644 (file)
@@ -203,7 +203,6 @@ void vp8_short_inv_walsh4x4_c(short *input, short *output)
         ip += 4;
         op += 4;
     }
-    //printf("here2\n");
 }
 
 void vp8_short_inv_walsh4x4_1_c(short *input, short *output)
@@ -213,9 +212,9 @@ void vp8_short_inv_walsh4x4_1_c(short *input, short *output)
     short *op = output;
 
 #if !CONFIG_EXTEND_QRANGE
-    a1 = ((input[0] + 3) >> 3);
+    a1 = (input[0] + 3 )>> 3;
 #else
-    a1 = ((input[0] + 1) >> 2);
+    a1 = (input[0] + 1 )>> 2;
 #endif
 
     for (i = 0; i < 4; i++)
index b9ef2657681b0cbec2faa41ebf18d4860783278e..545798ac708c52303f16e14cbf6734fed67a6e39 100644 (file)
@@ -126,7 +126,6 @@ extern "C"
         //(5)=Two Pass - Second Pass Best.  The encoder uses the statistics that were generated in the first
         //    encoding pass to create the compressed output using the highest possible quality, and taking a
         //    longer amount of time to encode.. ( speed setting ignored )
-
         int Mode;               //
 
         // Key Framing Operations
index c8263964561ed1269961a7978094cf22dfd9302e..d72d6e4104406c7a98d790e97a225d36814b4046 100644 (file)
@@ -12,7 +12,7 @@
 #include "vpx_ports/config.h"
 #include "recon.h"
 #include "blockd.h"
-#include <stdio.h>
+
 void vp8_recon_b_c
 (
     unsigned char *pred_ptr,
@@ -133,7 +133,6 @@ void vp8_recon_mby_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
         RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
     }
 #endif
-
 }
 
 void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
@@ -172,7 +171,6 @@ void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
         RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
     }
 
-
     for (i = 16; i < 24; i += 2)
     {
         BLOCKD *b = &x->block[i];
@@ -180,5 +178,4 @@ void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
         RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
     }
 #endif
-
 }
index fb1e90939fa94d06c4a0c59726062a0fa4de6829..3b0405ca1c640319773fe27e607e4f53b22cb6e3 100644 (file)
@@ -464,3 +464,7 @@ void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel)
         }
     }
 }
+
+
+
+
index 815112ed3ba091641a49be17acbdf4a19a617681..f23fd00b49ba47ab02121d5d531805db389ac47e 100644 (file)
@@ -18,8 +18,6 @@
 #if CONFIG_DEBUG
 #include <assert.h>
 #endif
-extern int frame_count;
-
 static int vp8_read_bmode(vp8_reader *bc, const vp8_prob *p)
 {
     const int i = vp8_treed_read(bc, vp8_bmode_tree, p);
@@ -62,7 +60,6 @@ static void vp8_read_mb_features(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x
         else
             mi->segment_id = (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1]));
     }
-    //printf("vp8_read_mb_features Segment = %d of frame %d\n", mi->segment_id, frame_count);
 }
 
 static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_col)
@@ -80,7 +77,6 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
 
             if (pbi->mb.update_mb_segmentation_map)
                 vp8_read_mb_features(bc, &m->mbmi, &pbi->mb);
-            //printf("vp8_kfread_modes segment = %d\n", m->mbmi.segment_id);
 
             /* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */
             if (pbi->common.mb_no_coeff_skip)
@@ -316,14 +312,12 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
                     {
                         mbmi->segment_id = pbi->segmentation_map[index];
                         mbmi->segment_flag = 0;
-                        //printf("vp8_read_mb_modes_mv Temporal Update if %d\n", mbmi->segment_id);
                     }
                     else
                     {
                         vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
                         mbmi->segment_flag = 1;
                         pbi->segmentation_map[index] = mbmi->segment_id;
-                        //printf("vp8_read_mb_modes_mv Temporal Update else %d\n", mbmi->segment_id);
                     }
 
                 }
@@ -331,7 +325,6 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
                 {
                     vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
                     pbi->segmentation_map[index] = mbmi->segment_id;
-                    //printf("vp8_read_mb_modes_mv Not Temporal Update %d\n", mbmi->segment_id);
                 }
                 index++;
 #else
index 09fb6d0df357e4ca93fe898f32b6af10eeaa4d7b..dbfe909aec08206d2c77b5a6b6ac81546154c008 100644 (file)
@@ -241,13 +241,14 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
     if (eobtotal == 0 && mode != B_PRED && mode != SPLITMV)
     {
         /* Special case:  Force the loopfilter to skip when eobtotal and
-        * mb_skip_coeff are zero.
-        * */
+         * mb_skip_coeff are zero.
+         * */
         xd->mode_info_context->mbmi.mb_skip_coeff = 1;
 
         skip_recon_mb(pbi, xd);
         return;
     }
+
     if (xd->segmentation_enabled)
         mb_init_dequantizer(pbi, xd);
 
@@ -259,7 +260,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
         if (mode != B_PRED)
         {
             RECON_INVOKE(&pbi->common.rtcd.recon,
-                build_intra_predictors_mby)(xd);
+                         build_intra_predictors_mby)(xd);
         } else {
             vp8_intra_prediction_down_copy(xd);
         }
@@ -275,8 +276,8 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
         vp8dx_bool_error(xd->current_bc)))
     {
         /* MB with corrupt residuals or corrupt mode/motion vectors.
-        * Better to use the predictor as reconstruction.
-        */
+         * Better to use the predictor as reconstruction.
+         */
         vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
         vp8_conceal_corrupt_mb(xd);
         return;
@@ -290,7 +291,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
         {
             BLOCKD *b = &xd->block[i];
             RECON_INVOKE(RTCD_VTABLE(recon), intra4x4_predict)
-                (b, b->bmi.as_mode, b->predictor);
+                          (b, b->bmi.as_mode, b->predictor);
 
             if (xd->eobs[i] > 1)
             {
@@ -306,6 +307,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
                 ((int *)b->qcoeff)[0] = 0;
             }
         }
+
     }
     else if (mode == SPLITMV)
     {
@@ -366,8 +368,6 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
 
         else
 #endif
-        {
-            DEQUANT_INVOKE(&pbi->dequant, block)(b);
             if (xd->eobs[24] > 1)
             {
                 IDCT_INVOKE(RTCD_VTABLE(idct), iwalsh16)(&b->dqcoeff[0], b->diff);
@@ -390,7 +390,6 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
                 (xd->qcoeff, xd->block[0].dequant,
                 xd->predictor, xd->dst.y_buffer,
                 xd->dst.y_stride, xd->eobs, xd->block[24].diff);
-        }
     }
 #if CONFIG_T8X8
     if(xd->mode_info_context->mbmi.segment_id >= 2)
@@ -403,15 +402,13 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
     }
     else
 #endif
-    {
 
-        DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block)
-            (xd->qcoeff+16*16, xd->block[16].dequant,
-            xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer,
-            xd->dst.uv_stride, xd->eobs+16);
-    }
+    DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block)
+                    (xd->qcoeff+16*16, xd->block[16].dequant,
+                     xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer,
+                     xd->dst.uv_stride, xd->eobs+16);
 
-    }
+}
 
 
 static int get_delta_q(vp8_reader *bc, int prev, int *q_update)
@@ -749,6 +746,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
     const unsigned char *data = (const unsigned char *)pbi->Source;
     const unsigned char *data_end = data + pbi->source_sz;
     ptrdiff_t first_partition_length_in_bytes;
+
     int mb_row;
     int i, j, k, l;
     const int *const mb_feature_data_bits = vp8_mb_feature_data_bits;
index 0e17cf9af6295e1061911893599e135bf5e7dff0..956acba8f64801695b8c98375e9ab6010aea59b9 100644 (file)
@@ -36,7 +36,7 @@ void vp8_dequantize_b_c(BLOCKD *d)
 
     for (i = 0; i < 16; i++)
     {
-       DQ[i] = Q[i] * DQC[i];
+        DQ[i] = Q[i] * DQC[i];
     }
 }
 
@@ -50,12 +50,12 @@ void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *pred,
 
     for (i = 0; i < 16; i++)
     {
-       input[i] = dq[i] * input[i];
-
+        input[i] = dq[i] * input[i];
     }
 
     /* the idct halves ( >> 1) the pitch */
     vp8_short_idct4x4llm_c(input, output, 4 << 1);
+
     vpx_memset(input, 0, 32);
 
     for (r = 0; r < 4; r++)
@@ -88,17 +88,18 @@ void vp8_dequant_dc_idct_add_c(short *input, short *dq, unsigned char *pred,
     short *diff_ptr = output;
     int r, c;
 
-
     input[0] = (short)Dc;
 
     for (i = 1; i < 16; i++)
     {
-       input[i] = dq[i] * input[i];
+        input[i] = dq[i] * input[i];
     }
 
     /* the idct halves ( >> 1) the pitch */
     vp8_short_idct4x4llm_c(input, output, 4 << 1);
+
     vpx_memset(input, 0, 32);
+
     for (r = 0; r < 4; r++)
     {
         for (c = 0; c < 4; c++)
index 15d5bbe91de6662ec41e147f183f8e0f74f9289f..5ae6f961920e542dd36edb1539ce84d20499fefb 100644 (file)
@@ -42,7 +42,7 @@
              unsigned char *pre, unsigned char *dst_u, \
              unsigned char *dst_v, int stride, char *eobs)
 
-#if 1//CONFIG_T8X8
+#if CONFIG_T8X8
 #define prototype_dequant_dc_idct_add_y_block_8x8(sym) \
     void sym(short *q, short *dq, \
              unsigned char *pre, unsigned char *dst, \
index 6d78e602239c0427d76bcbb748b58cf66bcb0b84..6121490eba6718636036cb40fb2124344ee826d1 100644 (file)
@@ -59,7 +59,7 @@ typedef struct
     UINT8 Probs[14];
 } TOKENEXTRABITS;
 */
-
+#if CONFIG_EXTEND_QRANGE
 DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTROPY_TOKENS]) =
 {
     {  0, -1, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },  /* ZERO_TOKEN */
@@ -75,6 +75,23 @@ DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTR
     { 67, 12, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 249, 252, 254, 254,  0   } }, /* DCT_VAL_CATEGORY6 */
     {  0, -1, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },  /*  EOB TOKEN */
 };
+#else
+DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTROPY_TOKENS]) =
+{
+    {  0, -1, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },  /* ZERO_TOKEN */
+    {  1, 0, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },   /* ONE_TOKEN */
+    {  2, 0, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },   /* TWO_TOKEN */
+    {  3, 0, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },   /* THREE_TOKEN */
+    {  4, 0, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },   /* FOUR_TOKEN */
+    {  5, 0, { 159, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },  /* DCT_VAL_CATEGORY1 */
+    {  7, 1, { 145, 165, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } }, /* DCT_VAL_CATEGORY2 */
+    { 11, 2, { 140, 148, 173, 0,  0,  0,  0,  0,  0,  0,  0,  0   } }, /* DCT_VAL_CATEGORY3 */
+    { 19, 3, { 135, 140, 155, 176, 0,  0,  0,  0,  0,  0,  0,  0   } }, /* DCT_VAL_CATEGORY4 */
+    { 35, 4, { 130, 134, 141, 157, 180, 0,  0,  0,  0,  0,  0,  0   } }, /* DCT_VAL_CATEGORY5 */
+    { 67, 10, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254, 0   } }, /* DCT_VAL_CATEGORY6 */
+    {  0, -1, { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0   } },  /*  EOB TOKEN */
+};
+#endif
 
 
 void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
index 44a223157a5b3958e52fb64b290d7271b62616fc..2015d5255735bfee5db28abf847d84834ab651f5 100644 (file)
@@ -30,13 +30,10 @@ void vp8_dequant_dc_idct_add_y_block_c
     {
         for (j = 0; j < 4; j++)
         {
-            if (*eobs++ <= 1)
-            {
-                vp8_dc_only_idct_add_c (dc[0], pre, dst, 16, stride);
-            }
-
-            else
+            if (*eobs++ > 1)
                 vp8_dequant_dc_idct_add_c (q, dq, pre, dst, 16, stride, dc[0]);
+            else
+                vp8_dc_only_idct_add_c (dc[0], pre, dst, 16, stride);
 
             q   += 16;
             pre += 4;
@@ -59,13 +56,14 @@ void vp8_dequant_idct_add_y_block_c
     {
         for (j = 0; j < 4; j++)
         {
-            if (*eobs++ <= 1)
+            if (*eobs++ > 1)
+                vp8_dequant_idct_add_c (q, dq, pre, dst, 16, stride);
+            else
             {
                 vp8_dc_only_idct_add_c (q[0]*dq[0], pre, dst, 16, stride);
                 ((int *)q)[0] = 0;
             }
-            else
-                vp8_dequant_idct_add_c (q, dq, pre, dst, 16, stride);
+
             q   += 16;
             pre += 4;
             dst += 4;
@@ -86,13 +84,14 @@ void vp8_dequant_idct_add_uv_block_c
     {
         for (j = 0; j < 2; j++)
         {
-            if (*eobs++ <= 1)
+            if (*eobs++ > 1)
+                vp8_dequant_idct_add_c (q, dq, pre, dstu, 8, stride);
+            else
             {
                 vp8_dc_only_idct_add_c (q[0]*dq[0], pre, dstu, 8, stride);
                 ((int *)q)[0] = 0;
             }
-            else
-                vp8_dequant_idct_add_c (q, dq, pre, dstu, 8, stride);
+
             q    += 16;
             pre  += 4;
             dstu += 4;
@@ -106,14 +105,14 @@ void vp8_dequant_idct_add_uv_block_c
     {
         for (j = 0; j < 2; j++)
         {
-            if (*eobs++ <= 1)
+            if (*eobs++ > 1)
+                vp8_dequant_idct_add_c (q, dq, pre, dstv, 8, stride);
+            else
             {
                 vp8_dc_only_idct_add_c (q[0]*dq[0], pre, dstv, 8, stride);
                 ((int *)q)[0] = 0;
             }
 
-            else
-                vp8_dequant_idct_add_c (q, dq, pre, dstv, 8, stride);
             q    += 16;
             pre  += 4;
             dstv += 4;
index 1e2c3138f280cfe62e1ff5e4c1f98d1ca300a69b..b4d78d656685156c1074a9158ce1aff99f4d4430 100644 (file)
@@ -157,7 +157,7 @@ void vp8dx_remove_decompressor(VP8D_PTR ptr)
     if (!pbi)
         return;
 #if CONFIG_SEGMENTATION
-    // Delete sementation map
+     // Delete sementation map
     if (pbi->segmentation_map != 0)
         vpx_free(pbi->segmentation_map);
 #endif
@@ -514,8 +514,6 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
         {
             /* Apply the loop filter if appropriate. */
             vp8_loop_filter_frame(cm, &pbi->mb, cm->filter_level);
-            //vp8_print_yuv_rec_mb(cm, 9, 10);
-
 
             cm->last_frame_type = cm->frame_type;
             cm->last_filter_type = cm->filter_type;
@@ -554,7 +552,6 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
 
     /*vp8_print_modes_and_motion_vectors( cm->mi, cm->mb_rows,cm->mb_cols, cm->current_video_frame);*/
 
-    //printf("Decoded frame (%d) %d\n", cm->show_frame, cm->current_video_frame);
     if (cm->show_frame)
         cm->current_video_frame++;
 
index c31623dfabb286c8a1cd3d378bb568cfe3225512..6309915ab7ffa1b618ab05a1d2e1144294d93e6e 100644 (file)
@@ -44,13 +44,21 @@ typedef struct
     int size;
 } DATARATE;
 
+#if CONFIG_EXTEND_QRANGE
 typedef struct
 {
     INT16        min_val;
     INT16        Length;
     UINT8 Probs[14];
 } TOKENEXTRABITS;
-
+#else
+typedef struct
+{
+    INT16        min_val;
+    INT16        Length;
+    UINT8 Probs[12];
+} TOKENEXTRABITS;
+#endif
 typedef struct
 {
     int const *scan;
index f915b696327113e90fade64fb0c9e3ae5419be98..64d1c93042c18734afcf4df04ad28868925bc433 100644 (file)
@@ -192,10 +192,6 @@ static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
             n--;
             i = 2;
         }
-        if (n == 0) {
-          printf("Fatal Error: n=0\n");
-          fflush(stdout);
-        }
 
         do
         {
@@ -870,8 +866,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
     VP8_COMMON *const pc = & cpi->common;
     vp8_writer *const w = & cpi->bc;
     const MV_CONTEXT *mvc = pc->fc.mvc;
-#if CONFIG_SEGMENTATION
     MACROBLOCKD *xd = &cpi->mb.e_mbd;
+#if CONFIG_SEGMENTATION
     int left_id, above_id;
     int i;
     int sum;
@@ -1136,6 +1132,8 @@ static void write_kfmodes(VP8_COMP *cpi)
     /* const */
     MODE_INFO *m = c->mi;
 #if CONFIG_SEGMENTATION
+    int left_id, above_id;
+    int i;
     int index = 0;
 #endif
     int mb_row = -1;
@@ -2063,9 +2061,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
         active_section = 1;
 #endif
     }
-#if CONFIG_SEGMENTATION
-    //printf("%d\n",segment_cost);
-#endif
+
     vp8_stop_encode(bc);
 
     oh.first_partition_length_in_bytes = cpi->bc.pos;
index 9584dc76545e54da935be98e858696433c773fe7..fd4c62cd490f2f714fc8d4742256cdeb6eed0739 100644 (file)
@@ -16,7 +16,7 @@
 
 
 
-
+#if CONFIG_T8X8
 void vp8_short_fdct8x8_c(short *block, short *coefs, int pitch)
 {
   int j1, i, j, k;
@@ -126,6 +126,7 @@ void vp8_short_fhaar2x2_c(short *input, short *output, int pitch) //pitch = 8
    op1[8]=ip1[0] - ip1[1] - ip1[4] + ip1[8];
 
 }
+#endif
 void vp8_short_fdct4x4_c(short *input, short *output, int pitch)
 {
     int i;
@@ -176,6 +177,11 @@ void vp8_short_fdct4x4_c(short *input, short *output, int pitch)
     }
 }
 
+void vp8_short_fdct8x4_c(short *input, short *output, int pitch)
+{
+    vp8_short_fdct4x4_c(input,   output,    pitch);
+    vp8_short_fdct4x4_c(input + 4, output + 16, pitch);
+}
 
 void vp8_short_walsh4x4_c(short *input, short *output, int pitch)
 {
@@ -194,7 +200,7 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch)
         c1 = ((ip[1] - ip[3])<<2);
         b1 = ((ip[0] - ip[2])<<2);
 
-        op[0] = a1 + d1+ (a1!=0);
+        op[0] = a1 + d1 + (a1!=0);
 #else
         a1 = ((ip[0] + ip[2]));
         d1 = ((ip[1] + ip[3]));
@@ -246,9 +252,3 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch)
         op++;
     }
 }
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch)
-{
-    vp8_short_fdct4x4_c(input,   output,    pitch);
-    vp8_short_fdct4x4_c(input + 4, output + 16, pitch);
-}
index 4b76b23f2b49302eaca45f2af08ac5496ea66766..ba5409754c896234aac1fe1a0e9f05efafcdc864 100644 (file)
@@ -573,6 +573,7 @@ void encode_mb_row(VP8_COMP *cpi,
     int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
     int map_index = (mb_row * cpi->common.mb_cols);
 #if CONFIG_SEGMENTATION
+    int left_id, above_id;
     int sum;
 #endif
 #if CONFIG_MULTITHREAD
@@ -585,6 +586,7 @@ void encode_mb_row(VP8_COMP *cpi,
     else
         last_row_current_mb_col = &rightmost_col;
 #endif
+
     // reset above block coeffs
     xd->above_context = cm->above_context;
 
@@ -664,14 +666,18 @@ void encode_mb_row(VP8_COMP *cpi,
         if (xd->segmentation_enabled)
         {
             // Code to set segment id in xd->mbmi.segment_id for current MB (with range checking)
+#if CONFIG_T8X8
             // Reset segment_id to 0 or 1 so that the default transform mode is 4x4
             if (cpi->segmentation_map[map_index+mb_col] <= 3)
                 xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[map_index+mb_col]&1;
+#else
+            if (cpi->segmentation_map[map_index+mb_col] <= 3)
+                xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[map_index+mb_col];
+#endif
             else
                 xd->mode_info_context->mbmi.segment_id = 0;
 
             vp8cx_mb_init_quantizer(cpi, x);
-
         }
         else
             xd->mode_info_context->mbmi.segment_id = 0;         // Set to Segment 0 by default
@@ -819,6 +825,7 @@ void encode_mb_row(VP8_COMP *cpi,
     // this is to account for the border
     xd->mode_info_context++;
     x->partition_info++;
+
 #if CONFIG_MULTITHREAD
     if ((cpi->b_multi_threaded != 0) && (mb_row == cm->mb_rows - 1))
     {
@@ -826,6 +833,7 @@ void encode_mb_row(VP8_COMP *cpi,
     }
 #endif
 }
+
 void init_encode_frame_mb_context(VP8_COMP *cpi)
 {
     MACROBLOCK *const x = & cpi->mb;
@@ -922,7 +930,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
     TOKENEXTRA *tp = cpi->tok;
 #if CONFIG_SEGMENTATION
     int segment_counts[MAX_MB_SEGMENTS + SEEK_SEGID];
-    int prob[3] = {255, 255, 255};
+    int prob[3];
     int new_cost, original_cost;
 #else
     int segment_counts[MAX_MB_SEGMENTS];
@@ -1479,20 +1487,18 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
             x->e_mbd.mode_info_context->mbmi.segment_id |= (vp8_8x8_selection_intra(x) << 1);
 #endif
         vp8_encode_intra16x16mby(IF_RTCD(&cpi->rtcd), x);
-
-        vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x);
-        sum_intra_stats(cpi, x);
-        vp8_tokenize_mb(cpi, &x->e_mbd, t);
+    }
+    vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x);
+    sum_intra_stats(cpi, x);
+    vp8_tokenize_mb(cpi, &x->e_mbd, t);
 #if CONFIG_T8X8
         if( x->e_mbd.mode_info_context->mbmi.segment_id >=2)
             cpi->t8x8_count++;
         else
             cpi->t4x4_count++;
 #endif
-    }
     return rate;
 }
-
 #ifdef SPEEDSTATS
 extern int cnt_pm;
 #endif
@@ -1568,7 +1574,7 @@ int vp8cx_encode_inter_macroblock
     cpi->last_mb_distortion = distortion;
 #endif
 
-    // MB level adjustment to quantizer setup
+    // MB level adjutment to quantizer setup
     if (xd->segmentation_enabled)
     {
         // If cyclic update enabled
index 00a19bd88dead957a66f0344d0d1e34e60e5add1..408a5956e0d988bccbce3df92b4b0f8aa671d009 100644 (file)
@@ -122,6 +122,7 @@ static void build_dcblock(MACROBLOCK *x)
         src_diff_ptr[i] = x->coeff[i * 16];
     }
 }
+#if CONFIG_T8X8
 void vp8_build_dcblock_8x8(MACROBLOCK *x)
 {
     short *src_diff_ptr = &x->src_diff[384];
@@ -135,7 +136,7 @@ void vp8_build_dcblock_8x8(MACROBLOCK *x)
     src_diff_ptr[4] = x->coeff[8 * 16];
     src_diff_ptr[8] = x->coeff[12 * 16];
 }
-
+#endif
 void vp8_transform_mbuv(MACROBLOCK *x)
 {
     int i;
index c857704fcd4d36a058631683701a7b0f74864ba5..3adc13689f212c09dfef1e07cca5cf405e02ae75 100644 (file)
@@ -46,8 +46,6 @@
 #define RTCD(x) NULL
 #endif
 
-#define OUTPUT_YUV_REC
-
 extern void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi);
 extern void vp8cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val);
 extern void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi);
@@ -113,7 +111,7 @@ FILE *yuv_rec_file;
 
 #if 0
 FILE *framepsnr;
-FILE ikf_list;
+FILE *kf_list;
 FILE *keyfile;
 #endif
 
@@ -139,6 +137,7 @@ unsigned int cnt_ef = 0;
 extern unsigned __int64 Sectionbits[500];
 #endif
 #ifdef MODE_STATS
+extern unsigned __int64 Sectionbits[50];
 extern int y_modes[5]  ;
 extern int uv_modes[4] ;
 extern int b_modes[10]  ;
index 81e2ebcac8ac3e3ef6fb29bdee8d799db077fb96..a27822da670ab96d5a29f4b97d805aaa8407561c 100644 (file)
 #include "lookahead.h"
 
 //#define SPEEDSTATS 1
-#define MODE_STATS 1
-//#define ENC_DEBUG
-
 #define MIN_GF_INTERVAL             4
 #define DEFAULT_GF_INTERVAL         7
 
 #define KEY_FRAME_CONTEXT 5
 
-#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)//1:25
+#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)
 
 #define AF_THRESH   25
 #define AF_THRESH2  100
@@ -477,8 +474,10 @@ typedef struct VP8_COMP
     int gf_update_recommended;
     int skip_true_count;
     int skip_false_count;
-    int t4x4_count;
-    int t8x8_count;
+#if CONFIG_T8X8\r
+    int t4x4_count;\r
+    int t8x8_count;\r
+#endif
 
     unsigned char *segmentation_map;
     signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];            // Segment data (can be deltas or absolute values)
@@ -646,7 +645,7 @@ int rd_cost_intra_mb(MACROBLOCKD *x);
 void vp8_tokenize_mb(VP8_COMP *, MACROBLOCKD *, TOKENEXTRA **);
 
 void vp8_set_speed_features(VP8_COMP *cpi);
-extern void vp8_write_yuv_frame(const char *name, YV12_BUFFER_CONFIG *s);
+
 #if CONFIG_DEBUG
 #define CHECK_MEM_ERROR(lval,expr) do {\
         lval = (expr); \
index f109135b729ed6cb7a9f21f79f4713f3ef121338..328eabbf9ef603defa25eff5ba374186766b7bb9 100644 (file)
@@ -81,10 +81,11 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
     short *qcoeff_ptr  = d->qcoeff;
     short *dqcoeff_ptr = d->dqcoeff;
     short *dequant_ptr = d->dequant;
+#if CONFIG_T8X8
 
     vpx_memset(qcoeff_ptr, 0, 32);
     vpx_memset(dqcoeff_ptr, 0, 32);
-
+#endif
     eob = -1;
     for (i = 0; i < 16; i++)
     {
@@ -1325,3 +1326,4 @@ void vp8_set_quantizer(struct VP8_COMP *cpi, int Q)
         vp8cx_init_quantizer(cpi);
 
 }
+
index a6a6078b006913ed2f9c581ca476f0c9bd290613..1a2bad6678a2dec78ee5f1c348f2b764ef8d782e 100644 (file)
@@ -45,7 +45,7 @@ extern prototype_quantize_block_pair(vp8_quantize_quantb_pair);
 #define vp8_quantize_fastquantb vp8_fast_quantize_b_c
 #endif
 extern prototype_quantize_block(vp8_quantize_fastquantb);
-
+#if CONFIG_T8X8
 #ifndef vp8_quantize_quantb_8x8
 #define vp8_quantize_quantb_8x8 vp8_regular_quantize_b_8x8
 #endif
@@ -65,7 +65,7 @@ extern prototype_quantize_block(vp8_quantize_quantb_2x2);
 #define vp8_quantize_fastquantb_2x2 vp8_fast_quantize_b_2x2_c
 #endif
 extern prototype_quantize_block(vp8_quantize_fastquantb_2x2);
-
+#endif
 
 #ifndef vp8_quantize_fastquantb_pair
 #define vp8_quantize_fastquantb_pair vp8_fast_quantize_b_pair_c
@@ -77,10 +77,12 @@ typedef struct
     prototype_quantize_block(*quantb);
     prototype_quantize_block_pair(*quantb_pair);
     prototype_quantize_block(*fastquantb);
+#if CONFIG_T8X8
     prototype_quantize_block(*quantb_8x8);
     prototype_quantize_block(*fastquantb_8x8);
     prototype_quantize_block(*quantb_2x2);
     prototype_quantize_block(*fastquantb_2x2);
+#endif
     prototype_quantize_block_pair(*fastquantb_pair);
 } vp8_quantize_rtcd_vtable_t;
 
@@ -106,9 +108,10 @@ extern prototype_quantize_mb(vp8_quantize_mby);
 #endif
 
 extern void vp8_strict_quantize_b(BLOCK *b,BLOCKD *d);
+#if CONFIG_T8X8
 extern void vp8_strict_quantize_b_8x8(BLOCK *b,BLOCKD *d);
 extern void vp8_strict_quantize_b_2x2(BLOCK *b,BLOCKD *d);
-
+#endif
 struct VP8_COMP;
 extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q);
 extern void vp8cx_frame_init_quantizer(struct VP8_COMP *cpi);
index 5e61271a463f8c7fce86911cd000e8a1b7948401..3d77bb35aca0cf9e493c793203e4ba23614018ef 100644 (file)
@@ -1051,7 +1051,6 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels
 }
 
 
-
 static const unsigned int segmentation_to_sseshift[4] = {3, 3, 2, 0};
 
 
index 62581b87f5aad6256ade10551cabba518fb3fd57..e1e124844e77a2616a160f220d6c463fb6165044 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <math.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include "onyx_int.h"
@@ -598,7 +597,6 @@ void print_context_counters()
 
 # define Comma( X) (X? ",":"")
 
-
     type = 0;
 
     do
@@ -933,7 +931,6 @@ static __inline void stuff1st_order_b
     *a = *l = pt;
 
 }
-
 static __inline
 void stuff1st_order_buv
 (
index d7ef529b8ee1def15f15009ce5ffead533ceb435..cd122f19c0bc9633cbc9964342a7eb077054cb2e 100644 (file)
@@ -38,9 +38,10 @@ void init_context_counters();
 void print_context_counters();
 
 extern _int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#if CONFIG_T8X8
 extern _int64 context_counters_8x8[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
 #endif
-
+#endif
 extern const int *vp8_dct_value_cost_ptr;
 /* TODO: The Token field should be broken out into a separate char array to
  *  improve cache locality, since it's needed for costing when the rest of the