Advertisement
Guest User

Untitled

a guest
Apr 1st, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 9.93 KB | None | 0 0
  1. From f098398a4069c39639882f5868194991f6c4e786 Mon Sep 17 00:00:00 2001
  2. From: Anton Mitrofanov <BugMaster@narod.ru>
  3. Date: Sun, 1 Apr 2018 14:39:57 +0300
  4. Subject: [PATCH 1/7] squash: x86-64: AVX-512 plane_copy and plane_copy_swap
  5.  
  6. ---
  7. common/frame.c | 11 +++++------
  8.  1 file changed, 5 insertions(+), 6 deletions(-)
  9.  
  10. diff --git a/common/frame.c b/common/frame.c
  11. index c3f906bf..dcd1ec4d 100644
  12. --- a/common/frame.c
  13. +++ b/common/frame.c
  14. @@ -153,9 +153,9 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
  15.      {
  16.          int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12);
  17.          int chroma_plane_size = (frame->i_stride[1] * (frame->i_lines[1] + 2*chroma_padv));
  18. -        PREALLOC( frame->buffer[1], chroma_plane_size * sizeof(pixel) + padh_align );
  19. +        PREALLOC( frame->buffer[1], (chroma_plane_size + padh_align) * sizeof(pixel) );
  20.          if( PARAM_INTERLACED )
  21. -            PREALLOC( frame->buffer_fld[1], chroma_plane_size * sizeof(pixel) + padh_align );
  22. +            PREALLOC( frame->buffer_fld[1], (chroma_plane_size + padh_align) * sizeof(pixel) );
  23.      }
  24.  
  25.      /* all 4 luma planes allocated together, since the cacheline split code
  26. @@ -168,9 +168,9 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
  27.              luma_plane_size *= 4;
  28.  
  29.          /* FIXME: Don't allocate both buffers in non-adaptive MBAFF. */
  30. -        PREALLOC( frame->buffer[p], luma_plane_size * sizeof(pixel) + padh_align );
  31. +        PREALLOC( frame->buffer[p], (luma_plane_size + padh_align) * sizeof(pixel) );
  32.          if( PARAM_INTERLACED )
  33. -            PREALLOC( frame->buffer_fld[p], luma_plane_size * sizeof(pixel) + padh_align );
  34. +            PREALLOC( frame->buffer_fld[p], (luma_plane_size + padh_align) * sizeof(pixel) );
  35.      }
  36.  
  37.      frame->b_duplicate = 0;
  38. @@ -208,7 +208,7 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
  39.          {
  40.              int luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
  41.  
  42. -            PREALLOC( frame->buffer_lowres, 4 * luma_plane_size * sizeof(pixel) + padh_align );
  43. +            PREALLOC( frame->buffer_lowres, (4 * luma_plane_size + padh_align) * sizeof(pixel) );
  44.  
  45.              for( int j = 0; j <= !!h->param.i_bframe; j++ )
  46.                  for( int i = 0; i <= h->param.i_bframe; i++ )
  47. @@ -279,7 +279,6 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
  48.              for( int i = 0; i < 4; i++ )
  49.                  frame->lowres[i] = frame->buffer_lowres + frame->i_stride_lowres * PADV + PADH + padh_align + i * luma_plane_size;
  50.  
  51. -
  52.              for( int j = 0; j <= !!h->param.i_bframe; j++ )
  53.                  for( int i = 0; i <= h->param.i_bframe; i++ )
  54.                      memset( frame->lowres_mvs[j][i], 0, 2*h->mb.i_mb_count*sizeof(int16_t) );
  55. --
  56. 2.13.0.windows.1
  57.  
  58.  
  59. From e5476390f69c7f6fd1f70f7f733f5bd2c41df09a Mon Sep 17 00:00:00 2001
  60. From: Anton Mitrofanov <BugMaster@narod.ru>
  61. Date: Mon, 19 Feb 2018 19:53:38 +0300
  62. Subject: [PATCH 2/7] Fix --qpmax default value in fullhelp
  63.  
  64. ---
  65. x264.c | 2 +-
  66.  1 file changed, 1 insertion(+), 1 deletion(-)
  67.  
  68. diff --git a/x264.c b/x264.c
  69. index abedf214..84e42fbc 100644
  70. --- a/x264.c
  71. +++ b/x264.c
  72. @@ -735,7 +735,7 @@ static void help( x264_param_t *defaults, int longhelp )
  73.      H2( "      --crf-max <float>       With CRF+VBV, limit RF to this value\n"
  74.          "                                  May cause VBV underflows!\n" );
  75.      H2( "      --qpmin <integer>       Set min QP [%d]\n", defaults->rc.i_qp_min );
  76. -    H2( "      --qpmax <integer>       Set max QP [%d]\n", defaults->rc.i_qp_max );
  77. +    H2( "      --qpmax <integer>       Set max QP [%d]\n", X264_MIN( defaults->rc.i_qp_max, QP_MAX ) );
  78.      H2( "      --qpstep <integer>      Set max QP step [%d]\n", defaults->rc.i_qp_step );
  79.      H2( "      --ratetol <float>       Tolerance of ABR ratecontrol and VBV [%.1f]\n", defaults->rc.f_rate_tolerance );
  80.      H2( "      --ipratio <float>       QP factor between I and P [%.2f]\n", defaults->rc.f_ip_factor );
  81. --
  82. 2.13.0.windows.1
  83.  
  84.  
  85. From 56ed4446257ca5ef170462b72723c6ce5899dcb1 Mon Sep 17 00:00:00 2001
  86. From: Anton Mitrofanov <BugMaster@narod.ru>
  87. Date: Sun, 1 Apr 2018 17:42:46 +0300
  88. Subject: [PATCH 3/7] configure: Fix ambiguous "$(("
  89.  
  90. ---
  91. configure | 2 +-
  92.  1 file changed, 1 insertion(+), 1 deletion(-)
  93.  
  94. diff --git a/configure b/configure
  95. index 524053bd..d0770e83 100755
  96. --- a/configure
  97. +++ b/configure
  98. @@ -919,7 +919,7 @@ fi
  99.  
  100.  if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
  101.      if ! as_check "vmovdqa32 [eax]{k1}{z}, zmm0" ; then
  102. -        VER="$(($AS --version || echo no assembler) 2>/dev/null | head -n 1)"
  103. +        VER="$( ($AS --version || echo no assembler) 2>/dev/null | head -n 1 )"
  104.          echo "Found $VER"
  105.          echo "Minimum version is nasm-2.13"
  106.          echo "If you really want to compile without asm, configure with --disable-asm."
  107. --
  108. 2.13.0.windows.1
  109.  
  110.  
  111. From 6d29c80b7fef1b6194a83479610206f9178ca8e0 Mon Sep 17 00:00:00 2001
  112. From: Anton Mitrofanov <BugMaster@narod.ru>
  113. Date: Sun, 1 Apr 2018 17:52:47 +0300
  114. Subject: [PATCH 4/7] Fix theoretically incorrect cost_mv_fpel free
  115.  
  116. ---
  117. encoder/analyse.c | 6 ++++--
  118.  1 file changed, 4 insertions(+), 2 deletions(-)
  119.  
  120. diff --git a/encoder/analyse.c b/encoder/analyse.c
  121. index 37758261..9a743602 100644
  122. --- a/encoder/analyse.c
  123. +++ b/encoder/analyse.c
  124. @@ -208,9 +208,11 @@ void x264_analyse_free_costs( x264_t *h )
  125.      {
  126.          if( h->cost_mv[i] )
  127.              x264_free( h->cost_mv[i] - 2*4*mv_range );
  128. -        if( h->cost_mv_fpel[i][0] )
  129. -            for( int j = 0; j < 4; j++ )
  130. +        for( int j = 0; j < 4; j++ )
  131. +        {
  132. +            if( h->cost_mv_fpel[i][j] )
  133.                  x264_free( h->cost_mv_fpel[i][j] - 2*mv_range );
  134. +        }
  135.      }
  136.  }
  137.  
  138. --
  139. 2.13.0.windows.1
  140.  
  141.  
  142. From 6af21f15e9962b96ace5eb75eab88e8b5bdf8d3e Mon Sep 17 00:00:00 2001
  143. From: Anton Mitrofanov <BugMaster@narod.ru>
  144. Date: Sun, 1 Apr 2018 20:34:18 +0300
  145. Subject: [PATCH 5/7] Make bs_align_10 imply bs_flush same as bs_align_0 and
  146.  bs_align_1
  147.  
  148. ---
  149. common/bitstream.h | 1 +
  150.  encoder/set.c      | 6 ------
  151.  2 files changed, 1 insertion(+), 6 deletions(-)
  152.  
  153. diff --git a/common/bitstream.h b/common/bitstream.h
  154. index a9ae4479..40ecc7ad 100644
  155. --- a/common/bitstream.h
  156. +++ b/common/bitstream.h
  157. @@ -188,6 +188,7 @@ static inline void bs_align_10( bs_t *s )
  158.  {
  159.      if( s->i_left&7 )
  160.          bs_write( s, s->i_left&7, 1 << ( (s->i_left&7) - 1 ) );
  161. +    bs_flush( s );
  162.  }
  163.  
  164.  /* golomb functions */
  165. diff --git a/encoder/set.c b/encoder/set.c
  166. index f8b786a7..628518a6 100644
  167. --- a/encoder/set.c
  168. +++ b/encoder/set.c
  169. @@ -548,7 +548,6 @@ void x264_sei_recovery_point_write( x264_t *h, bs_t *s, int recovery_frame_cnt )
  170.      bs_write( &q, 2, 0 ); //changing_slice_group 0
  171.  
  172.      bs_align_10( &q );
  173. -    bs_flush( &q );
  174.  
  175.      x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_RECOVERY_POINT );
  176.  }
  177. @@ -603,7 +602,6 @@ void x264_sei_buffering_period_write( x264_t *h, bs_t *s )
  178.      }
  179.  
  180.      bs_align_10( &q );
  181. -    bs_flush( &q );
  182.  
  183.      x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_BUFFERING_PERIOD );
  184.  }
  185. @@ -635,7 +633,6 @@ void x264_sei_pic_timing_write( x264_t *h, bs_t *s )
  186.      }
  187.  
  188.      bs_align_10( &q );
  189. -    bs_flush( &q );
  190.  
  191.      x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_PIC_TIMING );
  192.  }
  193. @@ -678,7 +675,6 @@ void x264_sei_frame_packing_write( x264_t *h, bs_t *s )
  194.      bs_write1( &q, 0 );                           // frame_packing_arrangement_extension_flag
  195.  
  196.      bs_align_10( &q );
  197. -    bs_flush( &q );
  198.  
  199.      x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_FRAME_PACKING );
  200.  }
  201. @@ -695,7 +691,6 @@ void x264_sei_alternative_transfer_write( x264_t *h, bs_t *s )
  202.      bs_write ( &q, 8, h->param.i_alternative_transfer ); // preferred_transfer_characteristics
  203.  
  204.      bs_align_10( &q );
  205. -    bs_flush( &q );
  206.  
  207.      x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_ALTERNATIVE_TRANSFER );
  208.  }
  209. @@ -739,7 +734,6 @@ void x264_sei_dec_ref_pic_marking_write( x264_t *h, bs_t *s )
  210.      }
  211.  
  212.      bs_align_10( &q );
  213. -    bs_flush( &q );
  214.  
  215.      x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_DEC_REF_PIC_MARKING );
  216.  }
  217. --
  218. 2.13.0.windows.1
  219.  
  220.  
  221. From 1f337eff2cfca8f0c3d8ab8dbfa3ce1b533cc8e0 Mon Sep 17 00:00:00 2001
  222. From: Anton Mitrofanov <BugMaster@narod.ru>
  223. Date: Sun, 1 Apr 2018 20:39:30 +0300
  224. Subject: [PATCH 6/7] Fix possible undefined behavior of right shift with
  225.  32-bit uintptr_t
  226.  
  227. ---
  228. common/bitstream.h | 9 +++++++--
  229.  1 file changed, 7 insertions(+), 2 deletions(-)
  230.  
  231. diff --git a/common/bitstream.h b/common/bitstream.h
  232. index 40ecc7ad..36698089 100644
  233. --- a/common/bitstream.h
  234. +++ b/common/bitstream.h
  235. @@ -89,8 +89,13 @@ static inline void bs_init( bs_t *s, void *p_data, int i_data )
  236.      s->p       = s->p_start = (uint8_t*)p_data - offset;
  237.      s->p_end   = (uint8_t*)p_data + i_data;
  238.      s->i_left  = (WORD_SIZE - offset)*8;
  239. -    s->cur_bits = endian_fix32( M32(s->p) );
  240. -    s->cur_bits >>= (4-offset)*8;
  241. +    if( offset )
  242. +    {
  243. +        s->cur_bits = endian_fix32( M32(s->p) );
  244. +        s->cur_bits >>= (4-offset)*8;
  245. +    }
  246. +    else
  247. +        s->cur_bits = 0;
  248.  }
  249.  static inline int bs_pos( bs_t *s )
  250.  {
  251. --
  252. 2.13.0.windows.1
  253.  
  254.  
  255. From fcced4f78810dae6ac5195de3ff546a0b022477f Mon Sep 17 00:00:00 2001
  256. From: Anton Mitrofanov <BugMaster@narod.ru>
  257. Date: Sun, 1 Apr 2018 20:49:29 +0300
  258. Subject: [PATCH 7/7] Fix missing bs_flush in AUD writing
  259.  
  260. ---
  261. encoder/encoder.c | 1 +
  262.  1 file changed, 1 insertion(+)
  263.  
  264. diff --git a/encoder/encoder.c b/encoder/encoder.c
  265. index b581d9e2..0dee4832 100644
  266. --- a/encoder/encoder.c
  267. +++ b/encoder/encoder.c
  268. @@ -3512,6 +3512,7 @@ int     x264_encoder_encode( x264_t *h,
  269.          nal_start( h, NAL_AUD, NAL_PRIORITY_DISPOSABLE );
  270.          bs_write( &h->out.bs, 3, pic_type );
  271.          bs_rbsp_trailing( &h->out.bs );
  272. +        bs_flush( &h->out.bs );
  273.          if( nal_end( h ) )
  274.              return -1;
  275.          overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
  276. --
  277. 2.13.0.windows.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement