comparison fraps.c @ 6476:e9aa4dc2d937 libavcodec

Add step variable (for future v5 decoding)
author kostya
date Sun, 09 Mar 2008 09:03:23 +0000
parents e0cd9697ac6d
children 36fb492f44cc
comparison
equal deleted inserted replaced
6475:e9431bea10dc 6476:e9aa4dc2d937
82 82
83 /** 83 /**
84 * decode Fraps v2 packed plane 84 * decode Fraps v2 packed plane
85 */ 85 */
86 static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, 86 static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
87 int h, const uint8_t *src, int size, int Uoff) 87 int h, const uint8_t *src, int size, int Uoff,
88 const int step)
88 { 89 {
89 int i, j; 90 int i, j;
90 GetBitContext gb; 91 GetBitContext gb;
91 VLC vlc; 92 VLC vlc;
92 Node nodes[512]; 93 Node nodes[512];
102 /* convert bits so they may be used by standard bitreader */ 103 /* convert bits so they may be used by standard bitreader */
103 s->dsp.bswap_buf((uint32_t *)s->tmpbuf, (const uint32_t *)src, size >> 2); 104 s->dsp.bswap_buf((uint32_t *)s->tmpbuf, (const uint32_t *)src, size >> 2);
104 105
105 init_get_bits(&gb, s->tmpbuf, size * 8); 106 init_get_bits(&gb, s->tmpbuf, size * 8);
106 for(j = 0; j < h; j++){ 107 for(j = 0; j < h; j++){
107 for(i = 0; i < w; i++){ 108 for(i = 0; i < w*step; i += step){
108 dst[i] = get_vlc2(&gb, vlc.table, 9, 3); 109 dst[i] = get_vlc2(&gb, vlc.table, 9, 3);
109 /* lines are stored as deltas between previous lines 110 /* lines are stored as deltas between previous lines
110 * and we need to add 0x80 to the first lines of chroma planes 111 * and we need to add 0x80 to the first lines of chroma planes
111 */ 112 */
112 if(j) dst[i] += dst[i - stride]; 113 if(j) dst[i] += dst[i - stride];
279 offs[planes] = buf_size; 280 offs[planes] = buf_size;
280 for(i = 0; i < planes; i++){ 281 for(i = 0; i < planes; i++){
281 is_chroma = !!i; 282 is_chroma = !!i;
282 s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE); 283 s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
283 if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma, 284 if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma,
284 avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma) < 0) { 285 avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
285 av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i); 286 av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
286 return -1; 287 return -1;
287 } 288 }
288 } 289 }
289 break; 290 break;