changeset 5252:e4b9ca118ab1 libavcodec

Replace function declarations with macro Patch by by Christophe GISQUET ( echo $name| tr "[A-Z ]" "[a-z.]"|sed s/.*/&@free.fr/ ) Thread: [PATCH] Clean up in C VC-1 DSP functions
author kostya
date Sun, 08 Jul 2007 13:26:13 +0000
parents f2a1fa269c12
children a69976bf878c
files vc1dsp.c
diffstat 1 files changed, 18 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/vc1dsp.c	Sun Jul 08 13:23:44 2007 +0000
+++ b/vc1dsp.c	Sun Jul 08 13:26:13 2007 +0000
@@ -375,65 +375,29 @@
 /* this one is defined in dsputil.c */
 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
 
-static void put_vc1_mspel_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x1, rnd);
-}
-
-static void put_vc1_mspel_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x2, rnd);
-}
-
-static void put_vc1_mspel_mc30_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x3, rnd);
-}
-
-static void put_vc1_mspel_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x4, rnd);
-}
-
-static void put_vc1_mspel_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x5, rnd);
-}
-
-static void put_vc1_mspel_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x6, rnd);
-}
-
-static void put_vc1_mspel_mc31_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x7, rnd);
+#define PUT_VC1_MSPEL(a, b)\
+static void put_vc1_mspel_mc ## a ## b ##_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
+     vc1_mspel_mc(dst, src, stride, (a)&((b<<2)), rnd);                 \
 }
 
-static void put_vc1_mspel_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x8, rnd);
-}
-
-static void put_vc1_mspel_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x9, rnd);
-}
+PUT_VC1_MSPEL(1, 0)
+PUT_VC1_MSPEL(2, 0)
+PUT_VC1_MSPEL(3, 0)
 
-static void put_vc1_mspel_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xA, rnd);
-}
-
-static void put_vc1_mspel_mc32_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xB, rnd);
-}
+PUT_VC1_MSPEL(0, 1)
+PUT_VC1_MSPEL(1, 1)
+PUT_VC1_MSPEL(2, 1)
+PUT_VC1_MSPEL(3, 1)
 
-static void put_vc1_mspel_mc03_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xC, rnd);
-}
-
-static void put_vc1_mspel_mc13_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xD, rnd);
-}
+PUT_VC1_MSPEL(0, 2)
+PUT_VC1_MSPEL(1, 2)
+PUT_VC1_MSPEL(2, 2)
+PUT_VC1_MSPEL(3, 2)
 
-static void put_vc1_mspel_mc23_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xE, rnd);
-}
-
-static void put_vc1_mspel_mc33_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xF, rnd);
-}
+PUT_VC1_MSPEL(0, 3)
+PUT_VC1_MSPEL(1, 3)
+PUT_VC1_MSPEL(2, 3)
+PUT_VC1_MSPEL(3, 3)
 
 void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
     dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;