Commit 85407c7e authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpegvideo: Fix edge emu buffer overlap with interlaced mpeg4

Fixes Ticket5936
Regression since c5fc8ae1Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 52da3f6f
...@@ -76,7 +76,7 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ...@@ -76,7 +76,7 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
// at uvlinesize. It supports only YUV420 so 24x24 is enough // at uvlinesize. It supports only YUV420 so 24x24 is enough
// linesize * interlaced * MBsize // linesize * interlaced * MBsize
// we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines // we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, 4 * 68, FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, 4 * 70,
fail); fail);
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, me->scratchpad, alloc_size, 4 * 16 * 2, FF_ALLOCZ_ARRAY_OR_GOTO(avctx, me->scratchpad, alloc_size, 4 * 16 * 2,
......
...@@ -2116,7 +2116,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ...@@ -2116,7 +2116,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
ptr_y = s->sc.edge_emu_buffer; ptr_y = s->sc.edge_emu_buffer;
if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize; uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize;
uint8_t *vbuf =ubuf + 9 * s->uvlinesize; uint8_t *vbuf =ubuf + 10 * s->uvlinesize;
s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
uvlinesize >> field_based, uvlinesize >> field_based, uvlinesize >> field_based, uvlinesize >> field_based,
9, 9 + field_based, 9, 9 + field_based,
......
...@@ -2276,7 +2276,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, ...@@ -2276,7 +2276,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
(mb_y * mb_block_height * wrap_c) + mb_x * mb_block_width; (mb_y * mb_block_height * wrap_c) + mb_x * mb_block_width;
if((mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) && s->codec_id != AV_CODEC_ID_AMV){ if((mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) && s->codec_id != AV_CODEC_ID_AMV){
uint8_t *ebuf = s->sc.edge_emu_buffer + 36 * wrap_y; uint8_t *ebuf = s->sc.edge_emu_buffer + 38 * wrap_y;
int cw = (s->width + s->chroma_x_shift) >> s->chroma_x_shift; int cw = (s->width + s->chroma_x_shift) >> s->chroma_x_shift;
int ch = (s->height + s->chroma_y_shift) >> s->chroma_y_shift; int ch = (s->height + s->chroma_y_shift) >> s->chroma_y_shift;
s->vdsp.emulated_edge_mc(ebuf, ptr_y, s->vdsp.emulated_edge_mc(ebuf, ptr_y,
......
...@@ -326,7 +326,7 @@ void mpeg_motion_internal(MpegEncContext *s, ...@@ -326,7 +326,7 @@ void mpeg_motion_internal(MpegEncContext *s,
ptr_y = s->sc.edge_emu_buffer; ptr_y = s->sc.edge_emu_buffer;
if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize; uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize;
uint8_t *vbuf = ubuf + 9 * s->uvlinesize; uint8_t *vbuf = ubuf + 10 * s->uvlinesize;
uvsrc_y = (unsigned)uvsrc_y << field_based; uvsrc_y = (unsigned)uvsrc_y << field_based;
s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
s->uvlinesize, s->uvlinesize, s->uvlinesize, s->uvlinesize,
...@@ -549,7 +549,7 @@ static inline void qpel_motion(MpegEncContext *s, ...@@ -549,7 +549,7 @@ static inline void qpel_motion(MpegEncContext *s,
ptr_y = s->sc.edge_emu_buffer; ptr_y = s->sc.edge_emu_buffer;
if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize; uint8_t *ubuf = s->sc.edge_emu_buffer + 18 * s->linesize;
uint8_t *vbuf = ubuf + 9 * s->uvlinesize; uint8_t *vbuf = ubuf + 10 * s->uvlinesize;
s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
s->uvlinesize, s->uvlinesize, s->uvlinesize, s->uvlinesize,
9, 9 + field_based, 9, 9 + field_based,
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 66 #define LIBAVCODEC_VERSION_MINOR 66
#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_MICRO 104
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment