annotate ffmpeg/libavcodec/h264qpel.c @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
yading@10 3 * Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
yading@10 4 *
yading@10 5 * This file is part of FFmpeg.
yading@10 6 *
yading@10 7 * FFmpeg is free software; you can redistribute it and/or
yading@10 8 * modify it under the terms of the GNU Lesser General Public
yading@10 9 * License as published by the Free Software Foundation; either
yading@10 10 * version 2.1 of the License, or (at your option) any later version.
yading@10 11 *
yading@10 12 * FFmpeg is distributed in the hope that it will be useful,
yading@10 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 15 * Lesser General Public License for more details.
yading@10 16 *
yading@10 17 * You should have received a copy of the GNU Lesser General Public
yading@10 18 * License along with FFmpeg; if not, write to the Free Software
yading@10 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 20 */
yading@10 21
yading@10 22 #include "h264qpel.h"
yading@10 23
yading@10 24 #define pixeltmp int16_t
yading@10 25 #define BIT_DEPTH 8
yading@10 26 #include "h264qpel_template.c"
yading@10 27 #undef BIT_DEPTH
yading@10 28
yading@10 29 #define BIT_DEPTH 9
yading@10 30 #include "h264qpel_template.c"
yading@10 31 #undef BIT_DEPTH
yading@10 32
yading@10 33 #define BIT_DEPTH 10
yading@10 34 #include "h264qpel_template.c"
yading@10 35 #undef BIT_DEPTH
yading@10 36 #undef pixeltmp
yading@10 37
yading@10 38 #define pixeltmp int32_t
yading@10 39 #define BIT_DEPTH 12
yading@10 40 #include "h264qpel_template.c"
yading@10 41 #undef BIT_DEPTH
yading@10 42
yading@10 43 #define BIT_DEPTH 14
yading@10 44 #include "h264qpel_template.c"
yading@10 45 #undef BIT_DEPTH
yading@10 46
yading@10 47
yading@10 48 void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
yading@10 49 {
yading@10 50 #undef FUNCC
yading@10 51 #define FUNCC(f, depth) f ## _ ## depth ## _c
yading@10 52
yading@10 53 #define dspfunc2(PFX, IDX, NUM, depth) \
yading@10 54 c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth); \
yading@10 55 c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth); \
yading@10 56 c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth); \
yading@10 57 c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth); \
yading@10 58 c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth); \
yading@10 59 c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth); \
yading@10 60 c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth); \
yading@10 61 c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth); \
yading@10 62 c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth); \
yading@10 63 c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth); \
yading@10 64 c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth); \
yading@10 65 c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth); \
yading@10 66 c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth); \
yading@10 67 c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth); \
yading@10 68 c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth); \
yading@10 69 c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)
yading@10 70
yading@10 71 #define SET_QPEL(depth) \
yading@10 72 dspfunc2(put_h264_qpel, 0, 16, depth); \
yading@10 73 dspfunc2(put_h264_qpel, 1, 8, depth); \
yading@10 74 dspfunc2(put_h264_qpel, 2, 4, depth); \
yading@10 75 dspfunc2(put_h264_qpel, 3, 2, depth); \
yading@10 76 dspfunc2(avg_h264_qpel, 0, 16, depth); \
yading@10 77 dspfunc2(avg_h264_qpel, 1, 8, depth); \
yading@10 78 dspfunc2(avg_h264_qpel, 2, 4, depth)
yading@10 79
yading@10 80 switch (bit_depth) {
yading@10 81 default:
yading@10 82 SET_QPEL(8);
yading@10 83 break;
yading@10 84 case 9:
yading@10 85 SET_QPEL(9);
yading@10 86 break;
yading@10 87 case 10:
yading@10 88 SET_QPEL(10);
yading@10 89 break;
yading@10 90 case 12:
yading@10 91 SET_QPEL(12);
yading@10 92 break;
yading@10 93 case 14:
yading@10 94 SET_QPEL(14);
yading@10 95 break;
yading@10 96 }
yading@10 97
yading@10 98 if (ARCH_ARM)
yading@10 99 ff_h264qpel_init_arm(c, bit_depth);
yading@10 100 if (ARCH_PPC)
yading@10 101 ff_h264qpel_init_ppc(c, bit_depth);
yading@10 102 if (ARCH_X86)
yading@10 103 ff_h264qpel_init_x86(c, bit_depth);
yading@10 104 }