aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-11 04:20:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-11 04:20:23 +0100
commite161c1bbfce904cd8e6683c4eeaadb634dd4c8e7 (patch)
treef406252a587249838f410a74bd3519b28d0f043d /libavcodec/mjpegdec.c
parente893440a285fbc174b5c91059ce786f498e745a6 (diff)
downloadffmpeg-e161c1bbfce904cd8e6683c4eeaadb634dd4c8e7.tar.gz
avcodec/mjpegdec: support adob transform 2
Fixes Ticket3426 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index ac94345613..2fd371af03 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2092,6 +2092,28 @@ the_end:
}
}
}
+ if (s->adobe_transform == 2 && s->avctx->pix_fmt == AV_PIX_FMT_YUVA444P) {
+ int w = s->picture_ptr->width;
+ int h = s->picture_ptr->height;
+ for (i=0; i<h; i++) {
+ int j;
+ uint8_t *dst[4];
+ for (index=0; index<4; index++) {
+ dst[index] = s->picture_ptr->data[index]
+ + s->picture_ptr->linesize[index]*i;
+ }
+ for (j=0; j<w; j++) {
+ int k = dst[3][j];
+ int r = (255 - dst[0][j]) * k;
+ int g = (128 - dst[1][j]) * k;
+ int b = (128 - dst[2][j]) * k;
+ dst[0][j] = r*257 >> 16;
+ dst[1][j] = (g*257 >> 16) + 128;
+ dst[2][j] = (b*257 >> 16) + 128;
+ dst[3][j] = 255;
+ }
+ }
+ }
if (s->stereo3d) {
AVStereo3D *stereo = av_stereo3d_create_side_data(data);