]> granicus.if.org Git - handbrake/commitdiff
Updates the copy of x264 HandBrake uses to r700, bringing with it, among other goodie...
authorjbrjake <jb.rubin@gmail.com>
Wed, 21 Nov 2007 19:29:29 +0000 (19:29 +0000)
committerjbrjake <jb.rubin@gmail.com>
Wed, 21 Nov 2007 19:29:29 +0000 (19:29 +0000)
NOTE: Contrib packs are not updated. Build with jam, not make, for now.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1075 b64f7644-9d1e-0410-96f1-a4d463321fa5

contrib/patch-x264-aq.patch
contrib/version_x264.txt

index 21e424b82a8c60f155e29d55600e70eabee2e263..ec624ee4d9087682fec24170bdb3d41d037a1856 100644 (file)
-Index: encoder/encoder.c\r
+Index: common/common.c\r
 ===================================================================\r
---- encoder/encoder.c  (revisione 634)\r
-+++ encoder/encoder.c  (copia locale)\r
-@@ -470,6 +470,8 @@\r
-     if( !h->param.b_cabac )
-         h->param.analyse.i_trellis = 0;
-     h->param.analyse.i_trellis = x264_clip3( h->param.analyse.i_trellis, 0, 2 );
-+    if( h->param.analyse.b_aq && h->param.analyse.f_aq_strength <= 0 )
-+        h->param.analyse.b_aq = 0;
-     h->param.analyse.i_noise_reduction = x264_clip3( h->param.analyse.i_noise_reduction, 0, 1<<16 );
+--- common/common.c    (revision 669)\r
++++ common/common.c    (working copy)\r
+@@ -123,6 +123,9 @@\r
+     param->analyse.i_chroma_qp_offset = 0;
+     param->analyse.b_fast_pskip = 1;
+     param->analyse.b_dct_decimate = 1;
++    param->analyse.b_aq = 0;
++    param->analyse.f_aq_strength = 0.0;
++    param->analyse.f_aq_sensitivity = 15;
+     param->analyse.i_luma_deadzone[0] = 21;
+     param->analyse.i_luma_deadzone[1] = 11;
+     param->analyse.b_psnr = 1;
+@@ -455,6 +458,13 @@\r
+         p->analyse.b_fast_pskip = atobool(value);
+     OPT("dct-decimate")
+         p->analyse.b_dct_decimate = atobool(value);
++    OPT("aq-strength")
++    {
++        p->analyse.f_aq_strength = atof(value);
++        p->analyse.b_aq = (p->analyse.f_aq_strength > 0.0);
++    }
++    OPT("aq-sensitivity")
++        p->analyse.f_aq_sensitivity = atof(value);
+     OPT("deadzone-inter")
+         p->analyse.i_luma_deadzone[0] = atoi(value);
+     OPT("deadzone-intra")
+@@ -939,6 +949,9 @@\r
+             s += sprintf( s, " zones" );
+     }
  
++    if( p->analyse.b_aq )
++        s += sprintf( s, " aq=1:%.1f:%.1f", p->analyse.f_aq_strength, p->analyse.f_aq_sensitivity );
++
+     return buf;
+ }
+Index: common/pixel.c\r
+===================================================================\r
+--- common/pixel.c     (revision 669)\r
++++ common/pixel.c     (working copy)\r
+@@ -213,6 +213,14 @@\r
+ PIXEL_SATD_C( x264_pixel_satd_4x8,   4, 8 )
+ PIXEL_SATD_C( x264_pixel_satd_4x4,   4, 4 )
++static int x264_pixel_count_8x8( uint8_t *pix, int i_pix, uint32_t threshold )
++{
++    int x, y, sum = 0;
++    for( y=0; y<8; y++, pix += i_pix )
++        for( x=0; x<8; x++ )
++            sum += pix[x] > (uint8_t)threshold;
++    return sum;
++}
+ /****************************************************************************
+  * pixel_sa8d_WxH: sum of 8x8 Hadamard transformed differences
+@@ -470,6 +478,8 @@\r
+     pixf->ads[PIXEL_16x8] = pixel_ads2;
+     pixf->ads[PIXEL_8x8] = pixel_ads1;
++    pixf->count_8x8 = x264_pixel_count_8x8;
++
+ #ifdef HAVE_MMX
+     if( cpu&X264_CPU_MMX )
      {
+Index: common/pixel.h\r
+===================================================================\r
+--- common/pixel.h     (revision 669)\r
++++ common/pixel.h     (working copy)\r
+@@ -90,6 +90,8 @@\r
+     void (*ads[7])( int enc_dc[4], uint16_t *sums, int delta,
+                     uint16_t *res, int width );
++    int (*count_8x8)( uint8_t *pix, int i_pix, uint32_t threshold );
++
+     /* calculate satd of V, H, and DC modes.
+      * may be NULL, in which case just use pred+satd instead. */
+     void (*intra_satd_x3_16x16)( uint8_t *fenc, uint8_t *fdec, int res[3] );
 Index: encoder/analyse.c\r
 ===================================================================\r
