]> granicus.if.org Git - libx264/commitdiff
Fix two bugs in 4:4:4 chroma weightp analysis
authorHenrik Gramner <hengar-6@student.ltu.se>
Sun, 7 Aug 2011 09:58:36 +0000 (11:58 +0200)
committerFiona Glaser <fiona@x264.com>
Tue, 9 Aug 2011 21:17:13 +0000 (14:17 -0700)
Caused slightly worse compression.

encoder/slicetype.c

index 72e26cf61dd90d9f77abcb313af10bd9716a5e16..111dfcab69cf2127024e70edeadb2336394ebf6e 100644 (file)
@@ -273,7 +273,7 @@ static NOINLINE unsigned int x264_weight_cost_chroma444( x264_t *h, x264_frame_t
     else
         for( int y = 0; y < i_lines; y += 16, pixoff = y*i_stride )
             for( int x = 0; x < i_width; x += 16, pixoff += 16 )
-                cost += h->pixf.mbcmp[PIXEL_16x16]( &ref[pixoff], 16, &src[pixoff], i_stride );
+                cost += h->pixf.mbcmp[PIXEL_16x16]( &ref[pixoff], i_stride, &src[pixoff], i_stride );
     x264_emms();
     return cost;
 }
@@ -340,7 +340,10 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
         else
         {
             if( CHROMA444 )
+            {
                 mcbuf = x264_weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane );
+                origscore = minscore = x264_weight_cost_chroma444( h, fenc, mcbuf, NULL, plane );
+            }
             else
             {
                 pixel *dstu = h->mb.p_weight_buf[0];
@@ -349,8 +352,8 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
                 if( plane == 1 )
                     x264_weight_cost_init_chroma( h, fenc, ref, dstu, dstv );
                 mcbuf = plane == 1 ? dstu : dstv;
+                origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL );
             }
-            origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL );
         }
 
         if( !minscore )