[FFmpeg-devel] [PATCH] jpeg2000: split off inverse MCT decoding as Jpeg2000DSP

James Almer jamrial at gmail.com
Thu Oct 2 01:08:18 CEST 2014


On 01/10/14 8:04 PM, Michael Niedermayer wrote:
> On Wed, Oct 01, 2014 at 05:14:38PM -0300, James Almer wrote:
>> This makes the addition of arch optimized functions easier.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavcodec/Makefile      |  2 +-
>>  libavcodec/jpeg2000dec.c | 71 +++++++++--------------------------
>>  libavcodec/jpeg2000dsp.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++
>>  libavcodec/jpeg2000dsp.h | 35 +++++++++++++++++
>>  libavcodec/jpeg2000dwt.h |  3 +-
>>  5 files changed, 153 insertions(+), 56 deletions(-)
>>  create mode 100644 libavcodec/jpeg2000dsp.c
>>  create mode 100644 libavcodec/jpeg2000dsp.h
> [...]
>> +static void mct_decode97_float(void *_src0, void *_src1, void *_src2, int csize)
>> +{
>> +    float *src0 = _src0, *src1 = _src1, *src2 = _src2;
>> +    float i0f, i1f, i2f;
>> +    int i;
>> +
>> +    for (i = 0; i < csize; i++) {
>> +        i0f = *src0 + (f_ict_params[0] * *src2);
>> +        i1f = *src0 - (f_ict_params[1] * *src1)
>> +                    - (f_ict_params[2] * *src2);
>> +        i2f = *src0 + (f_ict_params[3] * *src1);
>> +        *src0++ = i0f;
>> +        *src1++ = i1f;
>> +        *src2++ = i2f;
>> +    }
>> +}
>> +
>> +static void mct_decode97_int(void *_src0, void *_src1, void *_src2, int csize)
>> +{
>> +    int32_t *src0 = _src0, *src1 = _src1, *src2 = _src2;
>> +    int32_t i0, i1, i2;
>> +    int i;
>> +
>> +    for (i = 0; i < csize; i++) {
>> +        i0 = *src0 + (((i_ict_params[0] * *src2) + (1 << 15)) >> 16);
>> +        i1 = *src0 - (((i_ict_params[1] * *src1) + (1 << 15)) >> 16)
>> +                   - (((i_ict_params[2] * *src2) + (1 << 15)) >> 16);
>> +        i2 = *src0 + (((i_ict_params[3] * *src1) + (1 << 15)) >> 16);
>> +        *src0++ = i0;
>> +        *src1++ = i1;
>> +        *src2++ = i2;
>> +    }
>> +}
>> +
>> +static void mct_decode53(void *_src0, void *_src1, void *_src2, int csize)
> 
> the function names are not good
> the code is not related to the 5/3 and 9/7 wavelets

Well, the code checks for one of the three DWTType values (FF_DWT97, FF_DWT97_INT and
FF_DWT53) to choose what to run, so these names seemed adequate to me.

What names do you suggest then?


More information about the ffmpeg-devel mailing list