aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-25 12:35:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-25 13:40:12 +0200
commit5e50a5724bb00c44a98bd89f57c659a613f26ce2 (patch)
treebc1b96cf57dbe00f981df716890c4fef78fd1835 /libavcodec/mjpegdec.c
parentf2c5383620062cb01e10fca2b141e5b0e86f27b8 (diff)
downloadffmpeg-5e50a5724bb00c44a98bd89f57c659a613f26ce2.tar.gz
Revert "removing lowres support"
There have been multiple user complaints about loosing this feature while its not clear the 3% speedloss claims where real or fabricated. My own testing indicates no statistically significant speed difference both with mpeg2 and mpeg4, and if at all the code with lowres support is a tiny bit faster than without. This reverts commit 92ef4be4ab9fbb7d901b22e0036a4ca90b00a476, reversing changes made to 2e07f42957666df6d7c63a62263b8447e97b1442. Conflicts: cmdutils.c libavcodec/arm/vp8dsp_init_arm.c libavcodec/mpegvideo.c libavcodec/mpegvideo.h libavutil/arm/Makefile Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 1e19b0c4ba..a2fe7e39c1 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -940,6 +940,21 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
return 0;
}
+static av_always_inline void mjpeg_copy_block(uint8_t *dst, const uint8_t *src,
+ int linesize, int lowres)
+{
+ switch (lowres) {
+ case 0: copy_block8(dst, src, linesize, linesize, 8);
+ break;
+ case 1: copy_block4(dst, src, linesize, linesize, 4);
+ break;
+ case 2: copy_block2(dst, src, linesize, linesize, 2);
+ break;
+ case 3: *dst = *src;
+ break;
+ }
+}
+
static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
int Al, const uint8_t *mb_bitmask,
const AVFrame *reference)
@@ -1010,8 +1025,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
ptr = data[c] + block_offset;
if (!s->progressive) {
if (copy_mb)
- copy_block8(ptr, reference_data[c] + block_offset,
- linesize[c], linesize[c], 8);
+ mjpeg_copy_block(ptr, reference_data[c] + block_offset,
+ linesize[c], s->avctx->lowres);
else {
s->dsp.clear_block(s->block);
if (decode_block(s, s->block, i,