[FFmpeg-devel] [PATCH 3/4] VP8: token probs doesn't need padding

Jason Garrett-Glaser darkshikari
Sat Mar 12 00:09:21 CET 2011


2011/3/11 M?ns Rullg?rd <mans at mansr.com>:
> Jason Garrett-Glaser <jason at x264.com> writes:
>
>> prob[0] is the only prob array ever accessed, so prob[1] can serve as padding
>> for prob[0].
>> ---
>> ?libavcodec/vp8.h | ? ?3 +--
>> ?1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
>> index d3b8705..b94d453 100644
>> --- a/libavcodec/vp8.h
>> +++ b/libavcodec/vp8.h
>> @@ -233,8 +233,7 @@ typedef struct {
>> ? ? ? ? ?uint8_t golden;
>> ? ? ? ? ?uint8_t pred16x16[4];
>> ? ? ? ? ?uint8_t pred8x8c[3];
>> - ? ? ? ?/* Padded to allow overreads */
>> - ? ? ? ?uint8_t token[4][17][3][NUM_DCT_TOKENS-1];
>> + ? ? ? ?uint8_t token[4][16][3][NUM_DCT_TOKENS-1];
>> ? ? ? ? ?uint8_t mvc[2][19];
>> ? ? ?} prob[2];
>> ?} VP8Context;
>
> If only one is accessed, why are there two?

The second is a backup.  If update_probabilities = 0, the
probabilities used for the current frame are thrown away after
decoding it.  So we copy the old probabilities to prob[1], use prob[0]
for the current frame, then restore them afterward.

Jason



More information about the ffmpeg-devel mailing list