]> git.sesse.net Git - x264/commitdiff
cosmetics
authorLoren Merritt <pengvado@videolan.org>
Wed, 16 Aug 2006 19:57:08 +0000 (19:57 +0000)
committerLoren Merritt <pengvado@videolan.org>
Wed, 16 Aug 2006 19:57:08 +0000 (19:57 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@552 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.h
common/frame.c
common/macroblock.c
common/macroblock.h
encoder/analyse.c
encoder/encoder.c
encoder/macroblock.c
encoder/ratecontrol.c

index 322327e1e425e93a156969de836e251fe9dd08a3..0dbb23b553764ec6bce6f107ded29b240cb007e6 100644 (file)
@@ -447,7 +447,7 @@ struct x264_t
             /* pointer over mb of the frame to be compressed */
             uint8_t *p_fenc[3];
 
-            /* pointer over mb of the frame to be reconstrucated  */
+            /* pointer over mb of the frame to be reconstructed  */
             uint8_t *p_fdec[3];
 
             /* pointer over mb of the references */
@@ -464,13 +464,13 @@ struct x264_t
             /* real intra4x4_pred_mode if I_4X4 or I_8X8, I_PRED_4x4_DC if mb available, -1 if not */
             int     intra4x4_pred_mode[X264_SCAN8_SIZE];
 
-            /* i_non_zero_count if availble else 0x80 */
+            /* i_non_zero_count if available else 0x80 */
             int     non_zero_count[X264_SCAN8_SIZE];
 
-            /* -1 if unused, -2 if unavaible */
+            /* -1 if unused, -2 if unavailable */
             int8_t  ref[2][X264_SCAN8_SIZE];
 
-            /* 0 if non avaible */
+            /* 0 if not available */
             int16_t mv[2][X264_SCAN8_SIZE][2];
             int16_t mvd[2][X264_SCAN8_SIZE][2];
 
@@ -534,7 +534,7 @@ struct x264_t
             int i_direct_score[2];
         } frame;
 
-        /* Cummulated stats */
+        /* Cumulated stats */
 
         /* per slice info */
         int     i_slice_count[5];
index 260359e151dfbb1c425ac418629a7a45147a4dac..b64cbb58399e6893cc7d14e952773843739cb0a1 100644 (file)
@@ -652,12 +652,11 @@ void x264_deblock_v_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta
 void x264_deblock_h_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_v_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
 void x264_deblock_h_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
-#endif
 
 #ifdef ARCH_X86_64
 void x264_deblock_v_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_h_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
-#elif defined( HAVE_MMXEXT )
+#else
 void x264_deblock_h_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_v8_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 
@@ -667,6 +666,7 @@ void x264_deblock_v_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta,
     x264_deblock_v8_luma_mmxext( pix+8, stride, alpha, beta, tc0+2 );
 }
 #endif
+#endif
 
 void x264_deblock_init( int cpu, x264_deblock_function_t *pf )
 {
index bb440733d1cb0b180ab4ced4e952f64f6e5005b0..1eca58cc4ddaf0bb6b34b61a11da1f664d4e358b 100644 (file)
 
 #include "common.h"
 
-static const int dequant_mf[6][4][4] =
-{
-    { {10, 13, 10, 13}, {13, 16, 13, 16}, {10, 13, 10, 13}, {13, 16, 13, 16} },
-    { {11, 14, 11, 14}, {14, 18, 14, 18}, {11, 14, 11, 14}, {14, 18, 14, 18} },
-    { {13, 16, 13, 16}, {16, 20, 16, 20}, {13, 16, 13, 16}, {16, 20, 16, 20} },
-    { {14, 18, 14, 18}, {18, 23, 18, 23}, {14, 18, 14, 18}, {18, 23, 18, 23} },
-    { {16, 20, 16, 20}, {20, 25, 20, 25}, {16, 20, 16, 20}, {20, 25, 20, 25} },
-    { {18, 23, 18, 23}, {23, 29, 23, 29}, {18, 23, 18, 23}, {23, 29, 23, 29} }
-};
-
 int x264_mb_predict_intra4x4_mode( x264_t *h, int idx )
 {
     const int ma = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 1];
index 0bdd4baf6ab168b35cb86108c6f830329e180a21..b08f0e9dae73fcbe61ce609239ffe34228096e6e 100644 (file)
@@ -80,15 +80,17 @@ enum mb_class_e
     B_BI_BI         = 16,
     B_8x8           = 17,
     B_SKIP          = 18,
+
+    X264_MBTYPE_MAX = 19
 };
