[Ffmpeg-devel] BlackFin lowlevel pixel operations PATCH

Marc Hoffman mmh
Wed Mar 28 03:38:53 CEST 2007


Michael Niedermayer writes:
 > Hi
 > 
 > On Tue, Mar 27, 2007 at 07:52:35AM -0400, Marc Hoffman wrote:
 > > Diego Biurrun writes:
 > >  > On Tue, Mar 27, 2007 at 07:11:33AM -0400, Marc Hoffman wrote:
 > >  > > Diego Biurrun writes:
 > >  > >  > On Mon, Mar 26, 2007 at 10:00:39PM -0400, Marc Hoffman wrote:
 > >  > >  > Content-Description: message body text
 > >  > >  > > 
 > >  > >  > > This is the a set of video optimization for the Blackfin processor it
 > >  > >  > > includes most of the low level pixel operations.
 > >  > > 
 > >  > > Is this the right one version 2 changes to 2.1 and a couple of other
 > >  > > words.  Good catch, just double check this one.
 > >  > > 
 > >  > 
 > >  > Yes, this one is correct.
 > >  > 
 > >  > Diego
 > > 
 > > Changes made.
 > 
 > tabs are forbidden in svn and please provide dct-test.c output fo the new idct
 > 
 > also function names starting with _ are reserved
 > 
 > asm not reviewed as i dont know blackfin asm
 > 
 > [...]
 > -- 

I kind of have to kludge up the dct-test mechanism can we agree on the
appropriate mechanism for changes to the dct-test?

oh by the way you help me find an error of 10 in the idct, I have a
modified routine which now passes correctly. I guess that would mean I
owe you a beer or two + an awesome story that will make you laugh your
head off if we ever actually meet. So the idct codes have changed to
meet spec.

root:/u/ffmpeg/bhead/libavcodec> ./dct-test 
ffmpeg DCT/IDCT test 
new error 1 0 
new error 2 1

    2  -131    -6   -48   -36    33   -83    24 
   34    52   -24   -15     5    92    57   143 
  -67   -43    -1    74   -16     5   -71    32 
  -78   106    92   -34   -38    81    20   -18 
    7   -62    40     2   -15    90   -62   -83 
  -83     1  -104   -13    43   -19     7    11 
  -63    31    12   -29    83    72    21    10 
  -17   -63   -15    73    50   -91   159   -14 
DCT BFINfdct: err_inf=2 err2=0.16425938 syserr=0.00795000 maxout=2098 blockSumErr=27
DCT BFINfdct: 92.0 kdct/s
root:/u/ffmpeg/bhead/libavcodec> ./dct-test -i
ffmpeg DCT/IDCT test
new error 1 0

    8    15    -2    21    24    17     0    10 
    2   -10    -5    -5    -3     7   -14    -3 
    2   -13   -10   -19    18    -6     6    -2 
    9     4    16    -3     9    12    10    15 
   15    -9    -2    10     1    16     0   -15 
  -15     5     7     3    13     0    13    20 
   -6   -15    24     9   -18     1     9   -22 
   -8    25    23     2    -7     0    30    13 
DCT BFINidct: err_inf=1 err2=0.01002344 syserr=0.00150000 maxout=266 blockSumErr=64
DCT BFINidct: 80.0 kdct/s
root:/u/ffmpeg/bhead/libavcodec> 



Now I'm thinking that we might want to build something a little more configurable for this dct test

struct {	 
       dct1,
       dct2,
blah blah
  
} dctsf

#ifdef MMX

blah table of dct functions

#elif ALTIVEC

blah

#else BFIN

blah

#endif

then call each one via indirection but otherwise here would be a stab
at the changes: Not sure who would do such a task I could do it if you
want to make it easier for others to test their backends.

Marc

Current DCT-TEST hacks:


Index: dct-test.c
===================================================================
--- dct-test.c	(revision 8517)
+++ dct-test.c	(working copy)
@@ -39,8 +39,54 @@
 #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
 #endif
 
+
 #undef printf
 
+#ifdef ARCH_BFIN
+
+extern void idct_bfin (DCTELEM *block) ;
+extern void ieeeidct_bfin (DCTELEM *block) ;
+extern void fdct_bfin (DCTELEM *block) ;
+void dummy_function (DCTELEM *block)
+{
+  printf ("dummy function called\n");
+  abort ();
+}
+
+#define emms(x)
+
+#define ff_mmx_fdct dummy_function
+#define ff_mmx_idct dummy_function
+#define ff_mmxext_idct dummy_function
+#define ff_simple_idct_mmx dummy_function
+#define ff_idct_xvid_mmx dummy_function
+#define ff_idct_xvid_mmx2 dummy_function
+#define ff_fdct_mmx dummy_function
+#define ff_fdct_mmx2 dummy_function
+
+#endif
+
 void *fast_memcpy(void *a, const void *b, size_t c){return memcpy(a,b,c);};
 
 /* reference fdct/idct */
@@ -80,6 +126,10 @@
 
 #define NB_ITS 20000
 #define NB_ITS_SPEED 50000
+//#undef NB_ITS
+//#undef NB_ITS_SPEED
+//#define NB_ITS 1000
+//#define NB_ITS_SPEED 1000
 
 static short idct_mmx_perm[64];
 
@@ -202,8 +252,11 @@
         blockSumErr=0;
         for(i=0;i<64;i++) {
             v = abs(block[i] - block1[i]);
-            if (v > err_inf)
+            if (v > err_inf) {
+	      printf ("new error %d %d\n", v, err_inf);
+
                 err_inf = v;
+	    }
             err2 += v * v;
             sysErr[i] += block[i] - block1[i];
             blockSumErr += v;
@@ -505,21 +558,33 @@
         idct248_error("SIMPLE-C", simple_idct248_put);
     } else {
         if (!test_idct) {
+#if 0
             dct_error("REF-DBL", 0, fdct, fdct, test); /* only to verify code ! */
             dct_error("IJG-AAN-INT", 0, fdct_ifast, fdct, test);
             dct_error("IJG-LLM-INT", 0, ff_jpeg_fdct_islow, fdct, test);
+#endif
+#ifndef ARCH_BFIN
             dct_error("MMX", 0, ff_fdct_mmx, fdct, test);
             dct_error("MMX2", 0, ff_fdct_mmx2, fdct, test);
             dct_error("FAAN", 0, ff_faandct, fdct, test);
+#else
+            dct_error("BFINfdct", 0, fdct_bfin, fdct, test);
+#endif
         } else {
+#if 0
             dct_error("REF-DBL", 1, idct, idct, test);
             dct_error("INT", 1, j_rev_dct, idct, test);
+#endif
+#ifndef ARCH_BFIN
             dct_error("LIBMPEG2-MMX", 1, ff_mmx_idct, idct, test);
             dct_error("LIBMPEG2-MMXEXT", 1, ff_mmxext_idct, idct, test);
             dct_error("SIMPLE-C", 1, simple_idct, idct, test);
             dct_error("SIMPLE-MMX", 1, ff_simple_idct_mmx, idct, test);
             dct_error("XVID-MMX", 1, ff_idct_xvid_mmx, idct, test);
             dct_error("XVID-MMX2", 1, ff_idct_xvid_mmx2, idct, test);
+#else
+            dct_error("BFINidct", 0, simple_idct_blkfn, idct, test);
+#endif
             //        dct_error("ODIVX-C", 1, odivx_idct_c, idct);
             //printf(" test against odivx idct\n");
             //        dct_error("REF", 1, idct, odivx_idct_c);




More information about the ffmpeg-devel mailing list