comparison r210dec.c @ 12490:e1a4ceb96a07 libavcodec

Add R10k decoder. Original patch by Zhou Zongyi, zhouzy A os pku edu cn, resubmitted by James Darnley, james.darnley gmail, changes by me.
author cehoyos
date Mon, 13 Sep 2010 22:08:51 +0000
parents 8b28e74de2c0
children 990f8a5fc8af
comparison
equal deleted inserted replaced
12489:8cd356429e9f 12490:e1a4ceb96a07
61 for (h = 0; h < avctx->height; h++) { 61 for (h = 0; h < avctx->height; h++) {
62 uint16_t *dst = (uint16_t *)dst_line; 62 uint16_t *dst = (uint16_t *)dst_line;
63 for (w = 0; w < avctx->width; w++) { 63 for (w = 0; w < avctx->width; w++) {
64 uint32_t pixel = av_be2ne32(*src++); 64 uint32_t pixel = av_be2ne32(*src++);
65 uint16_t r, g, b; 65 uint16_t r, g, b;
66 if (avctx->codec_id==CODEC_ID_R210) {
66 b = pixel << 6; 67 b = pixel << 6;
67 g = (pixel >> 4) & 0xffc0; 68 g = (pixel >> 4) & 0xffc0;
68 r = (pixel >> 14) & 0xffc0; 69 r = (pixel >> 14) & 0xffc0;
70 } else {
71 b = pixel << 4;
72 g = (pixel >> 6) & 0xffc0;
73 r = (pixel >> 16) & 0xffc0;
74 }
69 *dst++ = r | (r >> 10); 75 *dst++ = r | (r >> 10);
70 *dst++ = g | (g >> 10); 76 *dst++ = g | (g >> 10);
71 *dst++ = b | (b >> 10); 77 *dst++ = b | (b >> 10);
72 } 78 }
73 src += aligned_width - avctx->width; 79 src += aligned_width - avctx->width;
88 av_freep(&avctx->coded_frame); 94 av_freep(&avctx->coded_frame);
89 95
90 return 0; 96 return 0;
91 } 97 }
92 98
99 #if CONFIG_R210_DECODER
93 AVCodec r210_decoder = { 100 AVCodec r210_decoder = {
94 "r210", 101 "r210",
95 AVMEDIA_TYPE_VIDEO, 102 AVMEDIA_TYPE_VIDEO,
96 CODEC_ID_R210, 103 CODEC_ID_R210,
97 0, 104 0,
100 decode_close, 107 decode_close,
101 decode_frame, 108 decode_frame,
102 CODEC_CAP_DR1, 109 CODEC_CAP_DR1,
103 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"), 110 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
104 }; 111 };
112 #endif
113 #if CONFIG_R10K_DECODER
114 AVCodec r10k_decoder = {
115 "r10k",
116 AVMEDIA_TYPE_VIDEO,
117 CODEC_ID_R10K,
118 0,
119 decode_init,
120 NULL,
121 decode_close,
122 decode_frame,
123 CODEC_CAP_DR1,
124 .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
125 };
126 #endif