comparison mimic.c @ 6653:4421d9c976d0 libavcodec

Cosmetics and style.
author ramiro
date Sat, 19 Apr 2008 12:34:48 +0000
parents 1aa282868038
children 603c780be9ff
comparison
equal deleted inserted replaced
6652:1aa282868038 6653:4421d9c976d0
97 33, 26, 19, 12, 5, 6, 13, 20, 97 33, 26, 19, 12, 5, 6, 13, 20,
98 27, 34, 41, 48, 56, 49, 42, 35, 98 27, 34, 41, 48, 56, 49, 42, 35,
99 28, 21, 14, 7, 15, 22, 29, 36, 99 28, 21, 14, 7, 15, 22, 29, 36,
100 43, 50, 57, 58, 51, 44, 37, 30, 100 43, 50, 57, 58, 51, 44, 37, 30,
101 23, 31, 38, 45, 52, 59, 39, 46, 101 23, 31, 38, 45, 52, 59, 39, 46,
102 53, 60, 61, 54, 47, 55, 62, 63 102 53, 60, 61, 54, 47, 55, 62, 63,
103 }; 103 };
104 104
105 static av_cold int mimic_decode_init(AVCodecContext *avctx) 105 static av_cold int mimic_decode_init(AVCodecContext *avctx)
106 { 106 {
107 MimicContext *ctx = avctx->priv_data; 107 MimicContext *ctx = avctx->priv_data;
211 const int qscale = av_clip(10000-quality,is_chroma?1000:2000,10000)<<2; 211 const int qscale = av_clip(10000-quality,is_chroma?1000:2000,10000)<<2;
212 const int stride = ctx->flipped_ptrs[ctx->cur_index].linesize[plane]; 212 const int stride = ctx->flipped_ptrs[ctx->cur_index].linesize[plane];
213 const uint8_t *src = ctx->flipped_ptrs[ctx->prev_index].data[plane]; 213 const uint8_t *src = ctx->flipped_ptrs[ctx->prev_index].data[plane];
214 uint8_t *dst = ctx->flipped_ptrs[ctx->cur_index ].data[plane]; 214 uint8_t *dst = ctx->flipped_ptrs[ctx->cur_index ].data[plane];
215 215
216 for(y = 0 ; y < ctx->num_vblocks[plane] ; y++) { 216 for(y = 0; y < ctx->num_vblocks[plane]; y++) {
217 for(x = 0; x < ctx->num_hblocks[plane]; x++) { 217 for(x = 0; x < ctx->num_hblocks[plane]; x++) {
218 218
219 /* Check for a change condition in the current block. 219 /* Check for a change condition in the current block.
220 * - iframes always change. 220 * - iframes always change.
221 * - Luma plane changes on get_bits1 == 0 221 * - Luma plane changes on get_bits1 == 0
267 { 267 {
268 int i; 268 int i;
269 dst->data[0] = src->data[0]+( ctx->avctx->height -1)*src->linesize[0]; 269 dst->data[0] = src->data[0]+( ctx->avctx->height -1)*src->linesize[0];
270 dst->data[1] = src->data[2]+((ctx->avctx->height>>1)-1)*src->linesize[2]; 270 dst->data[1] = src->data[2]+((ctx->avctx->height>>1)-1)*src->linesize[2];
271 dst->data[2] = src->data[1]+((ctx->avctx->height>>1)-1)*src->linesize[1]; 271 dst->data[2] = src->data[1]+((ctx->avctx->height>>1)-1)*src->linesize[1];
272 for(i = 0 ; i < 3 ; i++) 272 for(i = 0; i < 3; i++)
273 dst->linesize[i] = -src->linesize[i]; 273 dst->linesize[i] = -src->linesize[i];
274 } 274 }
275 275
276 static int mimic_decode_frame(AVCodecContext *avctx, void *data, 276 static int mimic_decode_frame(AVCodecContext *avctx, void *data,
277 int *data_size, const uint8_t *buf, int buf_size) 277 int *data_size, const uint8_t *buf, int buf_size)
312 312
313 ctx->avctx = avctx; 313 ctx->avctx = avctx;
314 avctx->width = width; 314 avctx->width = width;
315 avctx->height = height; 315 avctx->height = height;
316 avctx->pix_fmt = PIX_FMT_YUV420P; 316 avctx->pix_fmt = PIX_FMT_YUV420P;
317 for(i = 0 ; i < 3 ; i++) { 317 for(i = 0; i < 3; i++) {
318 ctx->num_vblocks[i] = -((-height) >> (3 + !!i)); 318 ctx->num_vblocks[i] = -((-height) >> (3 + !!i));
319 ctx->num_hblocks[i] = width >> (3 + !!i) ; 319 ctx->num_hblocks[i] = width >> (3 + !!i) ;
320 } 320 }
321 } else if(width != ctx->avctx->width || height != ctx->avctx->height) { 321 } else if(width != ctx->avctx->width || height != ctx->avctx->height) {
322 av_log(avctx, AV_LOG_ERROR, "resolution changing is not supported\n"); 322 av_log(avctx, AV_LOG_ERROR, "resolution changing is not supported\n");