[FFmpeg-devel] [PATCH] VP8 decoder

Ronald S. Bultje rsbultje
Tue Jun 22 18:12:41 CEST 2010


Hi,

On Tue, Jun 22, 2010 at 10:32 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Jun 22, 2010 at 10:02:29AM -0400, Ronald S. Bultje wrote:
> [...]
>> @@ -393,6 +443,21 @@
>> ? ? ?src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2;
>> ?}
>>
>> +static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
>> + ? ?uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
>> + ? ?int tl = src[-1-stride];
>> + ? ?uint8_t *top = src-stride;
>> + ? ?int y;
>> +
>> + ? ?for (y = 0; y < 4; y++) {
>> + ? ? ? ?src[0] = cm[src[-1] + top[0] - tl];
>> + ? ? ? ?src[1] = cm[src[-1] + top[1] - tl];
>> + ? ? ? ?src[2] = cm[src[-1] + top[2] - tl];
>> + ? ? ? ?src[3] = cm[src[-1] + top[3] - tl];
>
> &cm[src[-1] - tl]
>
>> + ? ? ? ?src += stride;
>> + ? ?}
>> +}
>> +
>> ?static void pred16x16_vertical_c(uint8_t *src, int stride){
>> ? ? ?int i;
>> ? ? ?const uint32_t a= ((uint32_t*)(src-stride))[0];
>
>> @@ -539,6 +604,21 @@
>> ? ? ?pred16x16_plane_compat_c(src, stride, 0, 1);
>> ?}
>>
>> +static void pred16x16_tm_vp8_c(uint8_t *src, int stride){
>> + ? ?uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
>> + ? ?int tl = src[-1-stride];
>> + ? ?uint8_t *top = src-stride;
>> + ? ?int x, y;
>> +
>> + ? ?for (y = 0; y < 16; y++) {
>> + ? ? ? ?int l = src[-1];
>> + ? ? ? ?uint8_t *cm_in = &cm[l - tl];
>
> - tl could be factored out of the loop into cm
>
>
>> + ? ? ? ?for (x = 0; x < 16; x++)
>> + ? ? ? ? ? ?src[x] = cm_in[top[x]];
>> + ? ? ? ?src += stride;
>> + ? ?}
>> +}
>> +
>> ?static void pred8x8_vertical_c(uint8_t *src, int stride){
>> ? ? ?int i;
>> ? ? ?const uint32_t a= ((uint32_t*)(src-stride))[0];
>> @@ -745,6 +825,25 @@
>> ? ?}
>> ?}
>>
>> +static void pred8x8_tm_vp8_c(uint8_t *src, int stride){
>> + ? ?uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
>> + ? ?int tl = src[-1-stride];
>> + ? ?uint8_t *top = src-stride;
>> + ? ?int y;
>> +
>> + ? ?for (y = 0; y < 8; y++) {
>> + ? ? ? ?src[0] = cm[src[-1] + top[0] - tl];
>> + ? ? ? ?src[1] = cm[src[-1] + top[1] - tl];
>> + ? ? ? ?src[2] = cm[src[-1] + top[2] - tl];
>> + ? ? ? ?src[3] = cm[src[-1] + top[3] - tl];
>> + ? ? ? ?src[4] = cm[src[-1] + top[4] - tl];
>> + ? ? ? ?src[5] = cm[src[-1] + top[5] - tl];
>> + ? ? ? ?src[6] = cm[src[-1] + top[6] - tl];
>> + ? ? ? ?src[7] = cm[src[-1] + top[7] - tl];
>> + ? ? ? ?src += stride;
>> + ? ?}
>> +}
>
> similar things

OK, I went through all three functions and redid all of them to be
sane. The 16x16 is now also unrolled and I placed all instructions
outside the loop where I could (I think).

> also maybe some of teh if() could at some point in the future be reorganized
> they look a bit convoluted

You mean in the init code? I agree. Fixing that might be a little out
of scope for this patch. (It's actually not that bad, but with another
5 codecs, it would get chaotically messy really quickly.)

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: h264pred_vp8_functions.patch
Type: application/octet-stream
Size: 9250 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100622/05ecbe50/attachment.obj>



More information about the ffmpeg-devel mailing list