[FFmpeg-devel] [PATCH] Indeo5 decoder
Maxim
max_pole
Tue Apr 7 22:50:50 CEST 2009
Michael Niedermayer schrieb:
> On Tue, Apr 07, 2009 at 05:08:34PM +0200, Maxim wrote:
>
>> Michael Niedermayer schrieb:
>>
>>> On Tue, Apr 07, 2009 at 10:52:34AM +0200, Maxim wrote:
>>>
>>>
>>>> Michael Niedermayer schrieb:
>>>>
>>>>
>>>>> On Mon, Apr 06, 2009 at 08:41:57PM +0200, Maxim wrote:
>>>>>
>>>>>
>>> [...]
>>>
>>>
>>>>>> +
>>>>>> +
>>>>>> +/**
>>>>>> + * Build static indeo5 dequantization tables.
>>>>>> + */
>>>>>> +static av_cold void build_dequant_tables(void)
>>>>>> +{
>>>>>> + int mat, i, lev;
>>>>>> + uint32_t q1, q2, sf1, sf2;
>>>>>> +
>>>>>> + for (mat = 0; mat < 5; mat++) {
>>>>>> + /* build 8x8 intra/inter tables for all 24 quant levels */
>>>>>> + for (lev = 0; lev < 24; lev++) {
>>>>>> + sf1 = ivi5_scale_quant_8x8_intra[mat][lev];
>>>>>> + sf2 = ivi5_scale_quant_8x8_inter[mat][lev];
>>>>>> +
>>>>>> + for (i = 0; i < 64; i++) {
>>>>>> + q1 = (ivi5_base_quant_8x8_intra[mat][i] * sf1) >> 8;
>>>>>> + q2 = (ivi5_base_quant_8x8_inter[mat][i] * sf2) >> 8;
>>>>>> + deq8x8_intra[mat][lev][i] = av_clip(q1, 1, 255);
>>>>>> + deq8x8_inter[mat][lev][i] = av_clip(q2, 1, 255);
>>>>>>
>>>>>>
>>>>>>
>>>>> 1..255 but they arent uint8_t
>>>>> av_clip() seems useless and the whole table precalc maybe as well
>>>>>
>>>>>
>>>>>
>>>> They were made uint16_t in order to achieve a compatibility with Indeo4
>>>> that uses 9bits dequant tables...
>>>> The table precalculation should help avoiding huge static tables...
>>>>
>>>>
>>> let me clarify my question, what is gained by merging a multiply and shift
>>> into the table?
>>> is it faster? if so then by how much?
>>>
>>>
>> It provides a possibility to calculate the scalefactors using integer
>> operations without floatig-point math and it's therefore faster...
>>
>
> moving the operations from one function to another does not change
> anything related to float vs int.
> My question is just why you create a bigger table instead of doing it during
> block decode?
> Maybe its faster, but you did not say this and its definitly more messy
> as is.
>
Oh, I see, my thought was just to make the decoding faster. This step
was separated because it requires a multiplication. I didn't consider
this way because I always learned to avoid multiplies wherever possible.
It would be surely faster to use the table lookup but I don't know how
much...
I'll try to figure it out next days...
Regards
Maxim
More information about the ffmpeg-devel
mailing list