[FFmpeg-devel] [Fwd: Summer of code small task patch]

Dylan Yudaken dyudaken
Mon Mar 30 20:37:36 CEST 2009


Michael Niedermayer wrote:
> On Mon, Mar 30, 2009 at 12:16:48AM +0200, Dylan Yudaken wrote:
>   
>> Michael Niedermayer wrote:
>>     
>>>> Index: libavcodec/fdctref.c
>>>> ===================================================================
>>>> --- libavcodec/fdctref.c	(revision 18226)
>>>> +++ libavcodec/fdctref.c	(working copy)
>>>> @@ -1,157 +1,128 @@
>>>> -/**
>>>> - * @file libavcodec/fdctref.c
>>>> - * forward discrete cosine transform, double precision.
>>>> - */
>>>> -
>>>> -/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights 
>>>> Reserved. */
>>>> -
>>>>  /*
>>>> - * Disclaimer of Warranty
>>>> + * Reference discrete cosine transform (double-precision)
>>>> + * Copyright (C) 2009 Dylan Yudaken
>>>>     
>>>>         
>>> the patch should remove the old file and add the new file, it should not
>>> be a (unreadable) diff betweem 2 different implementations
>>>   
>>>       
>> sorry - I am struggling to separate into 2 clear patches. I have attached 1 
>> patch, I think diego said he would split it up. I cant find a way to do a 
>> local commit on svn so that I can diff between different stages of my 
>> patch.
>>     
>
> you can just make a second directory and diff between 2 files or directories
> with diff -u
>
> (there are other ways also like using git but git probably needs too much
>  time to learn for this purpose now)
>
>   
didnt know there was a git. way easier - attached.
> [...]
>   
>> +    coefficients[0] = 1;
>> +    for (i = 8; i < 64; i+=8) {
>> +        for (j = 0; j < 8; ++j) {
>> +            coefficients[i + j] = sqrt(2.0) * cos(i * (j+0.5) * (M_PI / 64.0));
>> +        }
>> +        coefficients[i/8] = 1;
>> +    }
>>     
>
> theres a simpler way by which the loops can be merged
>   
I found a way to not need the first row of the coefficient matrix. It 
uses a small memory hack, I hope this is alright. I cant see it breaking 
anything as the unreserved memory is never actually dereferenced. It 
reduces the memory usage by 60 bytes (not sure if this is significant, 
but it was nice). Also reduced the number of floating point 
multiplications by a bunch (+-128 I think for a forward DCT). The IDCT 
doesnt gain as much as there is an additional 64 floating 
multiplications there to compensate for the coefficient values.

Also - in the earlier versions of my code the IDCT was wrong. I have 
fixed it now but it doesnt get the exact values of the previous 
versions. My version has a lower error^2 but a higher systematic error. 
I dont have much experience to tell if this trade off is acceptable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Create-new-reference-DCT-file.patch
Type: application/mbox
Size: 4557 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090330/c7ce7b1a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Change-over-to-new-reference-DCT-using-LGPL.patch
Type: application/mbox
Size: 12146 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090330/c7ce7b1a/attachment-0001.bin>



More information about the ffmpeg-devel mailing list