-static const int x264_mb_type_fix[19] =
+static const int x264_mb_type_fix[X264_MBTYPE_MAX] =
 {
     I_4x4, I_4x4, I_16x16, I_PCM,
     P_L0, P_8x8, P_SKIP,
     B_DIRECT, B_L0_L0, B_L0_L1, B_L0_BI, B_L1_L0, B_L1_L1,
     B_L1_BI, B_BI_L0, B_BI_L1, B_BI_BI, B_8x8, B_SKIP
 };
-static const int x264_mb_type_list0_table[19][2] =
+static const int x264_mb_type_list0_table[X264_MBTYPE_MAX][2] =
 {
     {0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
     {1,1},                  /* P_L0 */
@@ -101,7 +103,7 @@ static const int x264_mb_type_list0_table[19][2] =
     {0,0},                  /* B_8x8 */
     {0,0}                   /* B_SKIP */
 };
-static const int x264_mb_type_list1_table[19][2] =
+static const int x264_mb_type_list1_table[X264_MBTYPE_MAX][2] =
 {
     {0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
     {0,0},                  /* P_L0 */
index 424c5da11a190030620cc3505732834d5c6a890e..39ab507a273056892b440357c2b7d08c812fc168 100644 (file)
@@ -57,7 +57,7 @@ typedef struct
 
     /* Sub 4x8 */
     int       i_cost4x8[4]; /* cost per 8x8 partition */
-    x264_me_t me4x8[4][4];
+    x264_me_t me4x8[4][2];
 
     /* 16x8 */
     int       i_cost16x8;
@@ -150,7 +150,7 @@ static const int i_qp0_cost2_table[52] = {
 };
 
 /* TODO: calculate CABAC costs */
-static const int i_mb_b_cost_table[19] = {
+static const int i_mb_b_cost_table[X264_MBTYPE_MAX] = {
     9, 9, 9, 9, 0, 0, 0, 1, 3, 7, 7, 7, 3, 7, 7, 7, 5, 9, 0
 };
 static const int i_mb_b16x8_cost_table[17] = {
index 95121776f4c482d72ba00138a16ef223f9e9251b..c503c2a507321c5b11721e578d870d6ee548eb99 100644 (file)
@@ -979,7 +979,7 @@ static int x264_slice_write( x264_t *h )
         x264_macroblock_analyse( h );
         TIMER_STOP( i_mtime_analyse );
 
-        /* encode this macrobock -> be carefull it can change the mb type to P_SKIP if needed */
+        /* encode this macrobock -> be careful it can change the mb type to P_SKIP if needed */
         TIMER_START( i_mtime_encode );
         x264_macroblock_encode( h );
         TIMER_STOP( i_mtime_encode );
@@ -1538,7 +1538,7 @@ do_encode:
     h->stat.i_slice_size[i_slice_type] += i_frame_size + NALU_OVERHEAD;
     h->stat.i_slice_qp[i_slice_type] += i_global_qp;
 
-    for( i = 0; i < 19; i++ )
+    for( i = 0; i < X264_MBTYPE_MAX; i++ )
         h->stat.i_mb_count[h->sh.i_type][i] += h->stat.frame.i_mb_count[i];
     for( i = 0; i < 2; i++ )
         h->stat.i_mb_count_8x8dct[i] += h->stat.frame.i_mb_count_8x8dct[i];
@@ -1613,7 +1613,7 @@ do_encode:
     int mb_xy;
     for( mb_xy = 0; mb_xy < h->sps->i_mb_width * h->sps->i_mb_height; mb_xy++ )
     {
-        if( h->mb.type[mb_xy] < 19 && h->mb.type[mb_xy] >= 0 )
+        if( h->mb.type[mb_xy] < X264_MBTYPE_MAX && h->mb.type[mb_xy] >= 0 )
             fprintf( stderr, "%c ", mb_chars[ h->mb.type[mb_xy] ] );
         else
             fprintf( stderr, "? " );
@@ -1827,4 +1827,3 @@ void    x264_encoder_close  ( x264_t *h )
         x264_free( h->thread[i] );
     x264_free( h );
 }
-
index c42a54ff67a4529ac406561ab7d3a9878daf3691..0dab70114d540f3f7355b74aa1db91e48cd05e27 100644 (file)
@@ -120,14 +120,14 @@ static void quant_8x8( x264_t *h, int16_t dct[8][8], int quant_mf[6][8][8], int
 {
     const int i_qbits = 16 + i_qscale / 6;
     const int i_mf = i_qscale % 6;
-    const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );
+    const int f = ( 1 << (i_qbits + b_intra) ) / 6;
     h->quantf.quant_8x8_core( dct, quant_mf[i_mf], i_qbits, f );
 }
 static void quant_4x4( x264_t *h, int16_t dct[4][4], int quant_mf[6][4][4], int i_qscale, int b_intra )
 {
     const int i_qbits = 15 + i_qscale / 6;
     const int i_mf = i_qscale % 6;
-    const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );
+    const int f = ( 1 << (i_qbits + b_intra) ) / 6;
     h->quantf.quant_4x4_core( dct, quant_mf[i_mf], i_qbits, f );
 }
 static void quant_4x4_dc( x264_t *h, int16_t dct[4][4], int quant_mf[6][4][4], int i_qscale )
@@ -141,7 +141,7 @@ static void quant_2x2_dc( x264_t *h, int16_t dct[2][2], int quant_mf[6][4][4], i
 {
     const int i_qbits = 16 + i_qscale / 6;
     const int i_mf = i_qscale % 6;
-    const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );
+    const int f = ( 1 << (i_qbits + b_intra) ) / 6;
     h->quantf.quant_2x2_dc_core( dct, quant_mf[i_mf][0][0], i_qbits, f );
 }
 
@@ -603,7 +603,7 @@ void x264_macroblock_encode( x264_t *h )
     /* encode the 8x8 blocks */
     x264_mb_encode_8x8_chroma( h, !IS_INTRA( h->mb.i_type ), i_qp );
 
-    /* Calculate the Luma/Chroma patern and non_zero_count */
+    /* Calculate the Luma/Chroma pattern and non_zero_count */
     h->mb.i_cbp_luma = 0x00;
     if( h->mb.i_type == I_16x16 )
     {
@@ -640,7 +640,7 @@ void x264_macroblock_encode( x264_t *h )
         }
     }
 
-    /* Calculate the chroma patern */
+    /* Calculate the chroma pattern */
     h->mb.i_cbp_chroma = 0x00;
     for( i = 0; i < 8; i++ )
     {
index c1375317bdc9959aab7b0f706662758330ad822f..9e7d66da6465d08c5ba7dbd1a29e9aea4184e605 100644 (file)
 #include "common/cpu.h"
 #include "ratecontrol.h"
 
-#if defined(SYS_FREEBSD) || defined(SYS_BEOS) || defined(SYS_NETBSD) || defined(SYS_OPENBSD)
-#define exp2f(x) powf( 2, (x) )
-#endif
-#if defined(SYS_MACOSX)
-#define exp2f(x) (float)pow( 2, (x) )
-#define sqrtf sqrt
-#endif
 #if defined(SYS_OPENBSD)
 #define isfinite finite
 #endif
 #if defined(_MSC_VER)
 #define isfinite _finite
 #endif
-#if defined(_MSC_VER) || defined(SYS_SunOS)
-#define exp2f(x) pow( 2, (x) )
+#if defined(_MSC_VER) || defined(SYS_SunOS) || defined(SYS_MACOSX)
 #define sqrtf sqrt
 #endif
 #ifdef WIN32 // POSIX says that rename() removes the destination, but win32 doesn't.
@@ -283,7 +275,7 @@ int x264_ratecontrol_new( x264_t *h )
     rc->qp_constant[SLICE_TYPE_I] = x264_clip3( h->param.rc.i_qp_constant - rc->ip_offset + 0.5, 0, 51 );
     rc->qp_constant[SLICE_TYPE_B] = x264_clip3( h->param.rc.i_qp_constant + rc->pb_offset + 0.5, 0, 51 );
 
-    rc->lstep = exp2f(h->param.rc.i_qp_step / 6.0);
+    rc->lstep = pow( 2, h->param.rc.i_qp_step / 6.0 );
     rc->last_qscale = qp2qscale(26);
     for( i = 0; i < 5; i++ )
     {