Message ID | 20180429215616.17303-1-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
On Sun, 29 Apr 2018 at 22:57 Michael Niedermayer <michael@niedermayer.cc> wrote: > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/m4vdec.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c > index 34d434f7d2..be30f86a5c 100644 > --- a/libavformat/m4vdec.c > +++ b/libavformat/m4vdec.c > @@ -29,6 +29,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet) > { > uint32_t temp_buffer = -1; > int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0; > + int res_main = 0; > int i; > > for (i = 0; i < probe_packet->buf_size; i++) { > @@ -46,11 +47,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet) > VO++; > else if (temp_buffer >= 0x120 && temp_buffer < 0x130) > VOL++; > + else if (temp_buffer == 0x1B7 || temp_buffer == 0x1B8) > + res_main++; > else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) && > !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) > res++; > } > > + if (res_main && 2*res_main < VOP) > + res += res_main; > + > if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0) > return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION : > AVPROBE_SCORE_EXTENSION/2; > Lots of interesting made up numbers here, explanation would be great. Kieran
On Sun, Apr 29, 2018 at 11:23:17PM +0000, Kieran Kunhya wrote: > On Sun, 29 Apr 2018 at 22:57 Michael Niedermayer <michael@niedermayer.cc> > wrote: > > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavformat/m4vdec.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c > > index 34d434f7d2..be30f86a5c 100644 > > --- a/libavformat/m4vdec.c > > +++ b/libavformat/m4vdec.c > > @@ -29,6 +29,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet) > > { > > uint32_t temp_buffer = -1; > > int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0; > > + int res_main = 0; > > int i; > > > > for (i = 0; i < probe_packet->buf_size; i++) { > > @@ -46,11 +47,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet) > > VO++; > > else if (temp_buffer >= 0x120 && temp_buffer < 0x130) > > VOL++; > > + else if (temp_buffer == 0x1B7 || temp_buffer == 0x1B8) > > + res_main++; > > else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) && > > !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) > > res++; > > } > > > > + if (res_main && 2*res_main < VOP) > > + res += res_main; > > + > > if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0) > > return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION : > > AVPROBE_SCORE_EXTENSION/2; > > > > Lots of interesting made up numbers here, explanation would be great. > Kieran will apply with explanations in comments and names constants where it makes sense Thanks [...]
diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c index 34d434f7d2..be30f86a5c 100644 --- a/libavformat/m4vdec.c +++ b/libavformat/m4vdec.c @@ -29,6 +29,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet) { uint32_t temp_buffer = -1; int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0; + int res_main = 0; int i; for (i = 0; i < probe_packet->buf_size; i++) { @@ -46,11 +47,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet) VO++; else if (temp_buffer >= 0x120 && temp_buffer < 0x130) VOL++; + else if (temp_buffer == 0x1B7 || temp_buffer == 0x1B8) + res_main++; else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; } + if (res_main && 2*res_main < VOP) + res += res_main; + if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0) return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION : AVPROBE_SCORE_EXTENSION/2;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/m4vdec.c | 6 ++++++ 1 file changed, 6 insertions(+)