[Ffmpeg-devel] [RFC] libavcodec/mpeg12.c refactor

Nigel Pearson nigel
Wed Feb 7 01:19:08 CET 2007


Aeons ago, Michael wrote:

> Subject: Re: [Ffmpeg-devel] MPEG-2 Acceleration Under Mac OS X -  
> Can We Move This Forward?
>
> Hi
>
> On Tue, Aug 29, 2006 at 11:15:49AM +0200, Michael Niedermayer wrote:
> [...]
>> PS: also if anyone does that, please merge the decode_block_foobar 
>> () and
>> decode_block_foobar_fast() functions they are nearly identical and  
>> i should
>> have implemented them like descibed above furthermore merging them  
>> will half
>> the number of functions which need to be changed for apple hw  
>> decoding support
>
> additional tip, to merge the functions, dump them to a file each  
> and run diff
> over them


Well, I finally got around to trying this. I know the attached
diff isn't commit ready (I have purposely used bad formatting,
and left dead code there, to minimise the size of the diff),
but I would appreciate comments. e.g. Is this what was meant?


Changes seem to pass regression tests, but I
suspect that these don't use CODEC_FLAG2_FAST?

I have not benchmarked these (still haven't worked out how).
They may be marginally slower due to the extra conditional -
if (fast) - inside some of the loops. If anyone has a clever
way to optimise this, please share!


Change 1:
mpeg2_fast_decode_block_intra(...) => mpeg2_decode_block_intra(...,  
DECODE_FAST)
mpeg2_decode_block_intra(...)      => mpeg2_decode_block_intra(...,  
DECODE_SLOW)

There were only trivial diffs between these functions.
Fast version used a pointer instead of an extra scantable
index int, and the non-fast version has some debug,
damaged ac-tex checking and mismatched block stuff.


Change 2:
mpeg1_fast_decode_block_inter(...) => mpeg1_decode_block_inter(...,  
DECODE_FAST)
mpeg1_decode_block_inter(...)      => mpeg1_decode_block_inter(...,  
DECODE_SLOW)
mpeg2_fast_decode_block_non_intra(...) => mpeg2_decode_block_non_intra 
(..., DECODE_FAST)
mpeg2_decode_block_non_intra(...)      => mpeg2_decode_block_non_intra 
(..., DECODE_SLOW)

These function pairs were also nearly identical. Fast
versions didn't use quant_matrix[], check for damaged
ac-tex or deal with mismatched blocks.



% svn update
At revision 7850.

% svn diff libavcodec/mpeg12.c >mpeg12.c-refactor-1.diff

%

--
Nigel Pearson, nigel at ind.tansu.com.au|"Gentlemen,
Telstra Net. Eng., Sydney, Australia | you can't fight in here-
Office: 9202 3900    Fax:  9261 3912 |   this is the war room!"
Mobile: 0408 664435  Home: 9792 6998 |     Dr Strangelove
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg12.c-refactor-1.diff
Type: application/octet-stream
Size: 12598 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070207/f272e85e/attachment.obj>
-------------- next part --------------





More information about the ffmpeg-devel mailing list