Basically reverts af15c17daa5d8d2940c0263ba4d3ecec761c11ee. Flipping a picture by modifying the pointers is so common that even users of direct rendering should take it into account.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/mjpegdec.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 939dedce33..33beda12ea 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2762,28 +2762,18 @@ the_end: } } if (s->flipped && !s->rgb) { - int j; ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); if (ret) return ret; av_assert0(s->nb_components == av_pix_fmt_count_planes(frame->format)); for (index=0; index<s->nb_components; index++) { - uint8_t *dst = frame->data[index]; - int w = frame->width; int h = frame->height; - if(index && index<3){ - w = AV_CEIL_RSHIFT(w, hshift); + if (index && index < 3) h = AV_CEIL_RSHIFT(h, vshift); - } - if(dst){ - uint8_t *dst2 = dst + frame->linesize[index]*(h-1); - for (i=0; i<h/2; i++) { - for (j=0; j<w; j++) - FFSWAP(int, dst[j], dst2[j]); - dst += frame->linesize[index]; - dst2 -= frame->linesize[index]; - } + if (frame->data[index]) { + frame->data[index] += (h - 1) * frame->linesize[index]; + frame->linesize[index] *= -1; } } } -- 2.32.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".