---- encoder/analyse.c  (revisione 634)\r
-+++ encoder/analyse.c  (copia locale)\r
+--- encoder/analyse.c  (revision 669)\r
++++ encoder/analyse.c  (working copy)\r
 @@ -29,6 +29,7 @@\r
- #include <unistd.h>
+ #endif
  
  #include "common/common.h"
 +#include "common/cpu.h"
  #include "macroblock.h"
  #include "me.h"
  #include "ratecontrol.h"
-@@ -2026,8 +2027,73 @@\r
+@@ -2029,8 +2030,68 @@\r
      }
  }
  
-+static void x264_add_dctq(int16_t dct[8][8], int *p_total) {
-+    int     i, t = 0;
++static int x264_sum_dctq( int16_t dct[8][8] )
++{
++    int i, t = 0;
 +    int16_t *p = &dct[0][0];
-+    for (i = 1; i < 64; ++i)
++    for( i=1; i<64; i++ )
 +        t += abs(p[i]) * x264_dct8_weight_tab[i];
-+
-+    *p_total += t;
++    return t;
 +}
-+
  /*****************************************************************************
 + * x264_adaptive_quant:
 + * check if mb is "flat", i.e. has most energy in low frequency components, and
@@ -45,13 +110,13 @@ Index: encoder/analyse.c
 +void x264_adaptive_quant( x264_t *h, x264_mb_analysis_t *a )
 +{
 +    DECLARE_ALIGNED( static uint8_t, zero[FDEC_STRIDE*8], 16 );
++    DECLARE_ALIGNED( int16_t, dct[8][8], 16 );
++    float fc;
++    int total = 0;
++    int qp = h->mb.i_qp, qp_adj;
++    int i;
 +
-+    int16_t dct[8][8];
-+    int     total = 0;
-+    int     i_qp = h->mb.i_qp, i_qp_adj;
-+    float   fc;
-+
-+    if( i_qp <= 10 ) /* AQ is probably not needed at such low QP */
++    if( qp <= 10 ) /* AQ is probably not needed at such low QP */
 +        return;
 +
 +    if( h->pixf.sad[PIXEL_16x16](h->mb.pic.p_fenc[0], FENC_STRIDE, zero, 16) > 64*16*16 )
@@ -65,31 +130,27 @@ Index: encoder/analyse.c
 +            return;
 +    }
 +
-+    h->dctf.sub8x8_dct8( dct, h->mb.pic.p_fenc[0], zero );
-+    x264_add_dctq( dct, &total );
-+    h->dctf.sub8x8_dct8( dct, h->mb.pic.p_fenc[0] + 8, zero );
-+    x264_add_dctq( dct, &total );
-+    h->dctf.sub8x8_dct8( dct, h->mb.pic.p_fenc[0] + 8*FENC_STRIDE, zero );
-+    x264_add_dctq( dct, &total );
-+    h->dctf.sub8x8_dct8( dct, h->mb.pic.p_fenc[0] + 8*FENC_STRIDE + 8, zero );
-+    x264_add_dctq( dct, &total );
++    for( i=0; i<4; i++ )
++    {
++        h->dctf.sub8x8_dct8( dct, h->mb.pic.p_fenc[0] + (i&1)*8 + (i>>1)*FENC_STRIDE, zero );
++        total += x264_sum_dctq( dct );
++    }
 +
-+    if( total == 0 ) /* sum is 0, nothing to do */
++    if( total == 0 ) /* no AC coefficients, nothing to do */
 +        return;
 +
 +    x264_cpu_restore( h->param.cpu );
 +
-+    fc = (float)expf(-5e-13 * total * total);
++    fc = expf(-5e-13 * total * total);
 +
-+    //printf("AQ: %d %.3f\n", total, fc);
 +    /* the function is chosen such that it stays close to 0 in almost all
 +      * range of 0..1, and rapidly goes up to 1 near 1.0 */
-+    i_qp_adj = (int)(i_qp * h->param.analyse.f_aq_strength / pow(2 - fc, h->param.analyse.f_aq_sensitivity));
++    qp_adj = (int)(qp * h->param.analyse.f_aq_strength / pow(2 - fc, h->param.analyse.f_aq_sensitivity));
 +
 +    /* don't adjust by more than this amount */
-+    i_qp_adj = X264_MIN(i_qp_adj, i_qp/2);
++    qp_adj = X264_MIN(qp_adj, qp/2);
 +
-+    h->mb.i_qp = a->i_qp = i_qp - i_qp_adj;
++    h->mb.i_qp = a->i_qp = qp - qp_adj;
 +    h->mb.i_chroma_qp = i_chroma_qp_table[x264_clip3( h->mb.i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
 +}
 +
@@ -97,22 +158,40 @@ Index: encoder/analyse.c
   * x264_macroblock_analyse:
   *****************************************************************************/
  void x264_macroblock_analyse( x264_t *h )
-@@ -2039,6 +2105,10 @@\r
-     /* init analysis */
-     x264_mb_analyse_init( h, &analysis, x264_ratecontrol_qp( h ) );
+@@ -2038,9 +2099,14 @@\r
+     x264_mb_analysis_t analysis;
+     int i_cost = COST_MAX;
+     int i;
++      
++    h->mb.i_qp = x264_ratecontrol_qp( h );
  
-+    /* try to do adaptive quantization */
 +    if( h->param.analyse.b_aq )
-+        x264_adaptive_quant( h, &analysis);
++        x264_adaptive_quant( h, &analysis );
 +
+     /* init analysis */
+-    x264_mb_analyse_init( h, &analysis, x264_ratecontrol_qp( h ) );
++    x264_mb_analyse_init( h, &analysis, h->mb.i_qp );
      /*--------------------------- Do the analysis ---------------------------*/
      if( h->sh.i_type == SLICE_TYPE_I )
+Index: encoder/encoder.c\r
+===================================================================\r
+--- encoder/encoder.c  (revision 669)\r
++++ encoder/encoder.c  (working copy)\r
+@@ -477,6 +477,8 @@\r
+     if( !h->param.b_cabac )
+         h->param.analyse.i_trellis = 0;
+     h->param.analyse.i_trellis = x264_clip3( h->param.analyse.i_trellis, 0, 2 );
++    if( h->param.analyse.b_aq && h->param.analyse.f_aq_strength <= 0 )
++        h->param.analyse.b_aq = 0;
+     h->param.analyse.i_noise_reduction = x264_clip3( h->param.analyse.i_noise_reduction, 0, 1<<16 );
      {
 Index: x264.c\r
 ===================================================================\r
---- x264.c     (revisione 634)\r
-+++ x264.c     (copia locale)\r
-@@ -253,6 +253,12 @@\r
+--- x264.c     (revision 669)\r
++++ x264.c     (working copy)\r
+@@ -243,6 +243,12 @@\r
          "                                  - 2: enabled on all mode decisions\n", defaults->analyse.i_trellis );
      H0( "      --no-fast-pskip         Disables early SKIP detection on P-frames\n" );
      H0( "      --no-dct-decimate       Disables coefficient thresholding on P-frames\n" );
@@ -125,7 +204,7 @@ Index: x264.c
      H0( "      --nr <integer>          Noise reduction [%d]\n", defaults->analyse.i_noise_reduction );
      H1( "\n" );
      H1( "      --deadzone-inter <int>  Set the size of the inter luma quantization deadzone [%d]\n", defaults->analyse.i_luma_deadzone[0] );
-@@ -416,6 +422,8 @@\r
+@@ -406,6 +412,8 @@\r
              { "trellis", required_argument, NULL, 't' },
              { "no-fast-pskip", no_argument, NULL, 0 },
              { "no-dct-decimate", no_argument, NULL, 0 },
@@ -134,100 +213,11 @@ Index: x264.c
              { "deadzone-inter", required_argument, NULL, '0' },
              { "deadzone-intra", required_argument, NULL, '0' },
              { "level",   required_argument, NULL, 0 },
-Index: common/pixel.c\r
-===================================================================\r
---- common/pixel.c     (revisione 634)\r
-+++ common/pixel.c     (copia locale)\r
-@@ -215,7 +215,17 @@\r
- PIXEL_SATD_C( x264_pixel_satd_4x8,   4, 8 )
- PIXEL_SATD_C( x264_pixel_satd_4x4,   4, 4 )
-+static int x264_pixel_count_8x8( uint8_t *pix1, int i_pix1, uint32_t threshold ) 
-+{
-+  int i, j, sum = 0;
-+ 
-+  for ( i = 0; i < 8; ++i, pix1 += i_pix1 )
-+      for ( j = 0; j < 8; ++j )
-+          sum += pix1[j] > (uint8_t)threshold;
-+  return sum;
-+}
-+
- /****************************************************************************
-  * pixel_sa8d_WxH: sum of 8x8 Hadamard transformed differences
-  ****************************************************************************/
-@@ -469,6 +479,8 @@\r
-     pixf->ads[PIXEL_16x16] = pixel_ads4;
-     pixf->ads[PIXEL_16x8] = pixel_ads2;
-     pixf->ads[PIXEL_8x8] = pixel_ads1;
-+    
-+    pixf->count_8x8 = x264_pixel_count_8x8;
- #ifdef HAVE_MMX
-     if( cpu&X264_CPU_MMX )
-Index: common/pixel.h\r
-===================================================================\r
---- common/pixel.h     (revisione 634)\r
-+++ common/pixel.h     (copia locale)\r
-@@ -26,6 +26,7 @@\r
- typedef int  (*x264_pixel_cmp_t) ( uint8_t *, int, uint8_t *, int );
- typedef int  (*x264_pixel_cmp_pde_t) ( uint8_t *, int, uint8_t *, int, int );
-+typedef int  (*x264_pixel_count_t) ( uint8_t *, int, uint32_t );
- typedef void (*x264_pixel_cmp_x3_t) ( uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int[3] );
- typedef void (*x264_pixel_cmp_x4_t) ( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int[4] );
-@@ -84,6 +85,7 @@\r
-     /* multiple parallel calls to sad. */
-     x264_pixel_cmp_x3_t sad_x3[7];
-     x264_pixel_cmp_x4_t sad_x4[7];
-+    x264_pixel_count_t count_8x8;
-     /* abs-diff-sum for successive elimination.
-      * may round width up to a multiple of 8. */
-Index: common/common.c\r
-===================================================================\r
---- common/common.c    (revisione 634)\r
-+++ common/common.c    (copia locale)\r
-@@ -125,6 +125,9 @@\r
-     param->analyse.i_chroma_qp_offset = 0;
-     param->analyse.b_fast_pskip = 1;
-     param->analyse.b_dct_decimate = 1;
-+    param->analyse.b_aq = 0;
-+    param->analyse.f_aq_strength = 0.0;
-+    param->analyse.f_aq_sensitivity = 15;
-     param->analyse.i_luma_deadzone[0] = 21;
-     param->analyse.i_luma_deadzone[1] = 11;
-     param->analyse.b_psnr = 1;
-@@ -457,6 +460,13 @@\r
-         p->analyse.b_fast_pskip = atobool(value);
-     OPT("dct-decimate")
-         p->analyse.b_dct_decimate = atobool(value);
-+    OPT("aq-strength")
-+    {
-+        p->analyse.f_aq_strength = atof(value);
-+        p->analyse.b_aq = (p->analyse.f_aq_strength > 0.0);
-+    }
-+    OPT("aq-sensitivity")
-+        p->analyse.f_aq_sensitivity = atof(value);
-     OPT("deadzone-inter")
-         p->analyse.i_luma_deadzone[0] = atoi(value);
-     OPT("deadzone-intra")
-@@ -936,6 +946,9 @@\r
-             s += sprintf( s, " zones" );
-     }
-+    if( p->analyse.b_aq )
-+        s += sprintf( s, " aq=1:%.1f:%.1f", p->analyse.f_aq_strength, p->analyse.f_aq_sensitivity );
-+
-     return buf;
- }
 Index: x264.h\r
 ===================================================================\r
---- x264.h     (revisione 634)\r
-+++ x264.h     (copia locale)\r
-@@ -223,6 +223,9 @@\r
+--- x264.h     (revision 669)\r
++++ x264.h     (working copy)\r
+@@ -227,6 +227,9 @@\r
          int          i_trellis;  /* trellis RD quantization */
          int          b_fast_pskip; /* early SKIP detection on P-frames */
          int          b_dct_decimate; /* transform coefficient thresholding on P-frames */
index 761d446b9f912093873abb493214a2c5fdc6c5d9..2f859840b59063f8203f3222e5b4231d2e2b508c 100644 (file)
@@ -1 +1 @@
-http://download.m0k.org/handbrake/contrib/x264-r665.tar.gz 
+http://download.m0k.org/handbrake/contrib/x264-r700.tar.gz