[PATCH]lavf/img2: Only autodetect valid Quickdraw images
Hi! Attached patch improves the Quickdraw autodetection. Please comment, Carl Eugen
On Tue, May 19, 2015 at 11:58:47AM +0200, Carl Eugen Hoyos wrote:
Hi!
Attached patch improves the Quickdraw autodetection.
Please comment, Carl Eugen
img2dec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) e36c8a9c4c72f72030658d5f70ca46b27066eda3 patchimg2qdrw.diff
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 0830f00..ec234d1 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -714,8 +714,10 @@ static int qdraw_probe(AVProbeData *p) { const uint8_t *b = p->buf;
- if (!b[10] && AV_RB32(b+11) == 0x1102ff0c && !b[15] || - p->buf_size >= 528 && !b[522] && AV_RB32(b+523) == 0x1102ff0c && !b[527]) + if ( p->buf_size >= 528 + && (AV_RB64(b + 520) & 0xFFFFFFFFFFFF) == 0x001102ff0c00 + && AV_RB16(b + 520) + && AV_RB16(b + 518))
return AVPROBE_SCORE_EXTENSION + 1;
i think this should be higher with that change also i think a somewhat lower score could still be output for less valid but still decodeable files [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope
On Tuesday 19 May 2015 06:15:49 pm Michael Niedermayer wrote:
On Tue, May 19, 2015 at 11:58:47AM +0200, Carl Eugen Hoyos wrote:
Hi!
Attached patch improves the Quickdraw autodetection.
Please comment, Carl Eugen
img2dec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) e36c8a9c4c72f72030658d5f70ca46b27066eda3 patchimg2qdrw.diff
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 0830f00..ec234d1 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -714,8 +714,10 @@ static int qdraw_probe(AVProbeData *p) { const uint8_t *b = p->buf;
- if (!b[10] && AV_RB32(b+11) == 0x1102ff0c && !b[15] || - p->buf_size >= 528 && !b[522] && AV_RB32(b+523) == 0x1102ff0c && !b[527]) + if ( p->buf_size >= 528 + && (AV_RB64(b + 520) & 0xFFFFFFFFFFFF) == 0x001102ff0c00 + && AV_RB16(b + 520) + && AV_RB16(b + 518))
return AVPROBE_SCORE_EXTENSION + 1;
i think this should be higher with that change
also i think a somewhat lower score could still be output for less valid but still decodeable files
New patch attached. Please comment, Carl Eugen
On Tuesday 19 May 2015 06:15:49 pm Michael Niedermayer wrote:
return AVPROBE_SCORE_EXTENSION + 1;
i think this should be higher with that change
also i think a somewhat lower score could still be output for less valid but still decodeable files
The patch was merged with these changes. Thank you, Carl Eugen
participants (2)
-
Carl Eugen Hoyos -
Michael Niedermayer