[x264-devel] [Git][videolan/x264][master] 5 commits: Fix file encoding from Windows-1252 to UTF-8

Anton Mitrofanov gitlab at videolan.org
Wed Jun 10 20:15:40 CEST 2020



Anton Mitrofanov pushed to branch master at VideoLAN / x264


Commits:
829f625c by Anton Mitrofanov at 2020-04-26T00:20:07+03:00
Fix file encoding from Windows-1252 to UTF-8

- - - - -
526b6b54 by Anton Mitrofanov at 2020-06-10T18:06:45+03:00
Remove use of non-breaking spaces

- - - - -
538f09b5 by Anton Mitrofanov at 2020-06-10T18:07:03+03:00
Fix undefined behavior: index out of bounds (one more)

last_non_b_pict_type is initialized to -1.
Bug report by Vitaly Buka.

- - - - -
6b28e585 by Anton Mitrofanov at 2020-06-10T18:07:03+03:00
Fix data race

Closes videolan/x264#16.
Bug report by Zu-Ming Jiang.

- - - - -
32a7ee1c by Anton Mitrofanov at 2020-06-10T18:07:03+03:00
checkasm: increase float error margin to 1e-5

checkasm10 with seed=511142008 failed on win32 gcc builds.

- - - - -


6 changed files:

- common/arm/dct-a.S
- common/frame.c
- common/frame.h
- encoder/analyse.c
- encoder/ratecontrol.c
- tools/checkasm.c


Changes:

=====================================
common/arm/dct-a.S
=====================================
@@ -725,15 +725,15 @@ function sub8x16_dct_dc_neon
     vadd.s16        q3,  q3,  q15
     vsub.s16        d17, d0,  d1  @ b4
     vadd.s16        d18, d2,  d3  @ b1
-    vsub.s16        d19, d2,  d3  @ b5
+    vsub.s16        d19, d2,  d3  @ b5
     vadd.s16        d20, d4,  d5  @ b2
-    vsub.s16        d21, d4,  d5  @ b6
+    vsub.s16        d21, d4,  d5  @ b6
     vadd.s16        d22, d6,  d7  @ b3
-    vsub.s16        d23, d6,  d7  @ b7
+    vsub.s16        d23, d6,  d7  @ b7
     vadd.s16        q0,  q8,  q9  @ b0 + b1, b4 + b5; a0, a2
-    vsub.s16        q1,  q8,  q9  @ b0 - b1, b4 - b5; a4, a6
+    vsub.s16        q1,  q8,  q9  @ b0 - b1, b4 - b5; a4, a6
     vadd.s16        q2,  q10, q11 @ b2 + b3, b6 + b7; a1, a3
-    vsub.s16        q3,  q10, q11 @ b2 - b3, b6 - b7; a5, a7
+    vsub.s16        q3,  q10, q11 @ b2 - b3, b6 - b7; a5, a7
 
     vadd.s16        q8,  q0,  q2  @ a0 + a1, a2 + a3
     vsub.s16        q9,  q0,  q2  @ a0 - a1, a2 - a3


=====================================
common/frame.c
=====================================
@@ -685,12 +685,14 @@ void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed )
     x264_pthread_mutex_unlock( &frame->mutex );
 }
 
-void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed )
+int x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed )
 {
+    int completed;
     x264_pthread_mutex_lock( &frame->mutex );
-    while( frame->i_lines_completed < i_lines_completed )
+    while( (completed = frame->i_lines_completed) < i_lines_completed && i_lines_completed >= 0 )
         x264_pthread_cond_wait( &frame->cv, &frame->mutex );
     x264_pthread_mutex_unlock( &frame->mutex );
+    return completed;
 }
 
 void x264_threadslice_cond_broadcast( x264_t *h, int pass )


=====================================
common/frame.h
=====================================
@@ -251,7 +251,7 @@ void          x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int
 #define x264_frame_cond_broadcast x264_template(frame_cond_broadcast)
 void          x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed );
 #define x264_frame_cond_wait x264_template(frame_cond_wait)
-void          x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed );
+int           x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed );
 #define x264_frame_new_slice x264_template(frame_new_slice)
 int           x264_frame_new_slice( x264_t *h, x264_frame_t *frame );
 


