[FFmpeg-devel] H.264: Partially inline CABAC residual decode

Jason Garrett-Glaser jason
Sat Jan 15 18:53:18 CET 2011


On Sat, Jan 15, 2011 at 5:39 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Jan 14, 2011 at 03:13:42PM -0800, Jason Garrett-Glaser wrote:
>> On Fri, Jan 14, 2011 at 3:13 PM, Jason Garrett-Glaser <jason at x264.com> wrote:
>> > This is a port of a technique originally used in x264 (and later
>> > ported to ffvp8). ?It inlines the CBF portion of residual coding,
>> > which improves performance by allowing more constant propagation and
>> > because a huge number of residual blocks terminate on the CBF check.
>> >
>> > Timing for CABAC mb decode:
>> > Before: 6861 +/- 15 clocks
>> > After: 6779 +/- 9 clocks
>> >
>> > Jason
>> >
>>
>> Forgot the patch...
>
>
> [...]
>
>> ? */
>> ?int ff_h264_decode_mb_cabac(H264Context *h) {
>> + ? ?START_TIMER;
>> ? ? ?MpegEncContext * const s = &h->s;
>> ? ? ?int mb_xy;
>> ? ? ?int mb_type, partition_count, cbp = 0;
>> @@ -1716,6 +1720,6 @@
>> ? ? ? ? ?h->ref_count[0] >>= 1;
>> ? ? ? ? ?h->ref_count[1] >>= 1;
>> ? ? ?}
>> -
>> +STOP_TIMER("test");
>> ? ? ?return 0;
>> ?}
>
> that doesnt belong in here
>
> otherwise if moving that around is faster lgtm of course

Obviously yeah, that isn't in my local version, accidentally left it
in when I sent it out.

Note: this patch opens up one other option (related to my AV_ZERO
change): eliminate clear_blocks, and only clear a DCT block if it gets
used.  Since in the vast majority of cases (except for the highest
bitrates), the majority of blocks aren't used, this should be a win.

Applied with slight changes.

Jason



More information about the ffmpeg-devel mailing list