History

Add decoder for R210 (uncompressed 10-bit RGB) codec.

Originally committed as revision 20891 to svn://svn.ffmpeg.org/ffmpeg/trunk

Reimar Döffinger committed 16 years ago

Commit 4aaab0a1 parent a3d995c8 files · +111 −0Browse files

Unified · Split

8 files
  1. Changelog +1 −0
  2. doc/general.texi +1 −0
  3. libavcodec/Makefile +1 −0
  4. libavcodec/allcodecs.c +1 −0
  5. libavcodec/avcodec.h +1 −0
  6. libavcodec/r210dec.c +104 −0
  7. libavformat/isom.c +1 −0
  8. libavformat/riff.c +1 −0
Changelog+1−0
@@ -45,6 +45,7 @@ version <next>: · 44 unmodified lines
45- -formats option split into -formats, -codecs, -bsfs, and -protocols45- -formats option split into -formats, -codecs, -bsfs, and -protocols
46- IV8 demuxer46- IV8 demuxer
47- CDG demuxer and decoder47- CDG demuxer and decoder
48- R210 decoder
48 49
49 50
50 51
doc/general.texi+1−0
@@ -430,6 +430,7 @@ following image formats are supported: · 429 unmodified lines
430 @tab fourcc: 'smc '430 @tab fourcc: 'smc '
431@item QuickTime video (RPZA) @tab @tab X431@item QuickTime video (RPZA) @tab @tab X
432 @tab fourcc: rpza432 @tab fourcc: rpza
433@item R210 Quicktime Uncompressed RGB 10-bit @tab @tab X
433@item Raw Video @tab X @tab X434@item Raw Video @tab X @tab X
434@item RealVideo 1.0 @tab X @tab X435@item RealVideo 1.0 @tab X @tab X
435@item RealVideo 2.0 @tab X @tab X436@item RealVideo 2.0 @tab X @tab X
libavcodec/Makefile+1−0
@@ -247,6 +247,7 @@ OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o · 246 unmodified lines
247OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o247OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
248OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o248OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
249OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o249OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
250OBJS-$(CONFIG_R210_DECODER) += r210dec.o
250OBJS-$(CONFIG_RA_144_DECODER) += ra144.o celp_filters.o251OBJS-$(CONFIG_RA_144_DECODER) += ra144.o celp_filters.o
251OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o252OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o
252OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o253OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
libavcodec/allcodecs.c+1−0
@@ -146,6 +146,7 @@ void avcodec_register_all(void) · 145 unmodified lines
146 REGISTER_DECODER (QDRAW, qdraw);146 REGISTER_DECODER (QDRAW, qdraw);
147 REGISTER_DECODER (QPEG, qpeg);147 REGISTER_DECODER (QPEG, qpeg);
148 REGISTER_ENCDEC (QTRLE, qtrle);148 REGISTER_ENCDEC (QTRLE, qtrle);
149 REGISTER_DECODER (R210, r210);
149 REGISTER_ENCDEC (RAWVIDEO, rawvideo);150 REGISTER_ENCDEC (RAWVIDEO, rawvideo);
150 REGISTER_DECODER (RL2, rl2);151 REGISTER_DECODER (RL2, rl2);
151 REGISTER_ENCDEC (ROQ, roq);152 REGISTER_ENCDEC (ROQ, roq);
libavcodec/avcodec.h+1−0
@@ -201,6 +201,7 @@ enum CodecID { · 200 unmodified lines
201 CODEC_ID_FRWU,201 CODEC_ID_FRWU,
202 CODEC_ID_FLASHSV2,202 CODEC_ID_FLASHSV2,
203 CODEC_ID_CDGRAPHICS,203 CODEC_ID_CDGRAPHICS,
204 CODEC_ID_R210,
204 205
205 /* various PCM "codecs" */206 /* various PCM "codecs" */
206 CODEC_ID_PCM_S16LE= 0x10000,207 CODEC_ID_PCM_S16LE= 0x10000,
libavcodec/r210dec.c+104−0
@@ -0,0 +1,104 @@
1/*
2 * R210 decoder
3 *
4 * Copyright (c) 2009 Reimar Doeffinger <Reimar.Doeffinger@gmx.de>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include "avcodec.h"
24#include "libavutil/bswap.h"
25
26static av_cold int decode_init(AVCodecContext *avctx)
27{
28 avctx->pix_fmt = PIX_FMT_RGB48;
29 avctx->bits_per_raw_sample = 10;
30
31 avctx->coded_frame = avcodec_alloc_frame();
32
33 return 0;
34}
35
36static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
37 AVPacket *avpkt)
38{
39 int h, w;
40 AVFrame *pic = avctx->coded_frame;
41 const uint32_t *src = (const uint32_t *)avpkt->data;
42 int aligned_width = FFALIGN(avctx->width, 64);
43 uint8_t *dst_line;
44
45 if (pic->data[0])
46 avctx->release_buffer(avctx, pic);
47
48 if (avpkt->size < 4 * aligned_width * avctx->height) {
49 av_log(avctx, AV_LOG_ERROR, "packet too small\n");
50 return -1;
51 }
52
53 pic->reference = 0;
54 if (avctx->get_buffer(avctx, pic) < 0)
55 return -1;
56
57 pic->pict_type = FF_I_TYPE;
58 pic->key_frame = 1;
59 dst_line = pic->data[0];
60
61 for (h = 0; h < avctx->height; h++) {
62 uint16_t *dst = (uint16_t *)dst_line;
63 for (w = 0; w < avctx->width; w++) {
64 uint32_t pixel = be2me_32(*src++);
65 uint16_t r, g, b;
66 r = pixel << 6;
67 g = (pixel >> 4) & 0xffc0;
68 b = (pixel >> 14) & 0xffc0;
69 *dst++ = r | (r >> 10);
70 *dst++ = g | (g >> 10);
71 *dst++ = b | (b >> 10);
72 }
73 src += aligned_width - avctx->width;
74 dst_line += pic->linesize[0];
75 }
76
77 *data_size = sizeof(AVFrame);
78 *(AVFrame*)data = *avctx->coded_frame;
79
80 return avpkt->size;
81}
82
83static av_cold int decode_close(AVCodecContext *avctx)
84{
85 AVFrame *pic = avctx->coded_frame;
86 if (pic->data[0])
87 avctx->release_buffer(avctx, pic);
88 av_freep(&avctx->coded_frame);
89
90 return 0;
91}
92
93AVCodec r210_decoder = {
94 "r210",
95 CODEC_TYPE_VIDEO,
96 CODEC_ID_R210,
97 0,
98 decode_init,
99 NULL,
100 decode_close,
101 decode_frame,
102 CODEC_CAP_DR1,
103 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
104};
libavformat/isom.c+1−0
@@ -67,6 +67,7 @@ const AVCodecTag codec_movvideo_tags[] = { · 66 unmodified lines
67 { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* UNCOMPRESSED 8BIT 4:2:2 */67 { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* UNCOMPRESSED 8BIT 4:2:2 */
68 { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2vuy but byte swapped */68 { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2vuy but byte swapped */
69 69
70 { CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */
70 { CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */71 { CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
71 72
72 { CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */73 { CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */
libavformat/riff.c+1−0
@@ -163,6 +163,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { · 162 unmodified lines
163 { CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },163 { CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
164 { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },164 { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
165 { CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },165 { CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
166 { CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
166 { CODEC_ID_V210, MKTAG('v', '2', '1', '0') },167 { CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
167 { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },168 { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
168 { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },169 { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t