]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bfin/dsputil_bfin.c
vorbisdec: Rename silly "class_" variable to plain "class".
[ffmpeg] / libavcodec / bfin / dsputil_bfin.c
index 4737b15218b914be2e35a12e1182144fbbec5b26..65d0308018822c28eac1d6f29e93f9048c5498ac 100644 (file)
@@ -4,62 +4,29 @@
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
  * Copyright (c) 2006 Michael Benjamin <michael.benjamin@analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <unistd.h>
 #include "libavcodec/avcodec.h"
 #include "libavcodec/dsputil.h"
 #include "dsputil_bfin.h"
 
 int off;
 
-
-extern void ff_bfin_idct (DCTELEM *block) attribute_l1_text;
-extern void ff_bfin_fdct (DCTELEM *block) attribute_l1_text;
-extern void ff_bfin_vp3_idct (DCTELEM *block);
-extern void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block);
-extern void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block);
-extern void ff_bfin_add_pixels_clamped (DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text;
-extern void ff_bfin_put_pixels_clamped (DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text;
-extern void ff_bfin_diff_pixels (DCTELEM *block, uint8_t *s1, uint8_t *s2, int stride)  attribute_l1_text;
-extern void ff_bfin_get_pixels  (DCTELEM *restrict block, const uint8_t *pixels, int line_size) attribute_l1_text;
-extern int  ff_bfin_pix_norm1  (uint8_t * pix, int line_size) attribute_l1_text;
-extern int  ff_bfin_z_sad8x8   (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text;
-extern int  ff_bfin_z_sad16x16 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text;
-
-extern void ff_bfin_z_put_pixels16_xy2     (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h) attribute_l1_text;
-extern void ff_bfin_z_put_pixels8_xy2      (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h) attribute_l1_text;
-extern void ff_bfin_put_pixels16_xy2_nornd (uint8_t *block, const uint8_t *s0, int line_size, int h) attribute_l1_text;
-extern void ff_bfin_put_pixels8_xy2_nornd  (uint8_t *block, const uint8_t *s0, int line_size, int h) attribute_l1_text;
-
-
-extern int  ff_bfin_pix_sum (uint8_t *p, int stride) attribute_l1_text;
-
-extern void ff_bfin_put_pixels8uc        (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h) attribute_l1_text;
-extern void ff_bfin_put_pixels16uc       (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h) attribute_l1_text;
-extern void ff_bfin_put_pixels8uc_nornd  (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h) attribute_l1_text;
-extern void ff_bfin_put_pixels16uc_nornd (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h) attribute_l1_text;
-
-extern int ff_bfin_sse4  (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text;
-extern int ff_bfin_sse8  (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text;
-extern int ff_bfin_sse16 (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text;
-
-
 static void bfin_idct_add (uint8_t *dest, int line_size, DCTELEM *block)
 {
     ff_bfin_idct (block);
@@ -77,7 +44,7 @@ static void bfin_clear_blocks (DCTELEM *blocks)
 {
     // This is just a simple memset.
     //
-    asm("P0=192; "
+    __asm__("P0=192; "
         "I0=%0;  "
         "R0=0;   "
         "LSETUP(clear_blocks_blkfn_lab,clear_blocks_blkfn_lab)LC0=P0;"
@@ -128,7 +95,7 @@ static void bfin_put_pixels16_xy2 (uint8_t *block, const uint8_t *s0, int line_s
     ff_bfin_z_put_pixels16_xy2 (block,s0,line_size, line_size, h);
 }
 
-void bfin_put_pixels8_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
+static void bfin_put_pixels8_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
 {
     ff_bfin_put_pixels8uc_nornd (block, pixels, pixels, line_size, h);
 }
@@ -144,7 +111,7 @@ static void bfin_put_pixels8_y2_nornd (uint8_t *block, const uint8_t *pixels, in
 }
 
 
-void bfin_put_pixels16_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
+static void bfin_put_pixels16_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
 {
     ff_bfin_put_pixels16uc_nornd (block, pixels, pixels, line_size, h);
 }
@@ -242,8 +209,8 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
     c->sad[0]             = bfin_pix_abs16;
     c->sad[1]             = bfin_pix_abs8;
 
-    c->vsad[0]            = bfin_vsad;
-    c->vsad[4]            = bfin_vsad_intra16;
+/*     c->vsad[0]            = bfin_vsad; */
+/*     c->vsad[4]            = bfin_vsad_intra16; */
 
     /* TODO [0] 16  [1] 8 */
     c->pix_abs[0][0] = bfin_pix_abs16;
@@ -261,18 +228,6 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
     c->sse[1] = ff_bfin_sse8;
     c->sse[2] = ff_bfin_sse4;
 
-
-    /**
-     * Halfpel motion compensation with rounding (a+b+1)>>1.
-     * This is an array[4][4] of motion compensation functions for 4
-     * horizontal blocksizes (8,16) and the 4 halfpel positions
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination where the result is stored
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-
     c->put_pixels_tab[0][0] = bfin_put_pixels16;
     c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
     c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
@@ -286,20 +241,23 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
     c->put_no_rnd_pixels_tab[1][0] = bfin_put_pixels8_nornd;
     c->put_no_rnd_pixels_tab[1][1] = bfin_put_pixels8_x2_nornd;
     c->put_no_rnd_pixels_tab[1][2] = bfin_put_pixels8_y2_nornd;
-    c->put_no_rnd_pixels_tab[1][3] = ff_bfin_put_pixels8_xy2_nornd;
+/*     c->put_no_rnd_pixels_tab[1][3] = ff_bfin_put_pixels8_xy2_nornd; */
 
     c->put_no_rnd_pixels_tab[0][0] = bfin_put_pixels16_nornd;
     c->put_no_rnd_pixels_tab[0][1] = bfin_put_pixels16_x2_nornd;
     c->put_no_rnd_pixels_tab[0][2] = bfin_put_pixels16_y2_nornd;
-    c->put_no_rnd_pixels_tab[0][3] = ff_bfin_put_pixels16_xy2_nornd;
+/*     c->put_no_rnd_pixels_tab[0][3] = ff_bfin_put_pixels16_xy2_nornd; */
+
+    if (avctx->dct_algo == FF_DCT_AUTO)
+        c->fdct               = ff_bfin_fdct;
 
-    c->idct_permutation_type = FF_NO_IDCT_PERM;
-    c->fdct                  = ff_bfin_fdct;
     if (avctx->idct_algo==FF_IDCT_VP3) {
+        c->idct_permutation_type = FF_NO_IDCT_PERM;
         c->idct               = ff_bfin_vp3_idct;
         c->idct_add           = ff_bfin_vp3_idct_add;
         c->idct_put           = ff_bfin_vp3_idct_put;
-    } else {
+    } else if (avctx->idct_algo == FF_IDCT_AUTO) {
+        c->idct_permutation_type = FF_NO_IDCT_PERM;
         c->idct               = ff_bfin_idct;
         c->idct_add           = bfin_idct_add;
         c->idct_put           = bfin_idct_put;