From: Jason Garrett-Glaser Date: Tue, 2 Mar 2010 18:51:15 +0000 (-0800) Subject: Fix regression in r1450 X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=c8900a261508830e74187f379e7666cfc94f638b;p=x264.git Fix regression in r1450 I_PCM blocks would cause x264 to crash or generate bad output. Simplify PCM handling. --- diff --git a/encoder/cabac.c b/encoder/cabac.c index 083b7833..bb60e3b0 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 85d2dde3..9388bdd0 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 c9549ba0..17ab11e0 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]) )