* Re: [FFmpeg-devel] [PATCH 2/2] avformat/img2dec: add GEM Raster image demuxer
[not found] ` <54d14822e998e9f1ac99e919fe223433d3c509e2.1631867851.git.pross@xvid.org>
@ 2022-01-20 12:48 ` Andreas Rheinhardt
2022-01-23 0:01 ` Carl Eugen Hoyos
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2022-01-20 12:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Fri, Sep 17, 2021 at 10:39 AM Peter Ross <pross@xvid.org> wrote:
>
> ---
> libavformat/allformats.c | 1 +
> libavformat/img2.c | 3 +++
> libavformat/img2dec.c | 22 ++++++++++++++++++++++
> 3 files changed, 26 insertions(+)
>
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 5471f7c16f..99d8c91e00 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -499,6 +499,7 @@ extern const AVInputFormat ff_image_cri_pipe_demuxer;
> extern const AVInputFormat ff_image_dds_pipe_demuxer;
> extern const AVInputFormat ff_image_dpx_pipe_demuxer;
> extern const AVInputFormat ff_image_exr_pipe_demuxer;
> +extern const AVInputFormat ff_image_gem_pipe_demuxer;
> extern const AVInputFormat ff_image_gif_pipe_demuxer;
> extern const AVInputFormat ff_image_j2k_pipe_demuxer;
> extern const AVInputFormat ff_image_jpeg_pipe_demuxer;
> diff --git a/libavformat/img2.c b/libavformat/img2.c
> index 6bdd7efe26..4153102c92 100644
> --- a/libavformat/img2.c
> +++ b/libavformat/img2.c
> @@ -84,6 +84,9 @@ const IdStrMap ff_img_tags[] = {
> { AV_CODEC_ID_XPM, "xpm" },
> { AV_CODEC_ID_XFACE, "xface" },
> { AV_CODEC_ID_XWD, "xwd" },
> + { AV_CODEC_ID_GEM, "img" },
> + { AV_CODEC_ID_GEM, "ximg" },
> + { AV_CODEC_ID_GEM, "timg" },
> { AV_CODEC_ID_NONE, NULL }
> };
>
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index 485444ed31..acfd5910de 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -1105,6 +1105,27 @@ static int photocd_probe(const AVProbeData *p)
> return AVPROBE_SCORE_MAX - 1;
> }
>
> +static int gem_probe(const AVProbeData *p)
> +{
> + const uint8_t *b = p->buf;
> + int ret = 0;
> + if ( AV_RB16(b ) >= 1 && AV_RB16(b ) <= 3 &&
> + AV_RB16(b + 2) >= 8 && AV_RB16(b + 2) <= 779 &&
> + (AV_RB16(b + 4) > 0 || AV_RB16(b + 4) <= 8) &&
> + (AV_RB16(b + 6) > 0 || AV_RB16(b + 6) <= 8) &&
The above two lines are tautologically true, suggesting that something
else was intended here.
Looking at the decoder shows that this is the aspect ratio, so
checking for them being >0 makes sense,
yet the checks for them being <= 8 doesn't.
(This has been reported in ticket #9605.)
> + AV_RB16(b + 8) &&
> + AV_RB16(b + 10) &&
> + AV_RB16(b + 12) &&
> + AV_RB16(b + 14)) {
> + ret = AVPROBE_SCORE_EXTENSION / 4;
> + if (AV_RN32(b + 16) == AV_RN32("STTT") ||
> + AV_RN32(b + 16) == AV_RN32("TIMG") ||
> + AV_RN32(b + 16) == AV_RN32("XIMG"))
> + ret += 1;
> + }
> + return ret;
> +}
> +
_______________________________________________
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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avformat/img2dec: add GEM Raster image demuxer
[not found] ` <54d14822e998e9f1ac99e919fe223433d3c509e2.1631867851.git.pross@xvid.org>
2022-01-20 12:48 ` [FFmpeg-devel] [PATCH 2/2] avformat/img2dec: add GEM Raster image demuxer Andreas Rheinhardt
@ 2022-01-23 0:01 ` Carl Eugen Hoyos
2022-01-23 4:45 ` Peter Ross
1 sibling, 1 reply; 3+ messages in thread
From: Carl Eugen Hoyos @ 2022-01-23 0:01 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Am Fr., 17. Sept. 2021 um 10:39 Uhr schrieb Peter Ross <pross@xvid.org>:
> +static int gem_probe(const AVProbeData *p)
> +{
> + const uint8_t *b = p->buf;
> + int ret = 0;
> + if ( AV_RB16(b ) >= 1 && AV_RB16(b ) <= 3 &&
> + AV_RB16(b + 2) >= 8 && AV_RB16(b + 2) <= 779 &&
> + (AV_RB16(b + 4) > 0 || AV_RB16(b + 4) <= 8) &&
> + (AV_RB16(b + 6) > 0 || AV_RB16(b + 6) <= 8) &&
> + AV_RB16(b + 8) &&
> + AV_RB16(b + 10) &&
> + AV_RB16(b + 12) &&
> + AV_RB16(b + 14)) {
> + ret = AVPROBE_SCORE_EXTENSION / 4;
Without running probetest, this score looks too high to me.
(1, 2 or 3 followed by anything not 0 with some restrictions?)
Why is the above sufficient? Are there files in the wild
without the fourcc's below?
> + if (AV_RN32(b + 16) == AV_RN32("STTT") ||
> + AV_RN32(b + 16) == AV_RN32("TIMG") ||
> + AV_RN32(b + 16) == AV_RN32("XIMG"))
> + ret += 1;
Should be EXTENSION + 1
Carl Eugen
_______________________________________________
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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avformat/img2dec: add GEM Raster image demuxer
2022-01-23 0:01 ` Carl Eugen Hoyos
@ 2022-01-23 4:45 ` Peter Ross
0 siblings, 0 replies; 3+ messages in thread
From: Peter Ross @ 2022-01-23 4:45 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1495 bytes --]
On Sun, Jan 23, 2022 at 01:01:58AM +0100, Carl Eugen Hoyos wrote:
> Am Fr., 17. Sept. 2021 um 10:39 Uhr schrieb Peter Ross <pross@xvid.org>:
>
> > +static int gem_probe(const AVProbeData *p)
> > +{
> > + const uint8_t *b = p->buf;
> > + int ret = 0;
> > + if ( AV_RB16(b ) >= 1 && AV_RB16(b ) <= 3 &&
> > + AV_RB16(b + 2) >= 8 && AV_RB16(b + 2) <= 779 &&
> > + (AV_RB16(b + 4) > 0 || AV_RB16(b + 4) <= 8) &&
> > + (AV_RB16(b + 6) > 0 || AV_RB16(b + 6) <= 8) &&
> > + AV_RB16(b + 8) &&
> > + AV_RB16(b + 10) &&
> > + AV_RB16(b + 12) &&
> > + AV_RB16(b + 14)) {
> > + ret = AVPROBE_SCORE_EXTENSION / 4;
>
> Without running probetest, this score looks too high to me.
> (1, 2 or 3 followed by anything not 0 with some restrictions?)
The probetest warning is only triggered when the score is greater than
AVPROBE_SCORE_EXTENSION / 4
This score is consistent with other image2 demuxers like bmp and pcx.
How much lower does it need to be?
> Why is the above sufficient? Are there files in the wild
> without the fourcc's below?
Correct, not all files have the fourcc's below.
> > + if (AV_RN32(b + 16) == AV_RN32("STTT") ||
> > + AV_RN32(b + 16) == AV_RN32("TIMG") ||
> > + AV_RN32(b + 16) == AV_RN32("XIMG"))
> > + ret += 1;
>
> Should be EXTENSION + 1
Agree.
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
[-- 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] 3+ messages in thread
end of thread, other threads:[~2022-01-23 4:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <755fd91b4ae6c9327668f339acfc67fcdd02c0bd.1631867851.git.pross@xvid.org>
[not found] ` <54d14822e998e9f1ac99e919fe223433d3c509e2.1631867851.git.pross@xvid.org>
2022-01-20 12:48 ` [FFmpeg-devel] [PATCH 2/2] avformat/img2dec: add GEM Raster image demuxer Andreas Rheinhardt
2022-01-23 0:01 ` Carl Eugen Hoyos
2022-01-23 4:45 ` Peter Ross
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