* [FFmpeg-devel] [PATCH v4 0/2] RGB mjpeg fixes
@ 2023-04-20 16:54 Leo Izen
2023-04-20 16:54 ` [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs Leo Izen
2023-04-20 16:55 ` [FFmpeg-devel] [PATCH v4 2/2] fate: add tests for RGB jpegs Leo Izen
0 siblings, 2 replies; 5+ messages in thread
From: Leo Izen @ 2023-04-20 16:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Leo Izen
Changes from v3:
- Wrapped two previous commits into one.
- Removed case logic with regard to s->progressive and !s->progressive, now all
should be treated the same way, at michaelni's recommendation.
- All RGB jpegs are now decoded in RGB order and then the buffers are pivoted into
GBR-order at the end, so no extensive documentation is needed on which buffers are in
which order at what times with what pixel formats.
Current version passes samples in the provided fate tests as well as those in #10190,
and #4045, #1651, and #850.
Leo Izen (2):
avcodec/mjpegdec: fix remaining RGB JPEGs
fate: add tests for RGB jpegs
libavcodec/mjpegdec.c | 9 +++------
tests/fate/image.mak | 9 +++++++++
tests/ref/fate/jpg-rgb-221 | 6 ++++++
tests/ref/fate/jpg-rgb-baseline | 6 ++++++
tests/ref/fate/jpg-rgb-progressive | 6 ++++++
5 files changed, 30 insertions(+), 6 deletions(-)
create mode 100644 tests/ref/fate/jpg-rgb-221
create mode 100644 tests/ref/fate/jpg-rgb-baseline
create mode 100644 tests/ref/fate/jpg-rgb-progressive
--
2.40.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs
2023-04-20 16:54 [FFmpeg-devel] [PATCH v4 0/2] RGB mjpeg fixes Leo Izen
@ 2023-04-20 16:54 ` Leo Izen
2023-04-20 23:53 ` Michael Niedermayer
2023-04-20 16:55 ` [FFmpeg-devel] [PATCH v4 2/2] fate: add tests for RGB jpegs Leo Izen
1 sibling, 1 reply; 5+ messages in thread
From: Leo Izen @ 2023-04-20 16:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Leo Izen
The change introduced in b18a9c29713abc3a1b081de3f320ab53a47120c6
created a regression for non-subsampled progressive RGB jpegs. This
should fix that.
Additionally, this should fix other RGB JPEGs broken before the recent
patches, such as those in Trac issue #10190.
---
libavcodec/mjpegdec.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index c41d4bce5e..9b55002c4b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -604,7 +604,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
else
goto unk_pixfmt;
- s->upscale_v[0] = s->upscale_v[1] = 1;
+ s->upscale_v[1] = s->upscale_v[2] = 1;
} else {
if (pix_fmt_id == 0x14111100)
s->upscale_v[1] = s->upscale_v[2] = 1;
@@ -619,7 +619,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
else
goto unk_pixfmt;
- s->upscale_h[0] = s->upscale_h[1] = 1;
+ s->upscale_h[1] = s->upscale_h[2] = 1;
} else {
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
@@ -1698,9 +1698,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
s->h_scount[i] = s->h_count[index];
s->v_scount[i] = s->v_count[index];
- if(nb_components == 3 && s->nb_components == 3 && s->avctx->pix_fmt == AV_PIX_FMT_GBRP)
- index = (index+2)%3;
-
s->comp_index[i] = index;
s->dc_index[i] = get_bits(&s->gb, 4);
@@ -2724,7 +2721,7 @@ the_end:
}
}
- if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP && s->progressive) {
+ if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP) {
av_assert0(s->nb_components == 3);
FFSWAP(uint8_t *, frame->data[0], frame->data[2]);
FFSWAP(uint8_t *, frame->data[0], frame->data[1]);
--
2.40.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH v4 2/2] fate: add tests for RGB jpegs
2023-04-20 16:54 [FFmpeg-devel] [PATCH v4 0/2] RGB mjpeg fixes Leo Izen
2023-04-20 16:54 ` [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs Leo Izen
@ 2023-04-20 16:55 ` Leo Izen
1 sibling, 0 replies; 5+ messages in thread
From: Leo Izen @ 2023-04-20 16:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Leo Izen
Added framecrc tests for RGB JPEGs to verify future changes to the
decoder.
---
tests/fate/image.mak | 9 +++++++++
tests/ref/fate/jpg-rgb-221 | 6 ++++++
tests/ref/fate/jpg-rgb-baseline | 6 ++++++
tests/ref/fate/jpg-rgb-progressive | 6 ++++++
4 files changed, 27 insertions(+)
create mode 100644 tests/ref/fate/jpg-rgb-221
create mode 100644 tests/ref/fate/jpg-rgb-baseline
create mode 100644 tests/ref/fate/jpg-rgb-progressive
diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 42dd90feaa..93bc715ca3 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -337,6 +337,15 @@ fate-jpg-12bpp: CMD = framecrc -idct simple -i $(TARGET_SAMPLES)/jpg/12bpp.jpg -
FATE_JPG += fate-jpg-jfif
fate-jpg-jfif: CMD = framecrc -idct simple -i $(TARGET_SAMPLES)/jpg/20242.jpg
+FATE_JPG += fate-jpg-rgb-baseline
+fate-jpg-rgb-baseline: CMD = framecrc -idct simple -i $(TARGET_SAMPLES)/jpg/george-insect-rgb-baseline.jpg
+
+FATE_JPG += fate-jpg-rgb-progressive
+fate-jpg-rgb-progressive: CMD = framecrc -idct simple -i $(TARGET_SAMPLES)/jpg/george-insect-rgb-progressive.jpg
+
+FATE_JPG += fate-jpg-rgb-221
+fate-jpg-rgb-221: CMD = framecrc -idct simple -i $(TARGET_SAMPLES)/jpg/george-insect-rgb-xyb.jpg
+
FATE_JPG_TRANSCODE-$(call TRANSCODE, MJPEG, MJPEG IMAGE_JPEG_PIPE, IMAGE_PNG_PIPE_DEMUXER PNG_DECODER SCALE_FILTER) += fate-jpg-icc
fate-jpg-icc: CMD = transcode png_pipe $(TARGET_SAMPLES)/png1/lena-int_rgb24.png mjpeg "-vf scale" "" "-show_frames"
diff --git a/tests/ref/fate/jpg-rgb-221 b/tests/ref/fate/jpg-rgb-221
new file mode 100644
index 0000000000..32250db493
--- /dev/null
+++ b/tests/ref/fate/jpg-rgb-221
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x43
+#sar 0: 0/1
+0, 0, 0, 1, 8256, 0x81617757
diff --git a/tests/ref/fate/jpg-rgb-baseline b/tests/ref/fate/jpg-rgb-baseline
new file mode 100644
index 0000000000..f7ff29e9a2
--- /dev/null
+++ b/tests/ref/fate/jpg-rgb-baseline
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x43
+#sar 0: 0/1
+0, 0, 0, 1, 8256, 0x98ad8863
diff --git a/tests/ref/fate/jpg-rgb-progressive b/tests/ref/fate/jpg-rgb-progressive
new file mode 100644
index 0000000000..b0d118d21a
--- /dev/null
+++ b/tests/ref/fate/jpg-rgb-progressive
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x43
+#sar 0: 0/1
+0, 0, 0, 1, 8256, 0xbb6e8830
--
2.40.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs
2023-04-20 16:54 ` [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs Leo Izen
@ 2023-04-20 23:53 ` Michael Niedermayer
2023-04-21 14:03 ` Leo Izen
0 siblings, 1 reply; 5+ messages in thread
From: Michael Niedermayer @ 2023-04-20 23:53 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 842 bytes --]
On Thu, Apr 20, 2023 at 12:54:59PM -0400, Leo Izen wrote:
> The change introduced in b18a9c29713abc3a1b081de3f320ab53a47120c6
> created a regression for non-subsampled progressive RGB jpegs. This
> should fix that.
>
> Additionally, this should fix other RGB JPEGs broken before the recent
> patches, such as those in Trac issue #10190.
> ---
> libavcodec/mjpegdec.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
LGTM and thanks!
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Any man who breaks a law that conscience tells him is unjust and willingly
accepts the penalty by staying in jail in order to arouse the conscience of
the community on the injustice of the law is at that moment expressing the
very highest respect for law. - Martin Luther King Jr
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs
2023-04-20 23:53 ` Michael Niedermayer
@ 2023-04-21 14:03 ` Leo Izen
0 siblings, 0 replies; 5+ messages in thread
From: Leo Izen @ 2023-04-21 14:03 UTC (permalink / raw)
To: ffmpeg-devel
On 4/20/23 19:53, Michael Niedermayer wrote:
> On Thu, Apr 20, 2023 at 12:54:59PM -0400, Leo Izen wrote:
>> The change introduced in b18a9c29713abc3a1b081de3f320ab53a47120c6
>> created a regression for non-subsampled progressive RGB jpegs. This
>> should fix that.
>>
>> Additionally, this should fix other RGB JPEGs broken before the recent
>> patches, such as those in Trac issue #10190.
>> ---
>> libavcodec/mjpegdec.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> LGTM and thanks!
>
>
Thanks, applied
- Leo Izen (Traneptora / thebombzen)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-21 14:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 16:54 [FFmpeg-devel] [PATCH v4 0/2] RGB mjpeg fixes Leo Izen
2023-04-20 16:54 ` [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs Leo Izen
2023-04-20 23:53 ` Michael Niedermayer
2023-04-21 14:03 ` Leo Izen
2023-04-20 16:55 ` [FFmpeg-devel] [PATCH v4 2/2] fate: add tests for RGB jpegs Leo Izen
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git