[Ffmpeg-devel] ADI Blackfin port and optimization

Michael Niedermayer michaelni
Wed Aug 23 21:18:02 CEST 2006


Hi

On Wed, Aug 23, 2006 at 02:22:10PM -0400, Michael Benjamin wrote:
> attached patch includes assembly optimizations for DCT/IDCT.



[...]
> +static void simple_fdct_bfin( DCTELEM *block )
> +{
> +    DCTELEM fdctCoef[8];
> +    uint32_t computeTemp_array[64];
> +    uint32_t *computeTemp = computeTemp_array;
> +    int i;
> +    for (i = 0; i<64; i++) {
> +        block[i] = (block[i]<<3);
> +    }

cant that be merged into the dct / its coefficients / the amount of shift 
right at the end?


> +    fdctCoef[0] = 0x5a82;  //  C4
> +    fdctCoef[1] = 0x5a82;  //  C4
> +    fdctCoef[2] = 0x30Fb;  //cos(3pi/8)  C6
> +    fdctCoef[3] = 0x7641;  //cos(pi/8)   C2
> +    fdctCoef[4] = 0x18F8;  //cos(7pi/16)
> +    fdctCoef[5] = 0x7D8A;  //cos(pi/16)
> +    fdctCoef[6] = 0x471c;  //cos(5pi/16)
> +    fdctCoef[7] = 0x6A6d;  //cos(3pi/16)
> +
> +    r8x8dct_bfin( block, fdctCoef, computeTemp );

what is computeTemp good for ?


[...]

>  void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
>  {
> +    const int idct_algo= avctx->idct_algo;
> +    c->fdct = simple_fdct_bfin;

this should be under if(avctx->dct_algo ...


> +    if(idct_algo==FF_IDCT_AUTO||idct_algo==FF_IDCT_BFIN){
> +        c->idct = simple_idct_bfin;
> +    }

IDCTs which are selected automatically by default (especially for encoding) 
must
1. provide a binary identical portable implementation in C
2. specify by using user data tags in the video stream which idct is used
3. be reasonable accurate, IEEE is absolutely required but if it "looks" bad in
   libavcodec/dct-test.c (like the libmpeg2 idct) then its not ok

and would the idct benefit (speedwise) from having the input elements
in another order? if so change the idct_permutation_type

and last ... dont ignore avctx->lowres

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list