comparison vp3.c @ 7938:66226ee647a4 libavcodec

Use skip_frame for keyframe-only decoding rather than #ifdef
author conrad
date Mon, 29 Sep 2008 22:04:35 +0000
parents a57aee2e0ae0
children 3ff31e4454cd
comparison
equal deleted inserted replaced
7937:50516d28608a 7938:66226ee647a4
47 * Debugging Variables 47 * Debugging Variables
48 * 48 *
49 * Define one or more of the following compile-time variables to 1 to obtain 49 * Define one or more of the following compile-time variables to 1 to obtain
50 * elaborate information about certain aspects of the decoding process. 50 * elaborate information about certain aspects of the decoding process.
51 * 51 *
52 * KEYFRAMES_ONLY: set this to 1 to only see keyframes (VP3 slideshow mode)
53 * DEBUG_VP3: high-level decoding flow 52 * DEBUG_VP3: high-level decoding flow
54 * DEBUG_INIT: initialization parameters 53 * DEBUG_INIT: initialization parameters
55 * DEBUG_DEQUANTIZERS: display how the dequanization tables are built 54 * DEBUG_DEQUANTIZERS: display how the dequanization tables are built
56 * DEBUG_BLOCK_CODING: unpacking the superblock/macroblock/fragment coding 55 * DEBUG_BLOCK_CODING: unpacking the superblock/macroblock/fragment coding
57 * DEBUG_MODES: unpacking the coding modes for individual fragments 56 * DEBUG_MODES: unpacking the coding modes for individual fragments
59 * DEBUG_TOKEN: display exhaustive information about each DCT token 58 * DEBUG_TOKEN: display exhaustive information about each DCT token
60 * DEBUG_VLC: display the VLCs as they are extracted from the stream 59 * DEBUG_VLC: display the VLCs as they are extracted from the stream
61 * DEBUG_DC_PRED: display the process of reversing DC prediction 60 * DEBUG_DC_PRED: display the process of reversing DC prediction
62 * DEBUG_IDCT: show every detail of the IDCT process 61 * DEBUG_IDCT: show every detail of the IDCT process
63 */ 62 */
64
65 #define KEYFRAMES_ONLY 0
66 63
67 #define DEBUG_VP3 0 64 #define DEBUG_VP3 0
68 #define DEBUG_INIT 0 65 #define DEBUG_INIT 0
69 #define DEBUG_DEQUANTIZERS 0 66 #define DEBUG_DEQUANTIZERS 0
70 #define DEBUG_BLOCK_CODING 0 67 #define DEBUG_BLOCK_CODING 0
2174 if (s->quality_index != s->last_quality_index) { 2171 if (s->quality_index != s->last_quality_index) {
2175 init_dequantizer(s); 2172 init_dequantizer(s);
2176 init_loop_filter(s); 2173 init_loop_filter(s);
2177 } 2174 }
2178 2175
2176 if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
2177 return buf_size;
2178
2179 if (s->keyframe) { 2179 if (s->keyframe) {
2180 if (!s->theora) 2180 if (!s->theora)
2181 { 2181 {
2182 skip_bits(&gb, 4); /* width code */ 2182 skip_bits(&gb, 4); /* width code */
2183 skip_bits(&gb, 4); /* height code */ 2183 skip_bits(&gb, 4); /* height code */
2240 s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame 2240 s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
2241 s->current_frame.qstride= 0; 2241 s->current_frame.qstride= 0;
2242 2242
2243 init_frame(s, &gb); 2243 init_frame(s, &gb);
2244 2244
2245 #if KEYFRAMES_ONLY
2246 if (!s->keyframe) {
2247
2248 memcpy(s->current_frame.data[0], s->golden_frame.data[0],
2249 s->current_frame.linesize[0] * s->height);
2250 memcpy(s->current_frame.data[1], s->golden_frame.data[1],
2251 s->current_frame.linesize[1] * s->height / 2);
2252 memcpy(s->current_frame.data[2], s->golden_frame.data[2],
2253 s->current_frame.linesize[2] * s->height / 2);
2254
2255 } else {
2256 #endif
2257
2258 if (unpack_superblocks(s, &gb)){ 2245 if (unpack_superblocks(s, &gb)){
2259 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); 2246 av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
2260 return -1; 2247 return -1;
2261 } 2248 }
2262 if (unpack_modes(s, &gb)){ 2249 if (unpack_modes(s, &gb)){
2282 2269
2283 for (i = 0; i < s->macroblock_height; i++) 2270 for (i = 0; i < s->macroblock_height; i++)
2284 render_slice(s, i); 2271 render_slice(s, i);
2285 2272
2286 apply_loop_filter(s); 2273 apply_loop_filter(s);
2287 #if KEYFRAMES_ONLY
2288 }
2289 #endif
2290 2274
2291 *data_size=sizeof(AVFrame); 2275 *data_size=sizeof(AVFrame);
2292 *(AVFrame*)data= s->current_frame; 2276 *(AVFrame*)data= s->current_frame;
2293 2277
2294 /* release the last frame, if it is allocated and if it is not the 2278 /* release the last frame, if it is allocated and if it is not the