From da785231ea0b82b5c2526babbb2871c935b21a87 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 22 Jan 2014 05:21:02 -0800 Subject: bfin: Refactor duplicated assembly-related macros --- libavcodec/bfin/config_bfin.h | 66 -------------------------------------- libavcodec/bfin/fdct_bfin.S | 17 ++++------ libavcodec/bfin/hpel_pixels_bfin.S | 2 +- libavcodec/bfin/idct_bfin.S | 13 ++------ libavcodec/bfin/pixels_bfin.S | 3 +- libavcodec/bfin/vp3_idct_bfin.S | 13 ++------ libavutil/bfin/asm.h | 54 +++++++++++++++++++++++++++++++ libswscale/bfin/internal_bfin.S | 18 ++--------- 8 files changed, 71 insertions(+), 115 deletions(-) delete mode 100644 libavcodec/bfin/config_bfin.h create mode 100644 libavutil/bfin/asm.h diff --git a/libavcodec/bfin/config_bfin.h b/libavcodec/bfin/config_bfin.h deleted file mode 100644 index 63f9e3224c..0000000000 --- a/libavcodec/bfin/config_bfin.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2007 Marc Hoffman - * - * This file is part of Libav. - * - * 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. - * - * 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 Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * low level assembler interface wrapper - * - * DEFUN(put_pixels_clamped,mL1, - * (int16_t *block, uint8_t *dest, int line_size)): - * - * body - * - * rts; - */ - -#ifndef AVCODEC_BFIN_CONFIG_BFIN_H -#define AVCODEC_BFIN_CONFIG_BFIN_H - -#include "config.h" - -#ifndef DEFUN - -#define mL3 .text -#ifndef mL1 -#if defined(__FDPIC__) && CONFIG_SRAM -#define mL1 .l1.text -#else -#define mL1 mL3 -#endif -#endif /* mL1 */ - -#define DEFUN(fname, where, interface) \ - .section where; \ - .global _ff_bfin_ ## fname; \ - .type _ff_bfin_ ## fname, STT_FUNC; \ - .align 8; \ - _ff_bfin_ ## fname - -#define DEFUN_END(fname) \ - .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname - -#ifdef __FDPIC__ -#define RELOC(reg, got, obj) reg = [got + obj@GOT17M4] -#else -#define RELOC(reg, got, obj) reg.L = obj; reg.H = obj -#endif - -#endif /* DEFUN */ - -#endif /* AVCODEC_BFIN_CONFIG_BFIN_H */ diff --git a/libavcodec/bfin/fdct_bfin.S b/libavcodec/bfin/fdct_bfin.S index c923d760e7..2525e0dd18 100644 --- a/libavcodec/bfin/fdct_bfin.S +++ b/libavcodec/bfin/fdct_bfin.S @@ -125,21 +125,16 @@ DCT BFINfdct: err_inf=2 err2=0.16425938 syserr=0.00795000 maxout=2098 blockSumEr DCT BFINfdct: 92.1 kdct/s */ -#include "config.h" -#include "config_bfin.h" - -#if defined(__FDPIC__) && CONFIG_SRAM -.section .l1.data.B,"aw",@progbits -#else -.data -#endif +#include "libavutil/bfin/asm.h" + +SECTION_L1_DATA_B + .align 4; dct_coeff: .short 0x5a82, 0x2d41, 0x187e, 0x3b21, 0x0c7c, 0x3ec5, 0x238e, 0x3537; -#if defined(__FDPIC__) && CONFIG_SRAM -.section .l1.data.A,"aw",@progbits -#endif +SECTION_L1_DATA_A + .align 4 vtmp: .space 128 diff --git a/libavcodec/bfin/hpel_pixels_bfin.S b/libavcodec/bfin/hpel_pixels_bfin.S index 8bed5c0410..d311fdfe5b 100644 --- a/libavcodec/bfin/hpel_pixels_bfin.S +++ b/libavcodec/bfin/hpel_pixels_bfin.S @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config_bfin.h" +#include "libavutil/bfin/asm.h" /* motion compensation diff --git a/libavcodec/bfin/idct_bfin.S b/libavcodec/bfin/idct_bfin.S index 0eeffc2016..dd427e7ffa 100644 --- a/libavcodec/bfin/idct_bfin.S +++ b/libavcodec/bfin/idct_bfin.S @@ -55,14 +55,9 @@ IDCT BFINidct: 88.3 kdct/s */ -#include "config.h" -#include "config_bfin.h" +#include "libavutil/bfin/asm.h" -#if defined(__FDPIC__) && CONFIG_SRAM -.section .l1.data.B,"aw",@progbits -#else -.data -#endif +SECTION_L1_DATA_B .align 4; coefs: @@ -77,9 +72,7 @@ coefs: .short 0x18F9; //cos(7pi/16) .short 0x7D8A; //cos(pi/16) -#if defined(__FDPIC__) && CONFIG_SRAM -.section .l1.data.A,"aw",@progbits -#endif +SECTION_L1_DATA_A vtmp: .space 256 diff --git a/libavcodec/bfin/pixels_bfin.S b/libavcodec/bfin/pixels_bfin.S index 70d9de5e7a..e19455b974 100644 --- a/libavcodec/bfin/pixels_bfin.S +++ b/libavcodec/bfin/pixels_bfin.S @@ -18,7 +18,8 @@ * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config_bfin.h" + +#include "libavutil/bfin/asm.h" DEFUN(put_pixels_clamped,mL1, (int16_t *block, uint8_t *dest, int line_size)): diff --git a/libavcodec/bfin/vp3_idct_bfin.S b/libavcodec/bfin/vp3_idct_bfin.S index fec8d78f53..615cae9cc9 100644 --- a/libavcodec/bfin/vp3_idct_bfin.S +++ b/libavcodec/bfin/vp3_idct_bfin.S @@ -28,14 +28,9 @@ Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0. */ -#include "config.h" -#include "config_bfin.h" +#include "libavutil/bfin/asm.h" -#if defined(__FDPIC__) && CONFIG_SRAM -.section .l1.data.B,"aw",@progbits -#else -.data -#endif +SECTION_L1_DATA_B .align 4; coefs: @@ -50,9 +45,7 @@ coefs: .short 0x18F9; //cos(7pi/16) .short 0x7D8A; //cos(pi/16) -#if defined(__FDPIC__) && CONFIG_SRAM -.section .l1.data.A,"aw",@progbits -#endif +SECTION_L1_DATA_A vtmp: .space 256 diff --git a/libavutil/bfin/asm.h b/libavutil/bfin/asm.h new file mode 100644 index 0000000000..6bfa0f3860 --- /dev/null +++ b/libavutil/bfin/asm.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Marc Hoffman + * + * This file is part of Libav. + * + * 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. + * + * 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BFIN_ASM_H +#define AVUTIL_BFIN_ASM_H + +#include "config.h" + +#define mL3 .text + +#if defined(__FDPIC__) && CONFIG_SRAM +#define mL1 .l1.text +#define SECTION_L1_DATA_A .section .l1.data.A,"aw",@progbits +#define SECTION_L1_DATA_B .section .l1.data.B,"aw",@progbits +#else +#define mL1 mL3 +#define SECTION_L1_DATA_A +#define SECTION_L1_DATA_B .data +#endif + +#define DEFUN(fname, where, interface) \ + .section where; \ + .global _ff_bfin_ ## fname; \ + .type _ff_bfin_ ## fname, STT_FUNC; \ + .align 8; \ + _ff_bfin_ ## fname + +#define DEFUN_END(fname) \ + .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname + +#ifdef __FDPIC__ +#define RELOC(reg, got, obj) reg = [got + obj@GOT17M4] +#else +#define RELOC(reg, got, obj) reg.L = obj; reg.H = obj +#endif + +#endif /* AVUTIL_BFIN_ASM_H */ diff --git a/libswscale/bfin/internal_bfin.S b/libswscale/bfin/internal_bfin.S index b007f07f53..dca8448a3f 100644 --- a/libswscale/bfin/internal_bfin.S +++ b/libswscale/bfin/internal_bfin.S @@ -93,23 +93,9 @@ huge variation on the reference codes on Blackfin I guess it must have to do with the memory system. */ -#define mL3 .text -#if defined(__FDPIC__) && CONFIG_SRAM -#define mL1 .l1.text -#else -#define mL1 mL3 -#endif -#define MEM mL1 - -#define DEFUN(fname,where,interface) \ - .section where; \ - .global _ff_bfin_ ## fname; \ - .type _ff_bfin_ ## fname, STT_FUNC; \ - .align 8; \ - _ff_bfin_ ## fname +#include "libavutil/bfin/asm.h" -#define DEFUN_END(fname) \ - .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname +#define MEM mL1 .text -- cgit v1.2.3