1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

new files for the CAVS decoder by (Stefan Gehrer <stefan gehrer gmx de)

Originally committed as revision 5567 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2006-07-01 22:52:56 +00:00
parent 91c58c944f
commit 0abc2e73f8
4 changed files with 2769 additions and 0 deletions

1550
libavcodec/cavs.c Normal file

File diff suppressed because it is too large Load Diff

613
libavcodec/cavsdata.h Normal file
View File

@ -0,0 +1,613 @@
/*
* Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
* Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de>
*
* This library 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 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define SLICE_MIN_START_CODE 0x00000101
#define SLICE_MAX_START_CODE 0x000001af
#define EXT_START_CODE 0x000001b5
#define USER_START_CODE 0x000001b2
#define SEQ_START_CODE 0x000001b0
#define PIC_I_START_CODE 0x000001b3
#define PIC_PB_START_CODE 0x000001b6
#define A_AVAIL 1
#define B_AVAIL 2
#define C_AVAIL 4
#define D_AVAIL 8
#define NOT_AVAIL -1
#define REF_INTRA -2
#define REF_DIR -3
#define ESCAPE_CODE 59
#define FWD0 0x01
#define FWD1 0x02
#define BWD0 0x04
#define BWD1 0x08
#define SYM0 0x10
#define SYM1 0x20
#define MV_BWD_OFFS 12
#define MV_STRIDE 4
enum mb_t {
I_8X8 = 0,
P_SKIP,
P_16X16,
P_16X8,
P_8X16,
P_8X8,
B_SKIP,
B_DIRECT,
B_FWD_16X16,
B_BWD_16X16,
B_SYM_16X16,
B_8X8 = 29
};
enum sub_mb_t {
B_SUB_DIRECT,
B_SUB_FWD,
B_SUB_BWD,
B_SUB_SYM
};
enum intra_luma_t {
INTRA_L_VERT,
INTRA_L_HORIZ,
INTRA_L_LP,
INTRA_L_DOWN_LEFT,
INTRA_L_DOWN_RIGHT,
INTRA_L_LP_LEFT,
INTRA_L_LP_TOP,
INTRA_L_DC_128
};
enum intra_chroma_t {
INTRA_C_LP,
INTRA_C_HORIZ,
INTRA_C_VERT,
INTRA_C_PLANE,
INTRA_C_LP_LEFT,
INTRA_C_LP_TOP,
INTRA_C_DC_128,
};
enum mv_pred_t {
MV_PRED_MEDIAN,
MV_PRED_LEFT,
MV_PRED_TOP,
MV_PRED_TOPRIGHT,
MV_PRED_PSKIP,
MV_PRED_BSKIP
};
enum block_t {
BLK_16X16,
BLK_16X8,
BLK_8X16,
BLK_8X8
};
enum mv_loc_t {
MV_FWD_D3 = 0,
MV_FWD_B2,
MV_FWD_B3,
MV_FWD_C2,
MV_FWD_A1,
MV_FWD_X0,
MV_FWD_X1,
MV_FWD_A3 = 8,
MV_FWD_X2,
MV_FWD_X3,
MV_BWD_D3 = MV_BWD_OFFS,
MV_BWD_B2,
MV_BWD_B3,
MV_BWD_C2,
MV_BWD_A1,
MV_BWD_X0,
MV_BWD_X1,
MV_BWD_A3 = MV_BWD_OFFS+8,
MV_BWD_X2,
MV_BWD_X3
};
static const uint8_t b_partition_flags[14] = {
0,0,0,0,0,
FWD0|FWD1,
BWD0|BWD1,
FWD0|BWD1,
BWD0|FWD1,
FWD0|SYM1,
BWD0|SYM1,
SYM0|FWD1,
SYM0|BWD1,
SYM0|SYM1
};
static const uint8_t scan3x3[4] = {4,5,7,8};
static const uint8_t mv_scan[4] = {
MV_FWD_X0,MV_FWD_X1,
MV_FWD_X2,MV_FWD_X3
};
static const uint8_t cbp_tab[64][2] = {
{63, 0},{15,15},{31,63},{47,31},{ 0,16},{14,32},{13,47},{11,13},
{ 7,14},{ 5,11},{10,12},{ 8, 5},{12,10},{61, 7},{ 4,48},{55, 3},
{ 1, 2},{ 2, 8},{59, 4},{ 3, 1},{62,61},{ 9,55},{ 6,59},{29,62},
{45,29},{51,27},{23,23},{39,19},{27,30},{46,28},{53, 9},{30, 6},
{43,60},{37,21},{60,44},{16,26},{21,51},{28,35},{19,18},{35,20},
{42,24},{26,53},{44,17},{32,37},{58,39},{24,45},{20,58},{17,43},
{18,42},{48,46},{22,36},{33,33},{25,34},{49,40},{40,52},{36,49},
{34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38}
};
static const uint8_t chroma_qp[64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,42,43,43,44,44,
45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51
};
static const uint8_t dequant_shift[64] = {
14,14,14,14,14,14,14,14,
13,13,13,13,13,13,13,13,
13,12,12,12,12,12,12,12,
11,11,11,11,11,11,11,11,
11,10,10,10,10,10,10,10,
10, 9, 9, 9, 9, 9, 9, 9,
9, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7
};
static const uint16_t dequant_mul[64] = {
32768,36061,38968,42495,46341,50535,55437,60424,
32932,35734,38968,42495,46177,50535,55109,59933,
65535,35734,38968,42577,46341,50617,55027,60097,
32809,35734,38968,42454,46382,50576,55109,60056,
65535,35734,38968,42495,46320,50515,55109,60076,
65535,35744,38968,42495,46341,50535,55099,60087,
65535,35734,38973,42500,46341,50535,55109,60097,
32771,35734,38965,42497,46341,50535,55109,60099
};
typedef struct {
int16_t x;
int16_t y;
int16_t dist;
int16_t ref;
} vector_t;
// marks block as unavailable, i.e. out of picture
// or not yet decoded
static const vector_t un_mv = {0,0,1,NOT_AVAIL};
//marks block as "no prediction from this direction"
// e.g. forward motion vector in BWD partition
static const vector_t dir_mv = {0,0,1,REF_DIR};
//marks block as using intra prediction
static const vector_t intra_mv = {0,0,1,REF_INTRA};
typedef struct residual_vlc_t {
int8_t rltab[59][3];
int8_t level_add[26];
int8_t golomb_order;
int inc_limit;
int8_t max_run;
} residual_vlc_t;
static const residual_vlc_t intra_2dvlc[7] = {
{
{ //level / run / table_inc
{ 1, 0, 1},{ -1, 0, 1},{ 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},
{ 1, 3, 1},{ -1, 3, 1},{ 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},
{ 1, 6, 1},{ -1, 6, 1},{ 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},
{ 1, 9, 1},{ -1, 9, 1},{ 1,10, 1},{ -1,10, 1},{ 2, 0, 2},{ -2, 0, 2},
{ 1,11, 1},{ -1,11, 1},{ 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},
{ 1,14, 1},{ -1,14, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1,15, 1},{ -1,15, 1},
{ 1,16, 1},{ -1,16, 1},{ 3, 0, 3},{ -3, 0, 3},{ 1,17, 1},{ -1,17, 1},
{ 1,18, 1},{ -1,18, 1},{ 2, 2, 2},{ -2, 2, 2},{ 1,19, 1},{ -1,19, 1},
{ 1,20, 1},{ -1,20, 1},{ 2, 3, 2},{ -2, 3, 2},{ 1,21, 1},{ -1,21, 1},
{ 2, 4, 2},{ -2, 4, 2},{ 1,22, 1},{ -1,22, 1},{ 0, 0,-1}
},
//level_add
{ 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
2, //golomb_order
0, //inc_limit
22, //max_run
},{
{ //level / run
{ 1, 0, 0},{ -1, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 2, 0, 1},{ -2, 0, 1},
{ 1, 2, 0},{ -1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0},{ -2, 4, 0},{ 3, 3, 0},
{ -3, 3, 0},{ 12, 0, 3},{-12, 0, 3},{ 4, 2, 0},{ -4, 2, 0}
},
//level_add
{13, 7, 5, 4, 3, 2, 2,-1,-1,-1 -1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
4, //inc_limit
6, //max_run
},{
{ //level / run
{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},{ -3, 0, 0},
{ 0, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 5, 0, 0},{ -5, 0, 0},{ 6, 0, 0},
{ -6, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 7, 0, 0},{ -7, 0, 0},{ 8, 0, 1},
{ -8, 0, 1},{ 2, 1, 0},{ -2, 1, 0},{ 9, 0, 1},{ -9, 0, 1},{ 10, 0, 1},
{-10, 0, 1},{ 1, 2, 0},{ -1, 2, 0},{ 3, 1, 0},{ -3, 1, 0},{ 11, 0, 2},
{-11, 0, 2},{ 4, 1, 0},{ -4, 1, 0},{ 12, 0, 2},{-12, 0, 2},{ 13, 0, 2},
{-13, 0, 2},{ 5, 1, 0},{ -5, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
{ -2, 2, 0},{ 14, 0, 2},{-14, 0, 2},{ 6, 1, 0},{ -6, 1, 0},{ 15, 0, 2},
{-15, 0, 2},{ 16, 0, 2},{-16, 0, 2},{ 3, 2, 0},{ -3, 2, 0},{ 1, 4, 0},
{ -1, 4, 0},{ 7, 1, 0},{ -7, 1, 0},{ 17, 0, 2},{-17, 0, 2},
},
//level_add
{18, 8, 4, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
7, //inc_limit
4, //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},
{ -3, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 5, 0, 0},{ -5, 0, 0},{ 6, 0, 0},
{ -6, 0, 0},{ 7, 0, 0},{ -7, 0, 0},{ 8, 0, 0},{ -8, 0, 0},{ 9, 0, 0},
{ -9, 0, 0},{ 10, 0, 0},{-10, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 11, 0, 1},
{-11, 0, 1},{ 12, 0, 1},{-12, 0, 1},{ 13, 0, 1},{-13, 0, 1},{ 2, 1, 0},
{ -2, 1, 0},{ 14, 0, 1},{-14, 0, 1},{ 15, 0, 1},{-15, 0, 1},{ 3, 1, 0},
{ -3, 1, 0},{ 16, 0, 1},{-16, 0, 1},{ 1, 2, 0},{ -1, 2, 0},{ 17, 0, 1},
{-17, 0, 1},{ 4, 1, 0},{ -4, 1, 0},{ 18, 0, 1},{-18, 0, 1},{ 5, 1, 0},
{ -5, 1, 0},{ 19, 0, 1},{-19, 0, 1},{ 20, 0, 1},{-20, 0, 1},{ 6, 1, 0},
{ -6, 1, 0},{ 21, 0, 1},{-21, 0, 1},{ 2, 2, 0},{ -2, 2, 0},
},
//level_add
{22, 7, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
10, //inc_limit
2, //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},
{ -3, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 5, 0, 0},{ -5, 0, 0},{ 6, 0, 0},
{ -6, 0, 0},{ 7, 0, 0},{ -7, 0, 0},{ 8, 0, 0},{ -8, 0, 0},{ 9, 0, 0},
{ -9, 0, 0},{ 10, 0, 0},{-10, 0, 0},{ 11, 0, 0},{-11, 0, 0},{ 12, 0, 0},
{-12, 0, 0},{ 13, 0, 0},{-13, 0, 0},{ 14, 0, 0},{-14, 0, 0},{ 15, 0, 0},
{-15, 0, 0},{ 16, 0, 0},{-16, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 17, 0, 0},
{-17, 0, 0},{ 18, 0, 0},{-18, 0, 0},{ 19, 0, 0},{-19, 0, 0},{ 20, 0, 0},
{-20, 0, 0},{ 21, 0, 0},{-21, 0, 0},{ 2, 1, 0},{ -2, 1, 0},{ 22, 0, 0},
{-22, 0, 0},{ 23, 0, 0},{-23, 0, 0},{ 24, 0, 0},{-24, 0, 0},{ 25, 0, 0},
{-25, 0, 0},{ 3, 1, 0},{ -3, 1, 0},{ 26, 0, 0},{-26, 0, 0}
},
//level_add
{27, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
INT_MAX, //inc_limit
1, //max_run
}
};
static const residual_vlc_t inter_2dvlc[7] = {
{
{ //level / run
{ 1, 0, 1},{ -1, 0, 1},{ 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},
{ 1, 3, 1},{ -1, 3, 1},{ 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},
{ 1, 6, 1},{ -1, 6, 1},{ 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},
{ 1, 9, 1},{ -1, 9, 1},{ 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},
{ 1,12, 1},{ -1,12, 1},{ 2, 0, 2},{ -2, 0, 2},{ 1,13, 1},{ -1,13, 1},
{ 1,14, 1},{ -1,14, 1},{ 1,15, 1},{ -1,15, 1},{ 1,16, 1},{ -1,16, 1},
{ 1,17, 1},{ -1,17, 1},{ 1,18, 1},{ -1,18, 1},{ 3, 0, 3},{ -3, 0, 3},
{ 1,19, 1},{ -1,19, 1},{ 1,20, 1},{ -1,20, 1},{ 2, 1, 2},{ -2, 1, 2},
{ 1,21, 1},{ -1,21, 1},{ 1,22, 1},{ -1,22, 1},{ 1,23, 1},{ -1,23, 1},
{ 1,24, 1},{ -1,24, 1},{ 1,25, 1},{ -1,25, 1},{ 0, 0,-1}
},
//level_add
{ 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
3, //golomb_order
0, //inc_limit
25 //max_run
},{
{ //level / run
{ 1, 0, 0},{ -1, 0, 0},{ 0, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},
{ -1, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
{ -1, 5, 0},{ 2, 0, 1},{ -2, 0, 1},{ 1, 6, 0},{ -1, 6, 0},{ 1, 7, 0},
{ -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 1, 9, 0},{ -1, 9, 0},{ 2, 1, 1},
{ -2, 1, 1},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 3, 0, 2},
{ -3, 0, 2},{ 1,12, 0},{ -1,12, 0},{ 1,13, 0},{ -1,13, 0},{ 2, 2, 1},
{ -2, 2, 1},{ 1,14, 0},{ -1,14, 0},{ 2, 3, 1},{ -2, 3, 1},{ 1,15, 0},
{ -1,15, 0},{ 2, 4, 1},{ -2, 4, 1},{ 1,16, 0},{ -1,16, 0},{ 4, 0, 3},
{ -4, 0, 3},{ 2, 5, 1},{ -2, 5, 1},{ 1,17, 0},{ -1,17, 0},{ 1,18, 0},
{ -1,18, 0},{ 2, 6, 1},{ -2, 6, 1},{ 3, 1, 2},{ -3, 1, 2},
},
//level_add
{ 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
1, //inc_limit
18 //max_run
},{
{ //level / run
{ 1, 0, 0},{ -1, 0, 0},{ 0, 0, 0},{ 1, 1, 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{ -1, 6, 0},{ 6, 1, 0},{ -6, 1, 0},{ 3, 3, 0},{ -3, 3, 0},{ 2, 4, 0},
{ -2, 4, 0},{ 12, 0, 2},{-12, 0, 2},{ 4, 2, 0},{ -4, 2, 0},
},
//level_add
{13, 7, 5, 4, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
6, //inc_limit
6 //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},
{ -3, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 5, 0, 0},{ -5, 0, 0},{ 1, 1, 0},
{ -1, 1, 0},{ 6, 0, 0},{ -6, 0, 0},{ 7, 0, 0},{ -7, 0, 0},{ 8, 0, 0},
{ -8, 0, 0},{ 2, 1, 0},{ -2, 1, 0},{ 9, 0, 0},{ -9, 0, 0},{ 1, 2, 0},
{ -1, 2, 0},{ 10, 0, 1},{-10, 0, 1},{ 3, 1, 0},{ -3, 1, 0},{ 11, 0, 1},
{-11, 0, 1},{ 4, 1, 0},{ -4, 1, 0},{ 12, 0, 1},{-12, 0, 1},{ 1, 3, 0},
{ -1, 3, 0},{ 2, 2, 0},{ -2, 2, 0},{ 13, 0, 1},{-13, 0, 1},{ 5, 1, 0},
{ -5, 1, 0},{ 14, 0, 1},{-14, 0, 1},{ 6, 1, 0},{ -6, 1, 0},{ 1, 4, 0},
{ -1, 4, 0},{ 15, 0, 1},{-15, 0, 1},{ 3, 2, 0},{ -3, 2, 0},{ 16, 0, 1},
{-16, 0, 1},{ 2, 3, 0},{ -2, 3, 0},{ 7, 1, 0},{ -7, 1, 0},
},
//level_add
{17, 8, 4, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
9, //inc_limit
4 //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},
{ -3, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 5, 0, 0},{ -5, 0, 0},{ 6, 0, 0},
{ -6, 0, 0},{ 7, 0, 0},{ -7, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 8, 0, 0},
{ -8, 0, 0},{ 9, 0, 0},{ -9, 0, 0},{ 10, 0, 0},{-10, 0, 0},{ 11, 0, 0},
{-11, 0, 0},{ 12, 0, 0},{-12, 0, 0},{ 2, 1, 0},{ -2, 1, 0},{ 13, 0, 0},
{-13, 0, 0},{ 1, 2, 0},{ -1, 2, 0},{ 14, 0, 0},{-14, 0, 0},{ 15, 0, 0},
{-15, 0, 0},{ 3, 1, 0},{ -3, 1, 0},{ 16, 0, 0},{-16, 0, 0},{ 17, 0, 0},
{-17, 0, 0},{ 18, 0, 0},{-18, 0, 0},{ 4, 1, 0},{ -4, 1, 0},{ 19, 0, 0},
{-19, 0, 0},{ 20, 0, 0},{-20, 0, 0},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},
{ -1, 3, 0},{ 5, 1, 0},{ -5, 1, 0},{ 21, 0, 0},{-21, 0, 0},
},
//level_add
{22, 6, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
2, //golomb_order
INT_MAX, //inc_limit
3 //max_run
}
};
static const residual_vlc_t chroma_2dvlc[5] = {
{
{ //level / run
{ 1, 0, 1},{ -1, 0, 1},{ 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},
{ 1, 3, 1},{ -1, 3, 1},{ 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},
{ 1, 6, 1},{ -1, 6, 1},{ 2, 0, 2},{ -2, 0, 2},{ 1, 7, 1},{ -1, 7, 1},
{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},{ 1,10, 1},{ -1,10, 1},
{ 1,11, 1},{ -1,11, 1},{ 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},
{ 1,14, 1},{ -1,14, 1},{ 3, 0, 3},{ -3, 0, 3},{ 1,15, 1},{ -1,15, 1},
{ 1,16, 1},{ -1,16, 1},{ 1,17, 1},{ -1,17, 1},{ 1,18, 1},{ -1,18, 1},
{ 1,19, 1},{ -1,19, 1},{ 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},
{ 2, 1, 2},{ -2, 1, 2},{ 1,22, 1},{ -1,22, 1},{ 1,23, 1},{ -1,23, 1},
{ 1,24, 1},{ -1,24, 1},{ 4, 0, 3},{ -4, 0, 3},{ 0, 0,-1}
},
//level_add
{ 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,-1},
2, //golomb_order
0, //inc_limit
24, //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 2, 0, 1},
{ -2, 0, 1},{ 1, 2, 0},{ -1, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},
{ -1, 4, 0},{ 1, 5, 0},{ -1, 5, 0},{ 3, 0, 2},{ -3, 0, 2},{ 1, 6, 0},
{ -1, 6, 0},{ 1, 7, 0},{ -1, 7, 0},{ 2, 1, 1},{ -2, 1, 1},{ 1, 8, 0},
{ -1, 8, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 4, 0, 2},
{ -4, 0, 2},{ 1,11, 0},{ -1,11, 0},{ 1,12, 0},{ -1,12, 0},{ 1,13, 0},
{ -1,13, 0},{ 2, 2, 1},{ -2, 2, 1},{ 1,14, 0},{ -1,14, 0},{ 2, 3, 1},
{ -2, 3, 1},{ 5, 0, 3},{ -5, 0, 3},{ 3, 1, 2},{ -3, 1, 2},{ 1,15, 0},
{ -1,15, 0},{ 1,16, 0},{ -1,16, 0},{ 1,17, 0},{ -1,17, 0},{ 2, 4, 1},
{ -2, 4, 1},{ 1,18, 0},{ -1,18, 0},{ 1,19, 0},{ -1,19, 0},
},
//level_add
{ 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2,-1,-1,-1,-1,-1,-1},
0, //golomb_order
1, //inc_limit
19, //max_run
},{
{ //level / run
{ 1, 0, 0},{ -1, 0, 0},{ 0, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 1, 1, 0},
{ -1, 1, 0},{ 3, 0, 1},{ -3, 0, 1},{ 1, 2, 0},{ -1, 2, 0},{ 4, 0, 1},
{ -4, 0, 1},{ 2, 1, 0},{ -2, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 5, 0, 2},
{ -5, 0, 2},{ 1, 4, 0},{ -1, 4, 0},{ 3, 1, 1},{ -3, 1, 1},{ 2, 2, 0},
{ -2, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 6, 0, 2},{ -6, 0, 2},{ 1, 6, 0},
{ -1, 6, 0},{ 2, 3, 0},{ -2, 3, 0},{ 7, 0, 2},{ -7, 0, 2},{ 1, 7, 0},
{ -1, 7, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 8, 0},{ -1, 8, 0},{ 3, 2, 1},
{ -3, 2, 1},{ 2, 4, 0},{ -2, 4, 0},{ 2, 5, 0},{ -2, 5, 0},{ 8, 0, 2},
{ -8, 0, 2},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 9, 0, 2},
{ -9, 0, 2},{ 5, 1, 2},{ -5, 1, 2},{ 3, 3, 1},{ -3, 3, 1},
},
//level_add
{10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
1, //golomb_order
2, //inc_limit
10, //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},
{ -3, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 1, 1, 0},{ -1, 1, 0},{ 5, 0, 1},
{ -5, 0, 1},{ 2, 1, 0},{ -2, 1, 0},{ 6, 0, 1},{ -6, 0, 1},{ 1, 2, 0},
{ -1, 2, 0},{ 7, 0, 1},{ -7, 0, 1},{ 3, 1, 0},{ -3, 1, 0},{ 8, 0, 1},
{ -8, 0, 1},{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},{ -2, 2, 0},{ 9, 0, 1},
{ -9, 0, 1},{ 4, 1, 0},{ -4, 1, 0},{ 1, 4, 0},{ -1, 4, 0},{ 10, 0, 1},
{-10, 0, 1},{ 3, 2, 0},{ -3, 2, 0},{ 5, 1, 1},{ -5, 1, 1},{ 2, 3, 0},
{ -2, 3, 0},{ 11, 0, 1},{-11, 0, 1},{ 1, 5, 0},{ -1, 5, 0},{ 12, 0, 1},
{-12, 0, 1},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 1},{ -6, 1, 1},{ 13, 0, 1},
{-13, 0, 1},{ 2, 4, 0},{ -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},
},
//level_add
{14, 7, 4, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
1, //golomb_order
4, //inc_limit
7, //max_run
},{
{ //level / run
{ 0, 0, 0},{ 1, 0, 0},{ -1, 0, 0},{ 2, 0, 0},{ -2, 0, 0},{ 3, 0, 0},
{ -3, 0, 0},{ 4, 0, 0},{ -4, 0, 0},{ 5, 0, 0},{ -5, 0, 0},{ 6, 0, 0},
{ -6, 0, 0},{ 7, 0, 0},{ -7, 0, 0},{ 8, 0, 0},{ -8, 0, 0},{ 1, 1, 0},
{ -1, 1, 0},{ 9, 0, 0},{ -9, 0, 0},{ 10, 0, 0},{-10, 0, 0},{ 11, 0, 0},
{-11, 0, 0},{ 2, 1, 0},{ -2, 1, 0},{ 12, 0, 0},{-12, 0, 0},{ 13, 0, 0},
{-13, 0, 0},{ 3, 1, 0},{ -3, 1, 0},{ 14, 0, 0},{-14, 0, 0},{ 1, 2, 0},
{ -1, 2, 0},{ 15, 0, 0},{-15, 0, 0},{ 4, 1, 0},{ -4, 1, 0},{ 16, 0, 0},
{-16, 0, 0},{ 17, 0, 0},{-17, 0, 0},{ 5, 1, 0},{ -5, 1, 0},{ 1, 3, 0},
{ -1, 3, 0},{ 2, 2, 0},{ -2, 2, 0},{ 18, 0, 0},{-18, 0, 0},{ 6, 1, 0},
{ -6, 1, 0},{ 19, 0, 0},{-19, 0, 0},{ 1, 4, 0},{ -1, 4, 0},
},
//level_add
{20, 7, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
0, //golomb_order
INT_MAX, //inc_limit
4, //max_run
}
};
static const uint8_t alpha_tab[64] = {
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3,
4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20,
22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
};
static const uint8_t beta_tab[64] = {
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27
};
static const uint8_t tc_tab[64] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
};
static const int_fast8_t left_modifier_l[8] = { 0,-1, 6,-1,-1, 7, 6, 7};
static const int_fast8_t top_modifier_l[8] = {-1, 1, 5,-1,-1, 5, 7, 7};
static const int_fast8_t left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6};
static const int_fast8_t top_modifier_c[7] = { 4, 1,-1,-1, 4, 6, 6};

511
libavcodec/cavsdsp.c Normal file
View File

@ -0,0 +1,511 @@
/*
* Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
*
* DSP functions
*
* Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de>
*
* This library 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 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include "dsputil.h"
#include "cavsdsp.h"
/*****************************************************************************
*
* in-loop deblocking filter
*
****************************************************************************/
#define P2 p0_p[-3*stride]
#define P1 p0_p[-2*stride]
#define P0 p0_p[-1*stride]
#define Q0 p0_p[ 0*stride]
#define Q1 p0_p[ 1*stride]
#define Q2 p0_p[ 2*stride]
static inline void loop_filter_l2(uint8_t *p0_p,int stride,int alpha, int beta) {
int p0 = P0;
int q0 = Q0;
if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) {
int s = p0 + q0 + 2;
alpha = (alpha>>2) + 2;
if(abs(P2-p0) < beta && abs(p0-q0) < alpha) {
P0 = (P1 + p0 + s) >> 2;
P1 = (2*P1 + s) >> 2;
} else
P0 = (2*P1 + s) >> 2;
if(abs(Q2-q0) < beta && abs(q0-p0) < alpha) {
Q0 = (Q1 + q0 + s) >> 2;
Q1 = (2*Q1 + s) >> 2;
} else
Q0 = (2*Q1 + s) >> 2;
}
}
static inline void loop_filter_l1(uint8_t *p0_p, int stride, int alpha, int beta, int tc) {
int p0 = P0;
int q0 = Q0;
if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) {
int delta = clip(((q0-p0)*3+P1-Q1+4)>>3,-tc, tc);
P0 = clip_uint8(p0+delta);
Q0 = clip_uint8(q0-delta);
if(abs(P2-p0)<beta) {
delta = clip(((P0-P1)*3+P2-Q0+4)>>3, -tc, tc);
P1 = clip_uint8(P1+delta);
}
if(abs(Q2-q0)<beta) {
delta = clip(((Q1-Q0)*3+P0-Q2+4)>>3, -tc, tc);
Q1 = clip_uint8(Q1-delta);
}
}
}
static inline void loop_filter_c2(uint8_t *p0_p,int stride,int alpha, int beta) {
int p0 = P0;
int q0 = Q0;
if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) {
int s = p0 + q0 + 2;
alpha = (alpha>>2) + 2;
if(abs(P2-p0) < beta && abs(p0-q0) < alpha) {
P0 = (P1 + p0 + s) >> 2;
} else
P0 = (2*P1 + s) >> 2;
if(abs(Q2-q0) < beta && abs(q0-p0) < alpha) {
Q0 = (Q1 + q0 + s) >> 2;
} else
Q0 = (2*Q1 + s) >> 2;
}
}
static inline void loop_filter_c1(uint8_t *p0_p,int stride,int alpha, int beta,
int tc) {
if(abs(P0-Q0)<alpha && abs(P1-P0)<beta && abs(Q1-Q0)<beta) {
int delta = clip(((Q0-P0)*3+P1-Q1+4)>>3, -tc, tc);
P0 = clip_uint8(P0+delta);
Q0 = clip_uint8(Q0-delta);
}
}
#undef P0
#undef P1
#undef P2
#undef Q0
#undef Q1
#undef Q2
void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
int i;
if(bs1==2)
for(i=0;i<16;i++)
loop_filter_l2(d + i*stride,1,alpha,beta);
else {
if(bs1)
for(i=0;i<8;i++)
loop_filter_l1(d + i*stride,1,alpha,beta,tc);
if (bs2)
for(i=8;i<16;i++)
loop_filter_l1(d + i*stride,1,alpha,beta,tc);
}
}
void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
int i;
if(bs1==2)
for(i=0;i<16;i++)
loop_filter_l2(d + i,stride,alpha,beta);
else {
if(bs1)
for(i=0;i<8;i++)
loop_filter_l1(d + i,stride,alpha,beta,tc);
if (bs2)
for(i=8;i<16;i++)
loop_filter_l1(d + i,stride,alpha,beta,tc);
}
}
void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
int i;
if(bs1==2)
for(i=0;i<8;i++)
loop_filter_c2(d + i*stride,1,alpha,beta);
else {
if(bs1)
for(i=0;i<4;i++)
loop_filter_c1(d + i*stride,1,alpha,beta,tc);
if (bs2)
for(i=4;i<8;i++)
loop_filter_c1(d + i*stride,1,alpha,beta,tc);
}
}
void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc,
int bs1, int bs2) {
int i;
if(bs1==2)
for(i=0;i<8;i++)
loop_filter_c2(d + i,stride,alpha,beta);
else {
if(bs1)
for(i=0;i<4;i++)
loop_filter_c1(d + i,stride,alpha,beta,tc);
if (bs2)
for(i=4;i<8;i++)
loop_filter_c1(d + i,stride,alpha,beta,tc);
}
}
/*****************************************************************************
*
* inverse transform
*
****************************************************************************/
void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) {
int i;
DCTELEM (*src)[8] = (DCTELEM(*)[8])block;
uint8_t *cm = cropTbl + MAX_NEG_CROP;
for( i = 0; i < 8; i++ ) {
const int a0 = 3*src[i][1] - (src[i][7]<<1);
const int a1 = 3*src[i][3] + (src[i][5]<<1);
const int a2 = (src[i][3]<<1) - 3*src[i][5];
const int a3 = (src[i][1]<<1) + 3*src[i][7];
const int b4 = ((a0 + a1 + a3)<<1) + a1;
const int b5 = ((a0 - a1 + a2)<<1) + a0;
const int b6 = ((a3 - a2 - a1)<<1) + a3;
const int b7 = ((a0 - a2 - a3)<<1) - a2;
const int a7 = (src[i][2]<<2) - 10*src[i][6];
const int a6 = (src[i][6]<<2) + 10*src[i][2];
const int a5 = (src[i][0] - src[i][4]) << 3;
const int a4 = (src[i][0] + src[i][4]) << 3;
const int b0 = a4 + a6;
const int b1 = a5 + a7;
const int b2 = a5 - a7;
const int b3 = a4 - a6;
src[i][0] = (b0 + b4 + 4) >> 3;
src[i][1] = (b1 + b5 + 4) >> 3;
src[i][2] = (b2 + b6 + 4) >> 3;
src[i][3] = (b3 + b7 + 4) >> 3;
src[i][4] = (b3 - b7 + 4) >> 3;
src[i][5] = (b2 - b6 + 4) >> 3;
src[i][6] = (b1 - b5 + 4) >> 3;
src[i][7] = (b0 - b4 + 4) >> 3;
}
for( i = 0; i < 8; i++ ) {
const int a0 = 3*src[1][i] - (src[7][i]<<1);
const int a1 = 3*src[3][i] + (src[5][i]<<1);
const int a2 = (src[3][i]<<1) - 3*src[5][i];
const int a3 = (src[1][i]<<1) + 3*src[7][i];
const int b4 = ((a0 + a1 + a3)<<1) + a1;
const int b5 = ((a0 - a1 + a2)<<1) + a0;
const int b6 = ((a3 - a2 - a1)<<1) + a3;
const int b7 = ((a0 - a2 - a3)<<1) - a2;
const int a7 = (src[2][i]<<2) - 10*src[6][i];
const int a6 = (src[6][i]<<2) + 10*src[2][i];
const int a5 = (src[0][i] - src[4][i]) << 3;
const int a4 = (src[0][i] + src[4][i]) << 3;
const int b0 = a4 + a6;
const int b1 = a5 + a7;
const int b2 = a5 - a7;
const int b3 = a4 - a6;
dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4 + 64) >> 7)];
dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5 + 64) >> 7)];
dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6 + 64) >> 7)];
dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7 + 64) >> 7)];
dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7 + 64) >> 7)];
dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6 + 64) >> 7)];
dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5 + 64) >> 7)];
dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4 + 64) >> 7)];
}
}
/*****************************************************************************
*
* motion compensation
*
****************************************************************************/
#define CAVS_SUBPIX(OPNAME, OP, NAME, A, B, C, D, E, F) \
static void OPNAME ## cavs_filt8_h_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
const int h=8;\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\
for(i=0; i<h; i++)\
{\
OP(dst[0], A*src[-2] + B*src[-1] + C*src[0] + D*src[1] + E*src[2] + F*src[3]);\
OP(dst[1], A*src[-1] + B*src[ 0] + C*src[1] + D*src[2] + E*src[3] + F*src[4]);\
OP(dst[2], A*src[ 0] + B*src[ 1] + C*src[2] + D*src[3] + E*src[4] + F*src[5]);\
OP(dst[3], A*src[ 1] + B*src[ 2] + C*src[3] + D*src[4] + E*src[5] + F*src[6]);\
OP(dst[4], A*src[ 2] + B*src[ 3] + C*src[4] + D*src[5] + E*src[6] + F*src[7]);\
OP(dst[5], A*src[ 3] + B*src[ 4] + C*src[5] + D*src[6] + E*src[7] + F*src[8]);\
OP(dst[6], A*src[ 4] + B*src[ 5] + C*src[6] + D*src[7] + E*src[8] + F*src[9]);\
OP(dst[7], A*src[ 5] + B*src[ 6] + C*src[7] + D*src[8] + E*src[9] + F*src[10]);\
dst+=dstStride;\
src+=srcStride;\
}\
}\
\
static void OPNAME ## cavs_filt8_v_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
const int w=8;\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\
for(i=0; i<w; i++)\
{\
const int srcB= src[-2*srcStride];\
const int srcA= src[-1*srcStride];\
const int src0= src[0 *srcStride];\
const int src1= src[1 *srcStride];\
const int src2= src[2 *srcStride];\
const int src3= src[3 *srcStride];\
const int src4= src[4 *srcStride];\
const int src5= src[5 *srcStride];\
const int src6= src[6 *srcStride];\
const int src7= src[7 *srcStride];\
const int src8= src[8 *srcStride];\
const int src9= src[9 *srcStride];\
const int src10= src[10 *srcStride];\
OP(dst[0*dstStride], A*srcB + B*srcA + C*src0 + D*src1 + E*src2 + F*src3);\
OP(dst[1*dstStride], A*srcA + B*src0 + C*src1 + D*src2 + E*src3 + F*src4);\
OP(dst[2*dstStride], A*src0 + B*src1 + C*src2 + D*src3 + E*src4 + F*src5);\
OP(dst[3*dstStride], A*src1 + B*src2 + C*src3 + D*src4 + E*src5 + F*src6);\
OP(dst[4*dstStride], A*src2 + B*src3 + C*src4 + D*src5 + E*src6 + F*src7);\
OP(dst[5*dstStride], A*src3 + B*src4 + C*src5 + D*src6 + E*src7 + F*src8);\
OP(dst[6*dstStride], A*src4 + B*src5 + C*src6 + D*src7 + E*src8 + F*src9);\
OP(dst[7*dstStride], A*src5 + B*src6 + C*src7 + D*src8 + E*src9 + F*src10);\
dst++;\
src++;\
}\
}\
\
static void OPNAME ## cavs_filt16_v_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
OPNAME ## cavs_filt8_v_ ## NAME(dst , src , dstStride, srcStride);\
OPNAME ## cavs_filt8_v_ ## NAME(dst+8, src+8, dstStride, srcStride);\
src += 8*srcStride;\
dst += 8*dstStride;\
OPNAME ## cavs_filt8_v_ ## NAME(dst , src , dstStride, srcStride);\
OPNAME ## cavs_filt8_v_ ## NAME(dst+8, src+8, dstStride, srcStride);\
}\
\
static void OPNAME ## cavs_filt16_h_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
OPNAME ## cavs_filt8_h_ ## NAME(dst , src , dstStride, srcStride);\
OPNAME ## cavs_filt8_h_ ## NAME(dst+8, src+8, dstStride, srcStride);\
src += 8*srcStride;\
dst += 8*dstStride;\
OPNAME ## cavs_filt8_h_ ## NAME(dst , src , dstStride, srcStride);\
OPNAME ## cavs_filt8_h_ ## NAME(dst+8, src+8, dstStride, srcStride);\
}\
#define CAVS_SUBPIX_HV(OPNAME, OP, NAME, AH, BH, CH, DH, EH, FH, AV, BV, CV, DV, EV, FV, FULL) \
static void OPNAME ## cavs_filt8_hv_ ## NAME(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int srcStride){\
int16_t temp[8*(8+5)];\
int16_t *tmp = temp;\
const int h=8;\
const int w=8;\
uint8_t *cm = cropTbl + MAX_NEG_CROP;\
int i;\
src1 -= 2*srcStride;\
for(i=0; i<h+5; i++)\
{\
tmp[0]= AH*src1[-2] + BH*src1[-1] + CH*src1[0] + DH*src1[1] + EH*src1[2] + FH*src1[3];\
tmp[1]= AH*src1[-1] + BH*src1[ 0] + CH*src1[1] + DH*src1[2] + EH*src1[3] + FH*src1[4];\
tmp[2]= AH*src1[ 0] + BH*src1[ 1] + CH*src1[2] + DH*src1[3] + EH*src1[4] + FH*src1[5];\
tmp[3]= AH*src1[ 1] + BH*src1[ 2] + CH*src1[3] + DH*src1[4] + EH*src1[5] + FH*src1[6];\
tmp[4]= AH*src1[ 2] + BH*src1[ 3] + CH*src1[4] + DH*src1[5] + EH*src1[6] + FH*src1[7];\
tmp[5]= AH*src1[ 3] + BH*src1[ 4] + CH*src1[5] + DH*src1[6] + EH*src1[7] + FH*src1[8];\
tmp[6]= AH*src1[ 4] + BH*src1[ 5] + CH*src1[6] + DH*src1[7] + EH*src1[8] + FH*src1[9];\
tmp[7]= AH*src1[ 5] + BH*src1[ 6] + CH*src1[7] + DH*src1[8] + EH*src1[9] + FH*src1[10];\
tmp+=8;\
src1+=srcStride;\
}\
if(FULL) {\
tmp = temp+8*2; \
for(i=0; i<w; i++) \
{ \
const int tmpB= tmp[-2*8]; \
const int tmpA= tmp[-1*8]; \
const int tmp0= tmp[0 *8]; \
const int tmp1= tmp[1 *8]; \
const int tmp2= tmp[2 *8]; \
const int tmp3= tmp[3 *8]; \
const int tmp4= tmp[4 *8]; \
const int tmp5= tmp[5 *8]; \
const int tmp6= tmp[6 *8]; \
const int tmp7= tmp[7 *8]; \
const int tmp8= tmp[8 *8]; \
const int tmp9= tmp[9 *8]; \
const int tmp10=tmp[10*8]; \
OP(dst[0*dstStride], AV*tmpB + BV*tmpA + CV*tmp0 + DV*tmp1 + EV*tmp2 + FV*tmp3 + 64*src2[0*srcStride]); \
OP(dst[1*dstStride], AV*tmpA + BV*tmp0 + CV*tmp1 + DV*tmp2 + EV*tmp3 + FV*tmp4 + 64*src2[1*srcStride]); \
OP(dst[2*dstStride], AV*tmp0 + BV*tmp1 + CV*tmp2 + DV*tmp3 + EV*tmp4 + FV*tmp5 + 64*src2[2*srcStride]); \
OP(dst[3*dstStride], AV*tmp1 + BV*tmp2 + CV*tmp3 + DV*tmp4 + EV*tmp5 + FV*tmp6 + 64*src2[3*srcStride]); \
OP(dst[4*dstStride], AV*tmp2 + BV*tmp3 + CV*tmp4 + DV*tmp5 + EV*tmp6 + FV*tmp7 + 64*src2[4*srcStride]); \
OP(dst[5*dstStride], AV*tmp3 + BV*tmp4 + CV*tmp5 + DV*tmp6 + EV*tmp7 + FV*tmp8 + 64*src2[5*srcStride]); \
OP(dst[6*dstStride], AV*tmp4 + BV*tmp5 + CV*tmp6 + DV*tmp7 + EV*tmp8 + FV*tmp9 + 64*src2[6*srcStride]); \
OP(dst[7*dstStride], AV*tmp5 + BV*tmp6 + CV*tmp7 + DV*tmp8 + EV*tmp9 + FV*tmp10 + 64*src2[7*srcStride]); \
dst++; \
tmp++; \
src2++; \
} \
} else {\
tmp = temp+8*2; \
for(i=0; i<w; i++) \
{ \
const int tmpB= tmp[-2*8]; \
const int tmpA= tmp[-1*8]; \
const int tmp0= tmp[0 *8]; \
const int tmp1= tmp[1 *8]; \
const int tmp2= tmp[2 *8]; \
const int tmp3= tmp[3 *8]; \
const int tmp4= tmp[4 *8]; \
const int tmp5= tmp[5 *8]; \
const int tmp6= tmp[6 *8]; \
const int tmp7= tmp[7 *8]; \
const int tmp8= tmp[8 *8]; \
const int tmp9= tmp[9 *8]; \
const int tmp10=tmp[10*8]; \
OP(dst[0*dstStride], AV*tmpB + BV*tmpA + CV*tmp0 + DV*tmp1 + EV*tmp2 + FV*tmp3); \
OP(dst[1*dstStride], AV*tmpA + BV*tmp0 + CV*tmp1 + DV*tmp2 + EV*tmp3 + FV*tmp4); \
OP(dst[2*dstStride], AV*tmp0 + BV*tmp1 + CV*tmp2 + DV*tmp3 + EV*tmp4 + FV*tmp5); \
OP(dst[3*dstStride], AV*tmp1 + BV*tmp2 + CV*tmp3 + DV*tmp4 + EV*tmp5 + FV*tmp6); \
OP(dst[4*dstStride], AV*tmp2 + BV*tmp3 + CV*tmp4 + DV*tmp5 + EV*tmp6 + FV*tmp7); \
OP(dst[5*dstStride], AV*tmp3 + BV*tmp4 + CV*tmp5 + DV*tmp6 + EV*tmp7 + FV*tmp8); \
OP(dst[6*dstStride], AV*tmp4 + BV*tmp5 + CV*tmp6 + DV*tmp7 + EV*tmp8 + FV*tmp9); \
OP(dst[7*dstStride], AV*tmp5 + BV*tmp6 + CV*tmp7 + DV*tmp8 + EV*tmp9 + FV*tmp10); \
dst++; \
tmp++; \
} \
}\
}\
\
static void OPNAME ## cavs_filt16_hv_ ## NAME(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int srcStride){ \
OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, src2 , dstStride, srcStride); \
OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \
src1 += 8*srcStride;\
src2 += 8*srcStride;\
dst += 8*dstStride;\
OPNAME ## cavs_filt8_hv_ ## NAME(dst , src1, src2 , dstStride, srcStride); \
OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \
}\
#define CAVS_MC(OPNAME, SIZE) \
void OPNAME ## cavs_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
}\
void OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _h_qpel_l(dst, src, stride, stride);\
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _h_hpel(dst, src, stride, stride);\
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _h_qpel_r(dst, src, stride, stride);\
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _v_qpel_l(dst, src, stride, stride);\
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _v_hpel(dst, src, stride, stride);\
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _v_qpel_r(dst, src, stride, stride);\
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_jj(dst, src, NULL, stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src, stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride, stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+1, stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride+1,stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, src+stride+1,stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, src+stride+1,stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, src+stride+1,stride, stride); \
}\
\
void OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, src+stride+1,stride, stride); \
}\
#define op_put1(a, b) a = cm[((b)+4)>>3]
#define op_put2(a, b) a = cm[((b)+64)>>7]
#define op_put3(a, b) a = cm[((b)+32)>>6]
#define op_put4(a, b) a = cm[((b)+512)>>10]
#define op_avg1(a, b) a = ((a)+cm[((b)+4)>>3] +1)>>1
#define op_avg2(a, b) a = ((a)+cm[((b)+64)>>7] +1)>>1
#define op_avg3(a, b) a = ((a)+cm[((b)+32)>>6] +1)>>1
#define op_avg4(a, b) a = ((a)+cm[((b)+512)>>10]+1)>>1
CAVS_SUBPIX(put_ , op_put1, hpel, 0, -1, 5, 5, -1, 0)
CAVS_SUBPIX(put_ , op_put2, qpel_l, -1, -2, 96, 42, -7, 0)
CAVS_SUBPIX(put_ , op_put2, qpel_r, 0, -7, 42, 96, -2, -1)
CAVS_SUBPIX_HV(put_, op_put3, jj, 0, -1, 5, 5, -1, 0, 0, -1, 5, 5, -1, 0, 0)
CAVS_SUBPIX_HV(put_, op_put4, ff, 0, -1, 5, 5, -1, 0, -1, -2, 96, 42, -7, 0, 0)
CAVS_SUBPIX_HV(put_, op_put4, ii, -1, -2, 96, 42, -7, 0, 0, -1, 5, 5, -1, 0, 0)
CAVS_SUBPIX_HV(put_, op_put4, kk, 0, -7, 42, 96, -2, -1, 0, -1, 5, 5, -1, 0, 0)
CAVS_SUBPIX_HV(put_, op_put4, qq, 0, -1, 5, 5, -1, 0, 0, -7, 42, 96, -2,-1, 0)
CAVS_SUBPIX_HV(put_, op_put2, egpr, 0, -1, 5, 5, -1, 0, 0, -1, 5, 5, -1, 0, 1)
CAVS_SUBPIX(avg_ , op_avg1, hpel, 0, -1, 5, 5, -1, 0)
CAVS_SUBPIX(avg_ , op_avg2, qpel_l, -1, -2, 96, 42, -7, 0)
CAVS_SUBPIX(avg_ , op_avg2, qpel_r, 0, -7, 42, 96, -2, -1)
CAVS_SUBPIX_HV(avg_, op_avg3, jj, 0, -1, 5, 5, -1, 0, 0, -1, 5, 5, -1, 0, 0)
CAVS_SUBPIX_HV(avg_, op_avg4, ff, 0, -1, 5, 5, -1, 0, -1, -2, 96, 42, -7, 0, 0)
CAVS_SUBPIX_HV(avg_, op_avg4, ii, -1, -2, 96, 42, -7, 0, 0, -1, 5, 5, -1, 0, 0)
CAVS_SUBPIX_HV(avg_, op_avg4, kk, 0, -7, 42, 96, -2, -1, 0, -1, 5, 5, -1, 0, 0)
CAVS_SUBPIX_HV(avg_, op_avg4, qq, 0, -1, 5, 5, -1, 0, 0, -7, 42, 96, -2,-1, 0)
CAVS_SUBPIX_HV(avg_, op_avg2, egpr, 0, -1, 5, 5, -1, 0, 0, -1, 5, 5, -1, 0, 1)
CAVS_MC(put_, 8)
CAVS_MC(put_, 16)
CAVS_MC(avg_, 8)
CAVS_MC(avg_, 16)

95
libavcodec/cavsdsp.h Normal file
View File

@ -0,0 +1,95 @@
/*
* Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
* Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de>
*
* DSP function prototypes
*
* This library 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 of the License, or (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
void put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride);
void put_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride);
void avg_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride);
void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride);
void put_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
void put_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
void avg_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
void avg_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);