aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/sh4
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-07 13:09:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-07 13:09:35 +0100
commitc4e394e46008c9e208f666d156f49f7ba500d73a (patch)
tree4c70acf89ede1f9d24ec3056bb2d586f98a12bcd /libavcodec/sh4
parentb5884db437eebe136efef63a8186b7b4b51b5525 (diff)
parent79dad2a932534d1155079f937649e099f9e5cc27 (diff)
downloadffmpeg-c4e394e46008c9e208f666d156f49f7ba500d73a.tar.gz
Merge commit '79dad2a932534d1155079f937649e099f9e5cc27'
* commit '79dad2a932534d1155079f937649e099f9e5cc27': dsputil: Separate h264chroma Conflicts: libavcodec/dsputil_template.c libavcodec/ppc/dsputil_ppc.c libavcodec/vc1dec.c libavcodec/vc1dsp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/sh4')
-rw-r--r--libavcodec/sh4/Makefile2
-rw-r--r--libavcodec/sh4/dsputil_align.c8
-rw-r--r--libavcodec/sh4/h264chroma_init.c132
-rw-r--r--libavcodec/sh4/qpel.c91
4 files changed, 134 insertions, 99 deletions
diff --git a/libavcodec/sh4/Makefile b/libavcodec/sh4/Makefile
index aa17eabd6e..f907408d9f 100644
--- a/libavcodec/sh4/Makefile
+++ b/libavcodec/sh4/Makefile
@@ -1,3 +1,5 @@
OBJS += sh4/dsputil_align.o \
sh4/dsputil_sh4.o \
sh4/idct_sh4.o \
+
+OBJS-$(CONFIG_H264CHROMA) += sh4/h264chroma_init.o \
diff --git a/libavcodec/sh4/dsputil_align.c b/libavcodec/sh4/dsputil_align.c
index 736942512d..d59a12ec56 100644
--- a/libavcodec/sh4/dsputil_align.c
+++ b/libavcodec/sh4/dsputil_align.c
@@ -369,14 +369,6 @@ av_cold void ff_dsputil_init_align(DSPContext *c, AVCodecContext *avctx)
/* dspfunc(avg_no_rnd_qpel, 1, 8); */
#undef dspfunc
- if (!high_bit_depth) {
- c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_sh4;
- c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_sh4;
- c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_sh4;
- c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_sh4;
- c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_sh4;
- c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_sh4;
- }
c->put_mspel_pixels_tab[0]= put_mspel8_mc00_sh4;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_sh4;
diff --git a/libavcodec/sh4/h264chroma_init.c b/libavcodec/sh4/h264chroma_init.c
new file mode 100644
index 0000000000..d15f0ae34e
--- /dev/null
+++ b/libavcodec/sh4/h264chroma_init.c
@@ -0,0 +1,132 @@
+/*
+ * aligned/packed access motion
+ *
+ * Copyright (c) 2001-2003 BERO <bero@geocities.co.jp>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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,
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <assert.h>
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavcodec/h264chroma.h"
+
+#define H264_CHROMA_MC(OPNAME, OP)\
+static void OPNAME ## h264_chroma_mc2_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
+ const int A=(8-x)*(8-y);\
+ const int B=( x)*(8-y);\
+ const int C=(8-x)*( y);\
+ const int D=( x)*( y);\
+ \
+ assert(x<8 && y<8 && x>=0 && y>=0);\
+\
+ do {\
+ int t0,t1,t2,t3; \
+ uint8_t *s0 = src; \
+ uint8_t *s1 = src+stride; \
+ t0 = *s0++; t2 = *s1++; \
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
+ dst+= stride;\
+ src+= stride;\
+ }while(--h);\
+}\
+\
+static void OPNAME ## h264_chroma_mc4_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
+ const int A=(8-x)*(8-y);\
+ const int B=( x)*(8-y);\
+ const int C=(8-x)*( y);\
+ const int D=( x)*( y);\
+ \
+ assert(x<8 && y<8 && x>=0 && y>=0);\
+\
+ do {\
+ int t0,t1,t2,t3; \
+ uint8_t *s0 = src; \
+ uint8_t *s1 = src+stride; \
+ t0 = *s0++; t2 = *s1++; \
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[2], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[3], (A*t1 + B*t0 + C*t3 + D*t2));\
+ dst+= stride;\
+ src+= stride;\
+ }while(--h);\
+}\
+\
+static void OPNAME ## h264_chroma_mc8_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
+ const int A=(8-x)*(8-y);\
+ const int B=( x)*(8-y);\
+ const int C=(8-x)*( y);\
+ const int D=( x)*( y);\
+ \
+ assert(x<8 && y<8 && x>=0 && y>=0);\
+\
+ do {\
+ int t0,t1,t2,t3; \
+ uint8_t *s0 = src; \
+ uint8_t *s1 = src+stride; \
+ t0 = *s0++; t2 = *s1++; \
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[2], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[3], (A*t1 + B*t0 + C*t3 + D*t2));\
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[4], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[5], (A*t1 + B*t0 + C*t3 + D*t2));\
+ t1 = *s0++; t3 = *s1++; \
+ OP(dst[6], (A*t0 + B*t1 + C*t2 + D*t3));\
+ t0 = *s0++; t2 = *s1++; \
+ OP(dst[7], (A*t1 + B*t0 + C*t3 + D*t2));\
+ dst+= stride;\
+ src+= stride;\
+ }while(--h);\
+}
+
+#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
+#define op_put(a, b) a = (((b) + 32)>>6)
+
+H264_CHROMA_MC(put_ , op_put)
+H264_CHROMA_MC(avg_ , op_avg)
+#undef op_avg
+#undef op_put
+
+av_cold void ff_h264chroma_init_sh4(H264ChromaContext *c, int bit_depth)
+{
+ const int high_bit_depth = bit_depth > 8;
+
+ if (!high_bit_depth) {
+ c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_sh4;
+ c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_sh4;
+ c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_sh4;
+ c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_sh4;
+ c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_sh4;
+ c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_sh4;
+ }
+}
diff --git a/libavcodec/sh4/qpel.c b/libavcodec/sh4/qpel.c
index 115ccbf0c8..c6d032bd07 100644
--- a/libavcodec/sh4/qpel.c
+++ b/libavcodec/sh4/qpel.c
@@ -359,97 +359,6 @@ static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y
}while(--h);
}
-#define H264_CHROMA_MC(OPNAME, OP)\
-static void OPNAME ## h264_chroma_mc2_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
- const int A=(8-x)*(8-y);\
- const int B=( x)*(8-y);\
- const int C=(8-x)*( y);\
- const int D=( x)*( y);\
- \
- assert(x<8 && y<8 && x>=0 && y>=0);\
-\
- do {\
- int t0,t1,t2,t3; \
- uint8_t *s0 = src; \
- uint8_t *s1 = src+stride; \
- t0 = *s0++; t2 = *s1++; \
- t1 = *s0++; t3 = *s1++; \
- OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
- dst+= stride;\
- src+= stride;\
- }while(--h);\
-}\
-\
-static void OPNAME ## h264_chroma_mc4_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
- const int A=(8-x)*(8-y);\
- const int B=( x)*(8-y);\
- const int C=(8-x)*( y);\
- const int D=( x)*( y);\
- \
- assert(x<8 && y<8 && x>=0 && y>=0);\
-\
- do {\
- int t0,t1,t2,t3; \
- uint8_t *s0 = src; \
- uint8_t *s1 = src+stride; \
- t0 = *s0++; t2 = *s1++; \
- t1 = *s0++; t3 = *s1++; \
- OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
- t1 = *s0++; t3 = *s1++; \
- OP(dst[2], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[3], (A*t1 + B*t0 + C*t3 + D*t2));\
- dst+= stride;\
- src+= stride;\
- }while(--h);\
-}\
-\
-static void OPNAME ## h264_chroma_mc8_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
- const int A=(8-x)*(8-y);\
- const int B=( x)*(8-y);\
- const int C=(8-x)*( y);\
- const int D=( x)*( y);\
- \
- assert(x<8 && y<8 && x>=0 && y>=0);\
-\
- do {\
- int t0,t1,t2,t3; \
- uint8_t *s0 = src; \
- uint8_t *s1 = src+stride; \
- t0 = *s0++; t2 = *s1++; \
- t1 = *s0++; t3 = *s1++; \
- OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
- t1 = *s0++; t3 = *s1++; \
- OP(dst[2], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[3], (A*t1 + B*t0 + C*t3 + D*t2));\
- t1 = *s0++; t3 = *s1++; \
- OP(dst[4], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[5], (A*t1 + B*t0 + C*t3 + D*t2));\
- t1 = *s0++; t3 = *s1++; \
- OP(dst[6], (A*t0 + B*t1 + C*t2 + D*t3));\
- t0 = *s0++; t2 = *s1++; \
- OP(dst[7], (A*t1 + B*t0 + C*t3 + D*t2));\
- dst+= stride;\
- src+= stride;\
- }while(--h);\
-}
-
-#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
-#define op_put(a, b) a = (((b) + 32)>>6)
-
-H264_CHROMA_MC(put_ , op_put)
-H264_CHROMA_MC(avg_ , op_avg)
-#undef op_avg
-#undef op_put
-
#define QPEL_MC(r, OPNAME, RND, OP) \
static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\