2013-01-24 04:24:53 +00:00
|
|
|
/*
|
|
|
|
* H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
|
|
|
|
* Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
*
|
2013-01-24 13:44:34 +00:00
|
|
|
* This file is part of FFmpeg.
|
2013-01-24 04:24:53 +00:00
|
|
|
*
|
2013-01-24 13:44:34 +00:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2013-01-24 04:24:53 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2013-01-24 13:44:34 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2013-01-24 04:24:53 +00:00
|
|
|
* 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
|
2013-01-24 13:44:34 +00:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2013-01-24 04:24:53 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "h264qpel.h"
|
|
|
|
|
2013-01-24 13:44:34 +00:00
|
|
|
#define pixeltmp int16_t
|
2013-01-24 04:24:53 +00:00
|
|
|
#define BIT_DEPTH 8
|
|
|
|
#include "h264qpel_template.c"
|
|
|
|
#undef BIT_DEPTH
|
|
|
|
|
|
|
|
#define BIT_DEPTH 9
|
|
|
|
#include "h264qpel_template.c"
|
|
|
|
#undef BIT_DEPTH
|
|
|
|
|
|
|
|
#define BIT_DEPTH 10
|
|
|
|
#include "h264qpel_template.c"
|
|
|
|
#undef BIT_DEPTH
|
2013-01-24 13:44:34 +00:00
|
|
|
#undef pixeltmp
|
|
|
|
|
|
|
|
#define pixeltmp int32_t
|
|
|
|
#define BIT_DEPTH 12
|
|
|
|
#include "h264qpel_template.c"
|
|
|
|
#undef BIT_DEPTH
|
|
|
|
|
|
|
|
#define BIT_DEPTH 14
|
|
|
|
#include "h264qpel_template.c"
|
|
|
|
#undef BIT_DEPTH
|
|
|
|
|
2013-01-24 04:24:53 +00:00
|
|
|
|
|
|
|
void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
|
|
|
|
{
|
|
|
|
#undef FUNCC
|
|
|
|
#define FUNCC(f, depth) f ## _ ## depth ## _c
|
|
|
|
|
|
|
|
#define dspfunc2(PFX, IDX, NUM, depth) \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth); \
|
|
|
|
c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)
|
|
|
|
|
|
|
|
#define SET_QPEL(depth) \
|
|
|
|
dspfunc2(put_h264_qpel, 0, 16, depth); \
|
|
|
|
dspfunc2(put_h264_qpel, 1, 8, depth); \
|
|
|
|
dspfunc2(put_h264_qpel, 2, 4, depth); \
|
|
|
|
dspfunc2(put_h264_qpel, 3, 2, depth); \
|
|
|
|
dspfunc2(avg_h264_qpel, 0, 16, depth); \
|
|
|
|
dspfunc2(avg_h264_qpel, 1, 8, depth); \
|
|
|
|
dspfunc2(avg_h264_qpel, 2, 4, depth)
|
|
|
|
|
|
|
|
switch (bit_depth) {
|
|
|
|
default:
|
|
|
|
SET_QPEL(8);
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
SET_QPEL(9);
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
SET_QPEL(10);
|
|
|
|
break;
|
2013-01-24 13:44:34 +00:00
|
|
|
case 12:
|
|
|
|
SET_QPEL(12);
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
SET_QPEL(14);
|
|
|
|
break;
|
2013-01-24 04:24:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ARCH_ARM)
|
|
|
|
ff_h264qpel_init_arm(c, bit_depth);
|
|
|
|
if (ARCH_PPC)
|
|
|
|
ff_h264qpel_init_ppc(c, bit_depth);
|
|
|
|
if (ARCH_X86)
|
|
|
|
ff_h264qpel_init_x86(c, bit_depth);
|
|
|
|
}
|