[FFmpeg-devel] [RFC]Improve adp detection

Michael Niedermayer michaelni at gmx.at
Wed Oct 30 01:22:29 CET 2013


On Wed, Oct 30, 2013 at 12:43:09AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> All zeros (and all other non-changing values) are currently detected as adp.
> Attached patch tries to improve this, better ideas (and patches) very welcome!
> 
> I will backport whatever will be committed.
> 
> Carl Eugen

>  adp.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 263ddb5b0662d8a1a25394fe753b8919d52971f1  patchadp.diff
> diff --git a/libavformat/adp.c b/libavformat/adp.c
> index c5feac4..88e0f22 100644
> --- a/libavformat/adp.c
> +++ b/libavformat/adp.c
> @@ -26,7 +26,8 @@
>  
>  static int adp_probe(AVProbeData *p)
>  {
> -    int i;
> +    int i, changes = 0;
> +    char last = 0;
>  
>      if (p->buf_size < 32)
>          return 0;
> @@ -34,6 +35,13 @@ static int adp_probe(AVProbeData *p)
>      for (i = 0; i < p->buf_size - 3; i+=32)
>          if (p->buf[i] != p->buf[i+2] || p->buf[i+1] != p->buf[i+3])
>              return 0;

can these have any value ?
the decoder distinuishes only 4 cases for the upper 4 bits which would
have 16 cases



> +        else {
> +            if (p->buf[i] != last)
> +                changes++;
> +            last = p->buf[i];
> +        }
> +    if (changes <= 1)
> +        return 0;

no objections if that improves something


>  
>      return p->buf_size < 260 ? 1 : AVPROBE_SCORE_MAX / 4;
>  }

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131030/c971720f/attachment.asc>


More information about the ffmpeg-devel mailing list