]> git.videolan.org Git - x264.git/commitdiff
Fix regression in r1450
authorJason Garrett-Glaser <darkshikari@gmail.com>
Tue, 2 Mar 2010 18:51:15 +0000 (10:51 -0800)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Wed, 24 Mar 2010 14:17:11 +0000 (07:17 -0700)
I_PCM blocks would cause x264 to crash or generate bad output. Simplify PCM handling.

encoder/cabac.c
encoder/cavlc.c
encoder/macroblock.c

index 083b78337f2115d3d0db13ac6c7f2612ddce46c0..bb60e3b082a45e48c7c33fe5a31cff6fbd61ea69 100644 (file)
@@ -785,11 +785,6 @@ void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
         cb->i_queue = -1;
         cb->i_bytes_outstanding = 0;
 
-        /* if PCM is chosen, we need to store reconstructed frame data */
-        h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fdec[0], FDEC_STRIDE, h->mb.pic.p_fenc[0], FENC_STRIDE, 16 );
-        h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1], FENC_STRIDE, 8 );
-        h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2], FENC_STRIDE, 8 );
-
         h->stat.frame.i_tex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex;
         return;
     }
index 85d2dde358ee66c5df10650db0b4c12153374dc4..9388bdd0499ff279530e8b83e91cb59799d4fa43 100644 (file)
@@ -323,11 +323,6 @@ void x264_macroblock_write_cavlc( x264_t *h )
         bs_init( s, s->p, s->p_end - s->p );
         s->p_start = p_start;
 
-        /* if PCM is chosen, we need to store reconstructed frame data */
-        h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fdec[0], FDEC_STRIDE, h->mb.pic.p_fenc[0], FENC_STRIDE, 16 );
-        h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1], FENC_STRIDE, 8 );
-        h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2], FENC_STRIDE, 8 );
-
         h->stat.frame.i_tex_bits += bs_pos(s) - i_mb_pos_tex;
         return;
     }
index c9549ba06d93690147815d598d2b92d48d1f291b..17ab11e028cbf9337b3bb1c985a1ca2b8c287d57 100644 (file)
@@ -593,6 +593,15 @@ void x264_macroblock_encode( x264_t *h )
     h->mb.i_cbp_luma = 0;
     h->mb.cache.non_zero_count[x264_scan8[24]] = 0;
 
+    if( h->mb.i_type == I_PCM )
+    {
+        /* if PCM is chosen, we need to store reconstructed frame data */
+        h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fdec[0], FDEC_STRIDE, h->mb.pic.p_fenc[0], FENC_STRIDE, 16 );
+        h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1], FENC_STRIDE, 8 );
+        h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2], FENC_STRIDE, 8 );
+        return;
+    }
+
     if( h->sh.b_mbaff
         && h->mb.i_mb_xy == h->sh.i_first_mb + h->mb.i_mb_stride
         && IS_SKIP(h->mb.type[h->sh.i_first_mb]) )