=====================================
encoder/analyse.c
=====================================
@@ -359,8 +359,8 @@ static void mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp )
                 for( int i = (h->sh.i_type == SLICE_TYPE_B); i >= 0; i-- )
                     for( int j = 0; j < h->i_ref[i]; j++ )
                     {
-                        x264_frame_cond_wait( h->fref[i][j]->orig, thresh );
-                        thread_mvy_range = X264_MIN( thread_mvy_range, h->fref[i][j]->orig->i_lines_completed - pix_y );
+                        int completed = x264_frame_cond_wait( h->fref[i][j]->orig, thresh );
+                        thread_mvy_range = X264_MIN( thread_mvy_range, completed - pix_y );
                     }
 
                 if( h->param.b_deterministic )
@@ -3869,7 +3869,7 @@ static void analyse_update_cache( x264_t *h, x264_mb_analysis_t *a  )
             int ref = h->mb.cache.ref[l][x264_scan8[0]];
             if( ref < 0 )
                 continue;
-            completed = h->fref[l][ ref >> MB_INTERLACED ]->orig->i_lines_completed;
+            completed = x264_frame_cond_wait( h->fref[l][ ref >> MB_INTERLACED ]->orig, -1 );
             if( (h->mb.cache.mv[l][x264_scan8[15]][1] >> (2 - MB_INTERLACED)) + h->mb.i_mb_y*16 > completed )
             {
                 x264_log( h, X264_LOG_WARNING, "internal error (MV out of thread range)\n");


=====================================
encoder/ratecontrol.c
=====================================
@@ -7,7 +7,7 @@
  *          Michael Niedermayer <michaelni at gmx.at>
  *          Gabriel Bouvigne <gabriel.bouvigne at joost.com>
  *          Fiona Glaser <fiona at x264.com>
- *          Mns Rullgrd <mru at mru.ath.cx>
+ *          Måns Rullgård <mru at mru.ath.cx>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -2030,8 +2030,6 @@ static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q,
     x264_zone_t *zone = get_zone( h, frame_num );
 
     // force I/B quants as a function of P quants
-    const double last_p_q    = rcc->last_qscale_for[SLICE_TYPE_P];
-    const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
     if( pict_type == SLICE_TYPE_I )
     {
         double iq = q;
@@ -2050,7 +2048,7 @@ static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q,
     else if( pict_type == SLICE_TYPE_B )
     {
         if( h->param.rc.f_pb_factor > 0 )
-            q = last_non_b_q;
+            q = rcc->last_qscale_for[rcc->last_non_b_pict_type];
         if( !rce->kept_as_ref )
             q *= fabs( h->param.rc.f_pb_factor );
     }
@@ -2058,7 +2056,7 @@ static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q,
              && rcc->last_non_b_pict_type == SLICE_TYPE_P
              && rce->tex_bits == 0 )
     {
-        q = last_p_q;
+        q = rcc->last_qscale_for[SLICE_TYPE_P];
     }
 
     /* last qscale / qdiff stuff */


=====================================
tools/checkasm.c
=====================================
@@ -780,7 +780,7 @@ static int check_pixel( uint32_t cpu_ref, uint32_t cpu_new )
         x264_emms();
         res_c = x264_pixel_ssim_wxh( &pixel_c,   pbuf1+2, 32, pbuf2+2, 32, 32, 28, pbuf3, &cnt );
         res_a = x264_pixel_ssim_wxh( &pixel_asm, pbuf1+2, 32, pbuf2+2, 32, 32, 28, pbuf3, &cnt );
-        if( fabs( res_c - res_a ) > 1e-6 )
+        if( fabs( res_c - res_a ) > 1e-5 )
         {
             ok = 0;
             fprintf( stderr, "ssim: %.7f != %.7f [FAILED]\n", res_c, res_a );



View it on GitLab: https://code.videolan.org/videolan/x264/-/compare/33f9e1474613f59392be5ab6a7e7abf60fa63622...32a7ee1ccc56b0bd98b13d91b49951b84d934d27

-- 
View it on GitLab: https://code.videolan.org/videolan/x264/-/compare/33f9e1474613f59392be5ab6a7e7abf60fa63622...32a7ee1ccc56b0bd98b13d91b49951b84d934d27
You're receiving this email because of your account on code.videolan.org.




More information about the x264-devel mailing list