Revision b88e2114

View differences:

libavcodec/cavs.c
29 29
#include "bitstream.h"
30 30
#include "golomb.h"
31 31
#include "mpegvideo.h"
32
#include "cavs.h"
33
#ifdef CONFIG_CAVS_DECODER
32 34
#include "cavsdata.h"
33 35

  
34
#ifdef CONFIG_CAVS_DECODER
35 36
typedef struct {
36 37
    MpegEncContext s;
37 38
    Picture picture; ///< currently decoded frame
libavcodec/cavs.h
1
/*
2
 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
3
 * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer@gmx.de>
4
 *
5
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * FFmpeg is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with FFmpeg; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 */
21

  
22
#ifndef CAVS_H
23
#define CAVS_H
24

  
25
#include "dsputil.h"
26

  
27
#define SLICE_MIN_START_CODE    0x00000101
28
#define SLICE_MAX_START_CODE    0x000001af
29
#define EXT_START_CODE          0x000001b5
30
#define USER_START_CODE         0x000001b2
31
#define CAVS_START_CODE         0x000001b0
32
#define PIC_I_START_CODE        0x000001b3
33
#define PIC_PB_START_CODE       0x000001b6
34

  
35
#define A_AVAIL                          1
36
#define B_AVAIL                          2
37
#define C_AVAIL                          4
38
#define D_AVAIL                          8
39
#define NOT_AVAIL                       -1
40
#define REF_INTRA                       -2
41
#define REF_DIR                         -3
42

  
43
#define ESCAPE_CODE                     59
44

  
45
#define FWD0                          0x01
46
#define FWD1                          0x02
47
#define BWD0                          0x04
48
#define BWD1                          0x08
49
#define SYM0                          0x10
50
#define SYM1                          0x20
51
#define SPLITH                        0x40
52
#define SPLITV                        0x80
53

  
54
#define MV_BWD_OFFS                     12
55
#define MV_STRIDE                        4
56

  
57
enum mb_t {
58
  I_8X8 = 0,
59
  P_SKIP,
60
  P_16X16,
61
  P_16X8,
62
  P_8X16,
63
  P_8X8,
64
  B_SKIP,
65
  B_DIRECT,
66
  B_FWD_16X16,
67
  B_BWD_16X16,
68
  B_SYM_16X16,
69
  B_8X8 = 29
70
};
71

  
72
enum sub_mb_t {
73
  B_SUB_DIRECT,
74
  B_SUB_FWD,
75
  B_SUB_BWD,
76
  B_SUB_SYM
77
};
78

  
79
enum intra_luma_t {
80
  INTRA_L_VERT,
81
  INTRA_L_HORIZ,
82
  INTRA_L_LP,
83
  INTRA_L_DOWN_LEFT,
84
  INTRA_L_DOWN_RIGHT,
85
  INTRA_L_LP_LEFT,
86
  INTRA_L_LP_TOP,
87
  INTRA_L_DC_128
88
};
89

  
90
enum intra_chroma_t {
91
  INTRA_C_LP,
92
  INTRA_C_HORIZ,
93
  INTRA_C_VERT,
94
  INTRA_C_PLANE,
95
  INTRA_C_LP_LEFT,
96
  INTRA_C_LP_TOP,
97
  INTRA_C_DC_128,
98
};
99

  
100
enum mv_pred_t {
101
  MV_PRED_MEDIAN,
102
  MV_PRED_LEFT,
103
  MV_PRED_TOP,
104
  MV_PRED_TOPRIGHT,
105
  MV_PRED_PSKIP,
106
  MV_PRED_BSKIP
107
};
108

  
109
enum block_t {
110
  BLK_16X16,
111
  BLK_16X8,
112
  BLK_8X16,
113
  BLK_8X8
114
};
115

  
116
enum mv_loc_t {
117
  MV_FWD_D3 = 0,
118
  MV_FWD_B2,
119
  MV_FWD_B3,
120
  MV_FWD_C2,
121
  MV_FWD_A1,
122
  MV_FWD_X0,
123
  MV_FWD_X1,
124
  MV_FWD_A3 = 8,
125
  MV_FWD_X2,
126
  MV_FWD_X3,
127
  MV_BWD_D3 = MV_BWD_OFFS,
128
  MV_BWD_B2,
129
  MV_BWD_B3,
130
  MV_BWD_C2,
131
  MV_BWD_A1,
132
  MV_BWD_X0,
133
  MV_BWD_X1,
134
  MV_BWD_A3 = MV_BWD_OFFS+8,
135
  MV_BWD_X2,
136
  MV_BWD_X3
137
};
138

  
139
DECLARE_ALIGNED_8(typedef, struct) {
140
    int16_t x;
141
    int16_t y;
142
    int16_t dist;
143
    int16_t ref;
144
} vector_t;
145

  
146
typedef struct residual_vlc_t {
147
  int8_t rltab[59][3];
148
  int8_t level_add[27];
149
  int8_t golomb_order;
150
  int inc_limit;
151
  int8_t max_run;
152
} residual_vlc_t;
153

  
154
#endif /* CAVS_H */
libavcodec/cavsdata.h
19 19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 20
 */
21 21

  
22
#define SLICE_MIN_START_CODE    0x00000101
23
#define SLICE_MAX_START_CODE    0x000001af
24
#define EXT_START_CODE          0x000001b5
25
#define USER_START_CODE         0x000001b2
26
#define CAVS_START_CODE         0x000001b0
27
#define PIC_I_START_CODE        0x000001b3
28
#define PIC_PB_START_CODE       0x000001b6
22
#include "cavs.h"
29 23

  
30
#define A_AVAIL                          1
31
#define B_AVAIL                          2
32
#define C_AVAIL                          4
33
#define D_AVAIL                          8
34
#define NOT_AVAIL                       -1
35
#define REF_INTRA                       -2
36
#define REF_DIR                         -3
37

  
38
#define ESCAPE_CODE                     59
39

  
40
#define FWD0                          0x01
41
#define FWD1                          0x02
42
#define BWD0                          0x04
43
#define BWD1                          0x08
44
#define SYM0                          0x10
45
#define SYM1                          0x20
46
#define SPLITH                        0x40
47
#define SPLITV                        0x80
48

  
49
#define MV_BWD_OFFS                     12
50
#define MV_STRIDE                        4
51

  
52
enum mb_t {
53
  I_8X8 = 0,
54
  P_SKIP,
55
  P_16X16,
56
  P_16X8,
57
  P_8X16,
58
  P_8X8,
59
  B_SKIP,
60
  B_DIRECT,
61
  B_FWD_16X16,
62
  B_BWD_16X16,
63
  B_SYM_16X16,
64
  B_8X8 = 29
65
};
66

  
67
enum sub_mb_t {
68
  B_SUB_DIRECT,
69
  B_SUB_FWD,
70
  B_SUB_BWD,
71
  B_SUB_SYM
72
};
73

  
74
enum intra_luma_t {
75
  INTRA_L_VERT,
76
  INTRA_L_HORIZ,
77
  INTRA_L_LP,
78
  INTRA_L_DOWN_LEFT,
79
  INTRA_L_DOWN_RIGHT,
80
  INTRA_L_LP_LEFT,
81
  INTRA_L_LP_TOP,
82
  INTRA_L_DC_128
83
};
84

  
85
enum intra_chroma_t {
86
  INTRA_C_LP,
87
  INTRA_C_HORIZ,
88
  INTRA_C_VERT,
89
  INTRA_C_PLANE,
90
  INTRA_C_LP_LEFT,
91
  INTRA_C_LP_TOP,
92
  INTRA_C_DC_128,
93
};
94

  
95
enum mv_pred_t {
96
  MV_PRED_MEDIAN,
97
  MV_PRED_LEFT,
98
  MV_PRED_TOP,
99
  MV_PRED_TOPRIGHT,
100
  MV_PRED_PSKIP,
101
  MV_PRED_BSKIP
102
};
103

  
104
enum block_t {
105
  BLK_16X16,
106
  BLK_16X8,
107
  BLK_8X16,
108
  BLK_8X8
109
};
110

  
111
enum mv_loc_t {
112
  MV_FWD_D3 = 0,
113
  MV_FWD_B2,
114
  MV_FWD_B3,
115
  MV_FWD_C2,
116
  MV_FWD_A1,
117
  MV_FWD_X0,
118
  MV_FWD_X1,
119
  MV_FWD_A3 = 8,
120
  MV_FWD_X2,
121
  MV_FWD_X3,
122
  MV_BWD_D3 = MV_BWD_OFFS,
123
  MV_BWD_B2,
124
  MV_BWD_B3,
125
  MV_BWD_C2,
126
  MV_BWD_A1,
127
  MV_BWD_X0,
128
  MV_BWD_X1,
129
  MV_BWD_A3 = MV_BWD_OFFS+8,
130
  MV_BWD_X2,
131
  MV_BWD_X3
132
};
133

  
134
#ifdef CONFIG_CAVS_DECODER
135 24
static const uint8_t partition_flags[30] = {
136 25
  0,                                 //I_8X8
137 26
  0,                                 //P_SKIP
......
212 101
  32771,35734,38965,42497,46341,50535,55109,60099
213 102
};
214 103

  
215
DECLARE_ALIGNED_8(typedef, struct) {
216
    int16_t x;
217
    int16_t y;
218
    int16_t dist;
219
    int16_t ref;
220
} vector_t;
221

  
222 104
/** marks block as unavailable, i.e. out of picture
223 105
    or not yet decoded */
224 106
static const vector_t un_mv    = {0,0,1,NOT_AVAIL};
......
230 112
/** marks block as using intra prediction */
231 113
static const vector_t intra_mv = {0,0,1,REF_INTRA};
232 114

  
233
typedef struct residual_vlc_t {
234
  int8_t rltab[59][3];
235
  int8_t level_add[27];
236
  int8_t golomb_order;
237
  int inc_limit;
238
  int8_t max_run;
239
} residual_vlc_t;
240

  
241 115
#define EOB 0,0,0
242 116

  
243 117
static const residual_vlc_t intra_2dvlc[7] = {
......
640 514
static const int_fast8_t top_modifier_l[8]  = {-1, 1, 5,-1,-1, 5, 7, 7};
641 515
static const int_fast8_t left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6};
642 516
static const int_fast8_t top_modifier_c[7]  = { 4, 1,-1,-1, 4, 6, 6};
643
#endif /* CONFIG_CAVS_DECODER */

Also available in: Unified diff