[x264-devel] commit: Fix regression in r1450 (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Sun Mar 28 04:44:18 CEST 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Mar  2 10:51:15 2010 -0800| [c8900a261508830e74187f379e7666cfc94f638b] | committer: Jason Garrett-Glaser 

Fix regression in r1450
I_PCM blocks would cause x264 to crash or generate bad output. Simplify PCM handling.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=c8900a261508830e74187f379e7666cfc94f638b
---

 encoder/cabac.c      |    5 -----
 encoder/cavlc.c      |    5 -----
 encoder/macroblock.c |    9 +++++++++
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/encoder/cabac.c b/encoder/cabac.c
index 083b783..bb60e3b 100644
--- a/encoder/cabac.c
+++ b/encoder/cabac.c
@@ -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;
     }
diff --git a/encoder/cavlc.c b/encoder/cavlc.c
index 85d2dde..9388bdd 100644
--- a/encoder/cavlc.c
+++ b/encoder/cavlc.c
@@ -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;
     }
diff --git a/encoder/macroblock.c b/encoder/macroblock.c
index c9549ba..17ab11e 100644
--- a/encoder/macroblock.c
+++ b/encoder/macroblock.c
@@ -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]) )



More information about the x264-devel mailing list