Hey, Trying to fix a bug #6113, I stumbled upon some strange logic in libavformat/img2dec.c:jpeg_probe. It accepts first 2048 bytes of jpeg stream, and tries to read it with some state machine. If it doesn't look like jpeg stream, it returns 0 ("it's definitely not a jpeg").
After it read through the buffer, it does this: if (state == EOI) return AVPROBE_SCORE_EXTENSION + 1; if (state == SOS) return AVPROBE_SCORE_EXTENSION / 2; return AVPROBE_SCORE_EXTENSION / 8; That doesn't make sense to me. All we read so far made sense for jpeg reader, it definitely looks like a jpeg image, but for some reason our confidence is AVPROBE_SCORE_EXTENSION _DIVIDED_ by 2 or 8 (in other words, "it would look more jpeg if it had .jpg extension). Compare it with png, for example: static int png_probe(AVProbeData *p) { const uint8_t *b = p->buf; if (AV_RB64(b) == 0x89504e470d0a1a0a) return AVPROBE_SCORE_MAX - 1; return 0; } "Return max confidence, if it has proper signature, 0 otherwise" Shouldn't it be something like this? if (state == EOI) return AVPROBE_SCORE_EXTENSION + 3; if (state == SOS) return AVPROBE_SCORE_EXTENSION + 2; return AVPROBE_SCORE_EXTENSION + 1; I'll send a patch if there're no objections. Thanks! V. Kalinsky _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel