OLD | NEW |
1 /* | 1 /* |
2 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. | 2 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. |
3 * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> | 3 * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 MV_BWD_B3, | 129 MV_BWD_B3, |
130 MV_BWD_C2, | 130 MV_BWD_C2, |
131 MV_BWD_A1, | 131 MV_BWD_A1, |
132 MV_BWD_X0, | 132 MV_BWD_X0, |
133 MV_BWD_X1, | 133 MV_BWD_X1, |
134 MV_BWD_A3 = MV_BWD_OFFS+8, | 134 MV_BWD_A3 = MV_BWD_OFFS+8, |
135 MV_BWD_X2, | 135 MV_BWD_X2, |
136 MV_BWD_X3 | 136 MV_BWD_X3 |
137 }; | 137 }; |
138 | 138 |
139 DECLARE_ALIGNED_8(typedef, struct) { | 139 DECLARE_ALIGNED(8, typedef, struct) { |
140 int16_t x; | 140 int16_t x; |
141 int16_t y; | 141 int16_t y; |
142 int16_t dist; | 142 int16_t dist; |
143 int16_t ref; | 143 int16_t ref; |
144 } cavs_vector; | 144 } cavs_vector; |
145 | 145 |
146 struct dec_2dvlc { | 146 struct dec_2dvlc { |
147 int8_t rltab[59][3]; | 147 int8_t rltab[59][3]; |
148 int8_t level_add[27]; | 148 int8_t level_add[27]; |
149 int8_t golomb_order; | 149 int8_t golomb_order; |
150 int inc_limit; | 150 int inc_limit; |
151 int8_t max_run; | 151 int8_t max_run; |
152 }; | 152 }; |
153 | 153 |
154 typedef struct { | 154 typedef struct { |
155 MpegEncContext s; | 155 MpegEncContext s; |
156 Picture picture; ///< currently decoded frame | 156 Picture picture; ///< currently decoded frame |
157 Picture DPB[2]; ///< reference frames | 157 Picture DPB[2]; ///< reference frames |
158 int dist[2]; ///< temporal distances from current frame to ref frames | 158 int dist[2]; ///< temporal distances from current frame to ref frames |
159 int profile, level; | 159 int profile, level; |
160 int aspect_ratio; | 160 int aspect_ratio; |
161 int mb_width, mb_height; | 161 int mb_width, mb_height; |
162 int pic_type; | 162 int pic_type; |
| 163 int stream_revision; ///<0 for samples from 2006, 1 for rm52j encoder |
163 int progressive; | 164 int progressive; |
164 int pic_structure; | 165 int pic_structure; |
165 int skip_mode_flag; ///< select between skip_count or one skip_flag per MB | 166 int skip_mode_flag; ///< select between skip_count or one skip_flag per MB |
166 int loop_filter_disable; | 167 int loop_filter_disable; |
167 int alpha_offset, beta_offset; | 168 int alpha_offset, beta_offset; |
168 int ref_flag; | 169 int ref_flag; |
169 int mbx, mby, mbidx; ///< macroblock coordinates | 170 int mbx, mby, mbidx; ///< macroblock coordinates |
170 int flags; ///< availability flags of neighbouring macroblocks | 171 int flags; ///< availability flags of neighbouring macroblocks |
171 int stc; ///< last start code | 172 int stc; ///< last start code |
172 uint8_t *cy, *cu, *cv; ///< current MB sample pointers | 173 uint8_t *cy, *cu, *cv; ///< current MB sample pointers |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 241 |
241 static inline void modify_pred(const int_fast8_t *mod_table, int *mode) { | 242 static inline void modify_pred(const int_fast8_t *mod_table, int *mode) { |
242 *mode = mod_table[*mode]; | 243 *mode = mod_table[*mode]; |
243 if(*mode < 0) { | 244 if(*mode < 0) { |
244 av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n"); | 245 av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n"); |
245 *mode = 0; | 246 *mode = 0; |
246 } | 247 } |
247 } | 248 } |
248 | 249 |
249 static inline void set_intra_mode_default(AVSContext *h) { | 250 static inline void set_intra_mode_default(AVSContext *h) { |
250 h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP; | 251 if(h->stream_revision > 0) { |
251 h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP; | 252 h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; |
| 253 h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL; |
| 254 } else { |
| 255 h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP; |
| 256 h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP; |
| 257 } |
252 } | 258 } |
253 | 259 |
254 static inline void set_mvs(cavs_vector *mv, enum cavs_block size) { | 260 static inline void set_mvs(cavs_vector *mv, enum cavs_block size) { |
255 switch(size) { | 261 switch(size) { |
256 case BLK_16X16: | 262 case BLK_16X16: |
257 mv[MV_STRIDE ] = mv[0]; | 263 mv[MV_STRIDE ] = mv[0]; |
258 mv[MV_STRIDE+1] = mv[0]; | 264 mv[MV_STRIDE+1] = mv[0]; |
259 case BLK_16X8: | 265 case BLK_16X8: |
260 mv[1] = mv[0]; | 266 mv[1] = mv[0]; |
261 break; | 267 break; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, | 309 void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, |
304 enum cavs_mv_pred mode, enum cavs_block size, int ref); | 310 enum cavs_mv_pred mode, enum cavs_block size, int ref); |
305 void ff_cavs_init_mb(AVSContext *h); | 311 void ff_cavs_init_mb(AVSContext *h); |
306 int ff_cavs_next_mb(AVSContext *h); | 312 int ff_cavs_next_mb(AVSContext *h); |
307 void ff_cavs_init_pic(AVSContext *h); | 313 void ff_cavs_init_pic(AVSContext *h); |
308 void ff_cavs_init_top_lines(AVSContext *h); | 314 void ff_cavs_init_top_lines(AVSContext *h); |
309 int ff_cavs_init(AVCodecContext *avctx); | 315 int ff_cavs_init(AVCodecContext *avctx); |
310 int ff_cavs_end (AVCodecContext *avctx); | 316 int ff_cavs_end (AVCodecContext *avctx); |
311 | 317 |
312 #endif /* AVCODEC_CAVS_H */ | 318 #endif /* AVCODEC_CAVS_H */ |
OLD | NEW |