comparison v210dec.c @ 10131:4f974b8d8851 libavcodec

prettyprinting cosmetics
author diego
date Sat, 05 Sep 2009 11:22:36 +0000
parents ef0cf18b192d
children a48c43551737
comparison
equal deleted inserted replaced
10130:c2d08aedeeed 10131:4f974b8d8851
30 av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n"); 30 av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
31 return -1; 31 return -1;
32 } 32 }
33 if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) 33 if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0)
34 return -1; 34 return -1;
35 avctx->pix_fmt = PIX_FMT_YUV422P16; 35 avctx->pix_fmt = PIX_FMT_YUV422P16;
36 avctx->bits_per_raw_sample = 10; 36 avctx->bits_per_raw_sample = 10;
37 37
38 avctx->coded_frame = avcodec_alloc_frame(); 38 avctx->coded_frame = avcodec_alloc_frame();
39 39
40 return 0; 40 return 0;
41 } 41 }
42 42
43 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) 43 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
44 AVPacket *avpkt)
44 { 45 {
45 int h, w; 46 int h, w;
46 AVFrame *pic = avctx->coded_frame; 47 AVFrame *pic = avctx->coded_frame;
47 const uint8_t *psrc = avpkt->data; 48 const uint8_t *psrc = avpkt->data;
48 uint16_t *y, *u, *v; 49 uint16_t *y, *u, *v;
65 u = (uint16_t*)pic->data[1]; 66 u = (uint16_t*)pic->data[1];
66 v = (uint16_t*)pic->data[2]; 67 v = (uint16_t*)pic->data[2];
67 pic->pict_type = FF_I_TYPE; 68 pic->pict_type = FF_I_TYPE;
68 pic->key_frame = 1; 69 pic->key_frame = 1;
69 70
70 #define READ_PIXELS(a, b, c) \ 71 #define READ_PIXELS(a, b, c) \
71 do { \ 72 do { \
72 val = le2me_32(*src++); \ 73 val = le2me_32(*src++); \
73 *a++ = val << 6; \ 74 *a++ = val << 6; \
74 *b++ = (val >> 4) & 0xFFC0; \ 75 *b++ = (val >> 4) & 0xFFC0; \
75 *c++ = (val >> 14) & 0xFFC0; \ 76 *c++ = (val >> 14) & 0xFFC0; \
76 } while (0); 77 } while (0);
77 78
98 *v++ = val << 6; 99 *v++ = val << 6;
99 *y++ = (val >> 4) & 0xFFC0; 100 *y++ = (val >> 4) & 0xFFC0;
100 } 101 }
101 102
102 psrc += stride; 103 psrc += stride;
103 y += pic->linesize[0]/2 - avctx->width; 104 y += pic->linesize[0] / 2 - avctx->width;
104 u += pic->linesize[1]/2 - avctx->width/2; 105 u += pic->linesize[1] / 2 - avctx->width / 2;
105 v += pic->linesize[2]/2 - avctx->width/2; 106 v += pic->linesize[2] / 2 - avctx->width / 2;
106 } 107 }
107 108
108 *data_size = sizeof(AVFrame); 109 *data_size = sizeof(AVFrame);
109 *(AVFrame*)data = *avctx->coded_frame; 110 *(AVFrame*)data = *avctx->coded_frame;
110 111