[FFmpeg-devel] [PATCHv3] VP4 video decoder

Peter Ross pross at xvid.org
Fri May 17 13:09:45 EEST 2019


On Thu, May 16, 2019 at 08:52:39PM +0200, Reimar Döffinger wrote:
> On Thu, May 16, 2019 at 08:00:55PM +0200, Reimar Döffinger wrote:
> > On Thu, May 16, 2019 at 09:35:00PM +1000, Peter Ross wrote:
> > > +static int read_mb_value(GetBitContext *gb)
> > > +{
> > > +    int v = 1;
> > > +    int size;
> > > +    OPEN_READER(re, gb);
> > > +
> > > +    do {
> > > +        int bit;
> > > +        size = 0;
> > > +
> > > +        UPDATE_CACHE(re, gb);
> > > +        bit = SHOW_UBITS(re, gb, 1);
> > > +        SKIP_BITS(re, gb, 1);
> > > +        if (!bit)
> > > +            break;
> > > +
> > > +        do {
> > > +            bit = SHOW_UBITS(re, gb, 1);
> > > +            SKIP_BITS(re, gb, 1);
> > > +            if (!bit)
> > > +                break;
> > > +            size++;
> > > +        } while (size < 8);
> > > +
> > > +        v += 1 << size;
> > > +
> > > +    } while (size == 8);
> > > +
> > > +    if (size) {
> > > +        v += SHOW_UBITS(re, gb, size);
> > > +        LAST_SKIP_BITS(re, gb, size);
> > > +    }
> > > +
> > > +    CLOSE_READER(re, gb);
> > > +    return v;
> > > +}
> >
> > I meant that you should do something like
> > (could maybe be made less messy, and not
> > sure it's really necessary to use the macro
> > version, I think it'd prefer the plain
> > show_bits etc)
> >
> 
> So many bugs in the previous version, this
> one is at least a bit more correct...

ah, i see what you did there! it works perfectly, just missing
UPDATE_CACHE at the start and in the loop.

test results on i7 decoding 3 minute long 4k video with vp4.

vp4 patch v3:
bench: utime=113.439s stime=0.414s rtime=30.161s
bench: utime=113.406s stime=0.403s rtime=30.123s
bench: utime=113.533s stime=0.310s rtime=30.104s
bench: utime=113.691s stime=0.414s rtime=30.148s
bench: utime=113.414s stime=0.435s rtime=30.102s
bench: utime=113.449s stime=0.370s rtime=30.138s
bench: utime=113.277s stime=0.470s rtime=30.139s

your patch + UPDATE_CACHE:
bench: utime=113.373s stime=0.386s rtime=30.109s
bench: utime=113.284s stime=0.378s rtime=30.122s
bench: utime=113.314s stime=0.414s rtime=30.125s
bench: utime=113.369s stime=0.378s rtime=30.130s
bench: utime=113.309s stime=0.394s rtime=30.108s
bench: utime=113.285s stime=0.435s rtime=30.048s
bench: utime=113.506s stime=0.362s rtime=30.182s

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190517/8e634a95/attachment.sig>


More information about the ffmpeg-devel mailing list