[FFmpeg-devel] [PATCH] avcodec/mjpegenc_common: always store JFIF, idependent of the aspect ratio
Michael Niedermayer
michaelni at gmx.at
Tue Jul 15 16:31:25 CEST 2014
Found-by: kriegero1
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/mjpegenc_common.c | 20 ++++++++++++--------
tests/ref/lavf/jpg | 4 ++--
tests/ref/lavf/smjpeg | 4 ++--
tests/ref/vsynth/vsynth1-ljpeg | 4 ++--
tests/ref/vsynth/vsynth1-mjpeg-422 | 4 ++--
tests/ref/vsynth/vsynth1-mjpeg-444 | 4 ++--
tests/ref/vsynth/vsynth2-ljpeg | 4 ++--
tests/ref/vsynth/vsynth2-mjpeg | 4 ++--
tests/ref/vsynth/vsynth2-mjpeg-422 | 4 ++--
tests/ref/vsynth/vsynth2-mjpeg-444 | 4 ++--
tests/ref/vsynth/vsynth3-ljpeg | 4 ++--
tests/ref/vsynth/vsynth3-mjpeg | 4 ++--
tests/ref/vsynth/vsynth3-mjpeg-422 | 4 ++--
tests/ref/vsynth/vsynth3-mjpeg-444 | 4 ++--
14 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 8a5b99f..8e77270 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -116,19 +116,23 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
int size;
uint8_t *ptr;
+ /* JFIF header */
+ put_marker(p, APP0);
+ put_bits(p, 16, 16);
+ avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
+ put_bits(p, 16, 0x0102); /* v 1.02 */
+ put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
- /* JFIF header */
- put_marker(p, APP0);
- put_bits(p, 16, 16);
- avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
- put_bits(p, 16, 0x0102); /* v 1.02 */
- put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
put_bits(p, 16, avctx->sample_aspect_ratio.num);
put_bits(p, 16, avctx->sample_aspect_ratio.den);
- put_bits(p, 8, 0); /* thumbnail width */
- put_bits(p, 8, 0); /* thumbnail height */
+ } else {
+ put_bits(p, 16, 1);
+ put_bits(p, 16, 1);
}
+ put_bits(p, 8, 0); /* thumbnail width */
+ put_bits(p, 8, 0); /* thumbnail height */
+
/* comment */
if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
put_marker(p, COM);
diff --git a/tests/ref/lavf/jpg b/tests/ref/lavf/jpg
index 1309d74..2408a4c 100644
--- a/tests/ref/lavf/jpg
+++ b/tests/ref/lavf/jpg
@@ -1,3 +1,3 @@
-131878fee153a086d740543fbf2ab359 *./tests/data/images/jpg/02.jpg
+62ed0e74593827412d23cfdb8de60f8e *./tests/data/images/jpg/02.jpg
./tests/data/images/jpg/%02d.jpg CRC=0xe3509f33
-28406 ./tests/data/images/jpg/02.jpg
+28424 ./tests/data/images/jpg/02.jpg
diff --git a/tests/ref/lavf/smjpeg b/tests/ref/lavf/smjpeg
index a2eeb97..b2f9935 100644
--- a/tests/ref/lavf/smjpeg
+++ b/tests/ref/lavf/smjpeg
@@ -1,3 +1,3 @@
-a95982a2d390f4dcdc72a41d8920abb9 *./tests/data/lavf/lavf.smjpeg
-789551 ./tests/data/lavf/lavf.smjpeg
+ddee43a84eff0498651812d7c5ce2157 *./tests/data/lavf/lavf.smjpeg
+790001 ./tests/data/lavf/lavf.smjpeg
./tests/data/lavf/lavf.smjpeg CRC=0x54bf6147
diff --git a/tests/ref/vsynth/vsynth1-ljpeg b/tests/ref/vsynth/vsynth1-ljpeg
index 99bfade..d54fb9d 100644
--- a/tests/ref/vsynth/vsynth1-ljpeg
+++ b/tests/ref/vsynth/vsynth1-ljpeg
@@ -1,4 +1,4 @@
-24d72a5b4c0d3a49a30098369d56b1cc *tests/data/fate/vsynth1-ljpeg.avi
-6309478 tests/data/fate/vsynth1-ljpeg.avi
+be8db1648a32da470f9001321b8a357e *tests/data/fate/vsynth1-ljpeg.avi
+6310378 tests/data/fate/vsynth1-ljpeg.avi
c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ljpeg.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-422 b/tests/ref/vsynth/vsynth1-mjpeg-422
index 3356dd3..f412018 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-422
+++ b/tests/ref/vsynth/vsynth1-mjpeg-422
@@ -1,4 +1,4 @@
-bcd2370d76f32b9eed7842685a04f29f *tests/data/fate/vsynth1-mjpeg-422.avi
-1756300 tests/data/fate/vsynth1-mjpeg-422.avi
+28e18bf36dfba82b2ebfe3f72699457c *tests/data/fate/vsynth1-mjpeg-422.avi
+1757200 tests/data/fate/vsynth1-mjpeg-422.avi
c35eea486c6d72050f4848eab64032b5 *tests/data/fate/vsynth1-mjpeg-422.out.rawvideo
stddev: 7.45 PSNR: 30.69 MAXDIFF: 63 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-444 b/tests/ref/vsynth/vsynth1-mjpeg-444
index 5ebf895..78d3ff8 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-444
+++ b/tests/ref/vsynth/vsynth1-mjpeg-444
@@ -1,4 +1,4 @@
-f611f316df9b6890d6dcd3379691c36e *tests/data/fate/vsynth1-mjpeg-444.avi
-1989780 tests/data/fate/vsynth1-mjpeg-444.avi
+74ca2a9ce00a7e3d7edbe6393344c281 *tests/data/fate/vsynth1-mjpeg-444.avi
+1990680 tests/data/fate/vsynth1-mjpeg-444.avi
313a4a76af13d5879ea4910107b7ea74 *tests/data/fate/vsynth1-mjpeg-444.out.rawvideo
stddev: 7.37 PSNR: 30.77 MAXDIFF: 63 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-ljpeg b/tests/ref/vsynth/vsynth2-ljpeg
index b59923e..118bc1c 100644
--- a/tests/ref/vsynth/vsynth2-ljpeg
+++ b/tests/ref/vsynth/vsynth2-ljpeg
@@ -1,4 +1,4 @@
-234a0e54d00829513bdc92fc580b2598 *tests/data/fate/vsynth2-ljpeg.avi
-4763454 tests/data/fate/vsynth2-ljpeg.avi
+6db0a86afd9e9697661b75a8f2364ffd *tests/data/fate/vsynth2-ljpeg.avi
+4764354 tests/data/fate/vsynth2-ljpeg.avi
dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-ljpeg.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg b/tests/ref/vsynth/vsynth2-mjpeg
index eaabc73..1c68ede 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg
+++ b/tests/ref/vsynth/vsynth2-mjpeg
@@ -1,4 +1,4 @@
-a3c1f9f7887b726bab17dbafa5debdca *tests/data/fate/vsynth2-mjpeg.avi
-673174 tests/data/fate/vsynth2-mjpeg.avi
+91973ff72277dd7db66cd3c27e19e24c *tests/data/fate/vsynth2-mjpeg.avi
+674074 tests/data/fate/vsynth2-mjpeg.avi
9d4bd90e9abfa18192383b4adc23c8d4 *tests/data/fate/vsynth2-mjpeg.out.rawvideo
stddev: 4.32 PSNR: 35.40 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-422 b/tests/ref/vsynth/vsynth2-mjpeg-422
index 61d2997..4e8fcab 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-422
+++ b/tests/ref/vsynth/vsynth2-mjpeg-422
@@ -1,4 +1,4 @@
-ebf2e0f17a75119ff86b15e721d16a76 *tests/data/fate/vsynth2-mjpeg-422.avi
-746530 tests/data/fate/vsynth2-mjpeg-422.avi
+d516c74296d26c306f47968964495884 *tests/data/fate/vsynth2-mjpeg-422.avi
+747430 tests/data/fate/vsynth2-mjpeg-422.avi
451ac80989c4e14445cf951fd7f83b6d *tests/data/fate/vsynth2-mjpeg-422.out.rawvideo
stddev: 4.18 PSNR: 35.70 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-444 b/tests/ref/vsynth/vsynth2-mjpeg-444
index ae01a35..4dd30eb 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-444
+++ b/tests/ref/vsynth/vsynth2-mjpeg-444
@@ -1,4 +1,4 @@
-7674eb1aedaad0976c60329f556440d1 *tests/data/fate/vsynth2-mjpeg-444.avi
-851442 tests/data/fate/vsynth2-mjpeg-444.avi
+f1fe47cf5f47d408af083d42d6710798 *tests/data/fate/vsynth2-mjpeg-444.avi
+852342 tests/data/fate/vsynth2-mjpeg-444.avi
34edcb9c87ff7aac456a4fb07f43504b *tests/data/fate/vsynth2-mjpeg-444.out.rawvideo
stddev: 4.05 PSNR: 35.96 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth3-ljpeg b/tests/ref/vsynth/vsynth3-ljpeg
index 47db0c1..4f9896d 100644
--- a/tests/ref/vsynth/vsynth3-ljpeg
+++ b/tests/ref/vsynth/vsynth3-ljpeg
@@ -1,4 +1,4 @@
-39cd774ffe47c804f2f58d5bbcf7b0a5 *tests/data/fate/vsynth3-ljpeg.avi
-105840 tests/data/fate/vsynth3-ljpeg.avi
+6c709321886c4db4a1b90c29fd91d83a *tests/data/fate/vsynth3-ljpeg.avi
+106740 tests/data/fate/vsynth3-ljpeg.avi
a038ad7c3c09f776304ef7accdea9c74 *tests/data/fate/vsynth3-ljpeg.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg b/tests/ref/vsynth/vsynth3-mjpeg
index 25036c8..64367d3 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg
+++ b/tests/ref/vsynth/vsynth3-mjpeg
@@ -1,4 +1,4 @@
-cf68ecc19e6c07d2a0c211e6ad1e3d9f *tests/data/fate/vsynth3-mjpeg.avi
-64804 tests/data/fate/vsynth3-mjpeg.avi
+76f11ea5a3a93d00506cbc436885c6a5 *tests/data/fate/vsynth3-mjpeg.avi
+65704 tests/data/fate/vsynth3-mjpeg.avi
c4fe7a2669afbd96c640748693fc4e30 *tests/data/fate/vsynth3-mjpeg.out.rawvideo
stddev: 8.60 PSNR: 29.43 MAXDIFF: 58 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-422 b/tests/ref/vsynth/vsynth3-mjpeg-422
index 23c58bb..981697f 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-422
+++ b/tests/ref/vsynth/vsynth3-mjpeg-422
@@ -1,4 +1,4 @@
-c1f42031676078a7cfc38a7eb53c89e8 *tests/data/fate/vsynth3-mjpeg-422.avi
-69458 tests/data/fate/vsynth3-mjpeg-422.avi
+cce75691080a7624af5cd459e9aaec1a *tests/data/fate/vsynth3-mjpeg-422.avi
+70358 tests/data/fate/vsynth3-mjpeg-422.avi
a332893cb0603f2f505fe5d3bf105519 *tests/data/fate/vsynth3-mjpeg-422.out.rawvideo
stddev: 8.23 PSNR: 29.82 MAXDIFF: 58 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-444 b/tests/ref/vsynth/vsynth3-mjpeg-444
index d17df66..b856339 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-444
+++ b/tests/ref/vsynth/vsynth3-mjpeg-444
@@ -1,4 +1,4 @@
-893c830a9635aaf686f53372cbe5e0ed *tests/data/fate/vsynth3-mjpeg-444.avi
-70584 tests/data/fate/vsynth3-mjpeg-444.avi
+c06b03165b2ed53d576b8c7eec6a99dd *tests/data/fate/vsynth3-mjpeg-444.avi
+71484 tests/data/fate/vsynth3-mjpeg-444.avi
79a901f2ed85d82cf1c674fab3d3ef72 *tests/data/fate/vsynth3-mjpeg-444.out.rawvideo
stddev: 8.21 PSNR: 29.84 MAXDIFF: 58 bytes: 86700/ 86700
--
1.7.9.5
More information about the ffmpeg-devel
mailing list