[x264-devel] commit: fix lowres padding, which failed to extrapolate the right side for some resolutions. ( Loren Merritt )
git version control
git at videolan.org
Thu Aug 13 23:06:35 CEST 2009
x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Thu Aug 13 05:02:59 2009 +0000| [8eb6720e89f441056948818558113f29b3a282c6] | committer: Loren Merritt
fix lowres padding, which failed to extrapolate the right side for some resolutions.
fix a buffer overread in x264_mbtree_propagate_cost_sse2. no effect on actual behavior, only theoretical correctness.
fix x264_slicetype_frame_cost_recalculate on I-frames, which previously used all 0 mb costs.
shut up a valgrind warning in predict_8x8_filter_mmx.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=8eb6720e89f441056948818558113f29b3a282c6
---
common/frame.c | 16 ++++++++--------
common/macroblock.c | 3 ++-
common/x86/mc-a2.asm | 8 ++++----
encoder/slicetype.c | 2 +-
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/common/frame.c b/common/frame.c
index 1f89275..8e18df9 100644
--- a/common/frame.c
+++ b/common/frame.c
@@ -93,15 +93,15 @@ x264_frame_t *x264_frame_new( x264_t *h )
CHECKED_MALLOCZERO( frame->lowres_mvs[j][i], 2*h->mb.i_mb_count*sizeof(int16_t) );
CHECKED_MALLOC( frame->lowres_mv_costs[j][i], h->mb.i_mb_count*sizeof(int) );
}
- CHECKED_MALLOC( frame->i_intra_cost, i_mb_count * sizeof(uint16_t) );
- memset( frame->i_intra_cost, -1, i_mb_count * sizeof(uint16_t) );
- CHECKED_MALLOC( frame->i_propagate_cost, i_mb_count * sizeof(uint16_t) );
+ CHECKED_MALLOC( frame->i_propagate_cost, (i_mb_count+3) * sizeof(uint16_t) );
for( j = 0; j <= h->param.i_bframe+1; j++ )
for( i = 0; i <= h->param.i_bframe+1; i++ )
{
- CHECKED_MALLOC( frame->lowres_costs[j][i], i_mb_count * sizeof(uint16_t) );
- CHECKED_MALLOC( frame->lowres_inter_types[j][i], i_mb_count * sizeof(uint8_t) );
+ CHECKED_MALLOC( frame->lowres_costs[j][i], (i_mb_count+3) * sizeof(uint16_t) );
+ CHECKED_MALLOC( frame->lowres_inter_types[j][i], (i_mb_count+3) * sizeof(uint8_t) );
}
+ frame->i_intra_cost = frame->lowres_costs[0][0];
+ memset( frame->i_intra_cost, -1, (i_mb_count+3) * sizeof(uint16_t) );
}
if( h->param.analyse.i_me_method >= X264_ME_ESA )
@@ -143,7 +143,8 @@ x264_frame_t *x264_frame_new( x264_t *h )
{
CHECKED_MALLOC( frame->f_qp_offset, h->mb.i_mb_count * sizeof(float) );
if( h->frames.b_have_lowres )
- CHECKED_MALLOC( frame->i_inv_qscale_factor, h->mb.i_mb_count * sizeof(uint16_t) );
+ /* shouldn't really be initialized, just silences a valgrind false-positive in x264_mbtree_propagate_cost_sse2 */
+ CHECKED_MALLOCZERO( frame->i_inv_qscale_factor, (h->mb.i_mb_count+3) * sizeof(uint16_t) );
}
if( x264_pthread_mutex_init( &frame->mutex, NULL ) )
@@ -183,7 +184,6 @@ void x264_frame_delete( x264_frame_t *frame )
}
x264_free( frame->f_qp_offset );
x264_free( frame->i_inv_qscale_factor );
- x264_free( frame->i_intra_cost );
x264_free( frame->i_row_bits );
x264_free( frame->i_row_qp );
x264_free( frame->mb_type );
@@ -312,7 +312,7 @@ void x264_frame_expand_border_lowres( x264_frame_t *frame )
{
int i;
for( i = 0; i < 4; i++ )
- plane_expand_border( frame->lowres[i], frame->i_stride_lowres, frame->i_stride_lowres - 2*PADH, frame->i_lines_lowres, PADH, PADV, 1, 1 );
+ plane_expand_border( frame->lowres[i], frame->i_stride_lowres, frame->i_width_lowres, frame->i_lines_lowres, PADH, PADV, 1, 1 );
}
void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame )
diff --git a/common/macroblock.c b/common/macroblock.c
index 16bb689..0a9f31e 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -702,7 +702,8 @@ int x264_macroblock_cache_init( x264_t *h )
for( i=0; i<=h->param.b_interlaced; i++ )
for( j=0; j<3; j++ )
{
- CHECKED_MALLOC( h->mb.intra_border_backup[i][j], h->fdec->i_stride[j] );
+ /* shouldn't really be initialized, just silences a valgrind false-positive in predict_8x8_filter_mmx */
+ CHECKED_MALLOCZERO( h->mb.intra_border_backup[i][j], h->fdec->i_stride[j] );
h->mb.intra_border_backup[i][j] += 8;
}
diff --git a/common/x86/mc-a2.asm b/common/x86/mc-a2.asm
index e79be5e..245c09f 100644
--- a/common/x86/mc-a2.asm
+++ b/common/x86/mc-a2.asm
@@ -1090,10 +1090,10 @@ FRAME_INIT_LOWRES ssse3, 12
cglobal x264_mbtree_propagate_cost_sse2, 6,6
shl r5d, 1
lea r0, [r0+r5*2]
- lea r1, [r1+r5]
- lea r2, [r2+r5]
- lea r3, [r3+r5]
- lea r4, [r4+r5]
+ add r1, r5
+ add r2, r5
+ add r3, r5
+ add r4, r5
neg r5
pxor xmm5, xmm5
movdqa xmm4, [pd_128 GLOBAL]
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 207995c..2d8c8fd 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -261,7 +261,7 @@ lowres_intra_mb:
}
}
- frames[b]->lowres_costs[b-p0][p1-b][i_mb_xy] = i_bcost;
+ fenc->lowres_costs[b-p0][p1-b][i_mb_xy] = i_bcost;
return i_bcost;
}
More information about the x264-devel
mailing list