mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-09 14:14:39 +02:00
avformat/img2_alias_pix: rewrite probe function
Fixes probetest failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
2cffdcbdd7
commit
657cee1aef
@ -20,23 +20,37 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "img2.h"
|
#include "img2.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavcodec/bytestream.h"
|
||||||
|
|
||||||
static int brender_read_probe(AVProbeData *p)
|
static int brender_read_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
int width = AV_RB16(p->buf);
|
const uint8_t *b = p->buf;
|
||||||
int height = AV_RB16(p->buf+2);
|
const uint8_t *end = b + p->buf_size;
|
||||||
int ox = AV_RB16(p->buf+4);
|
int width = bytestream_get_be16(&b);
|
||||||
int oy = AV_RB16(p->buf+6);
|
int height = bytestream_get_be16(&b);
|
||||||
int bpp = AV_RB16(p->buf+8);
|
int ox = bytestream_get_be16(&b);
|
||||||
int count = p->buf[10];
|
int oy = bytestream_get_be16(&b);
|
||||||
|
int bpp = bytestream_get_be16(&b);
|
||||||
|
int x, y;
|
||||||
|
|
||||||
if (!count || !height || count > width)
|
if (!width || !height)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (bpp != 24 && bpp != 8)
|
if (bpp != 24 && bpp != 8)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
for (y=0; y<2 && y<height; y++) {
|
||||||
|
for (x=0; x<width; ) {
|
||||||
|
int count = *b++;
|
||||||
|
if (count == 0 || x + count > width)
|
||||||
|
return 0;
|
||||||
|
if (b > end)
|
||||||
|
return AVPROBE_SCORE_MAX / 8;
|
||||||
|
b += bpp / 8;
|
||||||
|
x += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return AVPROBE_SCORE_EXTENSION + 1;
|
return AVPROBE_SCORE_EXTENSION + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user