Fixes ticket #1354
Carl Eugen Hoyos authored on 2012/10/06 13:20:52... | ... |
@@ -622,6 +622,8 @@ following image formats are supported: |
622 | 622 |
@tab fourcc: VP60,VP61,VP62 |
623 | 623 |
@item VP8 @tab E @tab X |
624 | 624 |
@tab fourcc: VP80, encoding supported through external library libvpx |
625 |
+@item Pinnacle TARGA CineWave YUV16 @tab @tab X |
|
626 |
+ @tab fourcc: Y216 |
|
625 | 627 |
@item Prores @tab @tab X |
626 | 628 |
@tab fourcc: apch,apcn,apcs,apco |
627 | 629 |
@item Q-team QPEG @tab @tab X |
... | ... |
@@ -402,6 +402,7 @@ OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o h263.o h264.o \ |
402 | 402 |
h264_cavlc.o h264_cabac.o cabac.o |
403 | 403 |
OBJS-$(CONFIG_TARGA_DECODER) += targa.o |
404 | 404 |
OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o |
405 |
+OBJS-$(CONFIG_TARGA_Y216_DECODER) += targa_y216dec.o |
|
405 | 406 |
OBJS-$(CONFIG_THEORA_DECODER) += xiph.o |
406 | 407 |
OBJS-$(CONFIG_THP_DECODER) += mjpegdec.o mjpeg.o |
407 | 408 |
OBJS-$(CONFIG_TIERTEXSEQVIDEO_DECODER) += tiertexseqv.o |
... | ... |
@@ -221,6 +221,7 @@ void avcodec_register_all(void) |
221 | 221 |
REGISTER_ENCDEC (SVQ1, svq1); |
222 | 222 |
REGISTER_DECODER (SVQ3, svq3); |
223 | 223 |
REGISTER_ENCDEC (TARGA, targa); |
224 |
+ REGISTER_DECODER (TARGA_Y216, targa_y216); |
|
224 | 225 |
REGISTER_DECODER (THEORA, theora); |
225 | 226 |
REGISTER_DECODER (THP, thp); |
226 | 227 |
REGISTER_DECODER (TIERTEXSEQVIDEO, tiertexseqvideo); |
... | ... |
@@ -275,6 +275,7 @@ enum AVCodecID { |
275 | 275 |
AV_CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), |
276 | 276 |
AV_CODEC_ID_AVUI = MKBETAG('A','V','U','I'), |
277 | 277 |
AV_CODEC_ID_AYUV = MKBETAG('A','Y','U','V'), |
278 |
+ AV_CODEC_ID_TARGA_Y216 = MKBETAG('T','2','1','6'), |
|
278 | 279 |
AV_CODEC_ID_V308 = MKBETAG('V','3','0','8'), |
279 | 280 |
AV_CODEC_ID_V408 = MKBETAG('V','4','0','8'), |
280 | 281 |
AV_CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), |
... | ... |
@@ -1260,6 +1260,13 @@ static const AVCodecDescriptor codec_descriptors[] = { |
1260 | 1260 |
.props = AV_CODEC_PROP_INTRA_ONLY, |
1261 | 1261 |
}, |
1262 | 1262 |
{ |
1263 |
+ .id = AV_CODEC_ID_TARGA_Y216, |
|
1264 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
1265 |
+ .name = "targa_y216", |
|
1266 |
+ .long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"), |
|
1267 |
+ .props = AV_CODEC_PROP_INTRA_ONLY, |
|
1268 |
+ }, |
|
1269 |
+ { |
|
1263 | 1270 |
.id = AV_CODEC_ID_V308, |
1264 | 1271 |
.type = AVMEDIA_TYPE_VIDEO, |
1265 | 1272 |
.name = "v308", |
1266 | 1273 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,108 @@ |
0 |
+/* |
|
1 |
+ * Pinnacle TARGA CineWave YUV16 decoder |
|
2 |
+ * Copyright (c) 2012 Carl Eugen Hoyos |
|
3 |
+ * |
|
4 |
+ * This file is part of FFmpeg. |
|
5 |
+ * |
|
6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
8 |
+ * License as published by the Free Software Foundation; either |
|
9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
10 |
+ * |
|
11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
+ * Lesser General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
+ */ |
|
20 |
+ |
|
21 |
+#include "avcodec.h" |
|
22 |
+ |
|
23 |
+static av_cold int y216_decode_init(AVCodecContext *avctx) |
|
24 |
+{ |
|
25 |
+ avctx->pix_fmt = PIX_FMT_YUV422P16; |
|
26 |
+ avctx->bits_per_raw_sample = 14; |
|
27 |
+ |
|
28 |
+ avctx->coded_frame = avcodec_alloc_frame(); |
|
29 |
+ |
|
30 |
+ if (!avctx->coded_frame) { |
|
31 |
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
|
32 |
+ return AVERROR(ENOMEM); |
|
33 |
+ } |
|
34 |
+ |
|
35 |
+ return 0; |
|
36 |
+} |
|
37 |
+ |
|
38 |
+static int y216_decode_frame(AVCodecContext *avctx, void *data, |
|
39 |
+ int *data_size, AVPacket *avpkt) |
|
40 |
+{ |
|
41 |
+ AVFrame *pic = avctx->coded_frame; |
|
42 |
+ const uint16_t *src = (uint16_t *)avpkt->data; |
|
43 |
+ uint16_t *y, *u, *v, aligned_width = FFALIGN(avctx->width, 4); |
|
44 |
+ int i, j; |
|
45 |
+ |
|
46 |
+ if (pic->data[0]) |
|
47 |
+ avctx->release_buffer(avctx, pic); |
|
48 |
+ |
|
49 |
+ if (avpkt->size < 4 * avctx->height * aligned_width) { |
|
50 |
+ av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); |
|
51 |
+ return AVERROR(EINVAL); |
|
52 |
+ } |
|
53 |
+ |
|
54 |
+ pic->reference = 0; |
|
55 |
+ |
|
56 |
+ if (avctx->get_buffer(avctx, pic) < 0) { |
|
57 |
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); |
|
58 |
+ return AVERROR(ENOMEM); |
|
59 |
+ } |
|
60 |
+ |
|
61 |
+ pic->key_frame = 1; |
|
62 |
+ pic->pict_type = AV_PICTURE_TYPE_I; |
|
63 |
+ |
|
64 |
+ y = (uint16_t *)pic->data[0]; |
|
65 |
+ u = (uint16_t *)pic->data[1]; |
|
66 |
+ v = (uint16_t *)pic->data[2]; |
|
67 |
+ |
|
68 |
+ for (i = 0; i < avctx->height; i++) { |
|
69 |
+ for (j = 0; j < avctx->width >> 1; j++) { |
|
70 |
+ u[ j ] = src[4 * j ] << 2 | src[4 * j ] >> 14; |
|
71 |
+ y[2 * j ] = src[4 * j + 1] << 2 | src[4 * j + 1] >> 14; |
|
72 |
+ v[ j ] = src[4 * j + 2] << 2 | src[4 * j + 2] >> 14; |
|
73 |
+ y[2 * j + 1] = src[4 * j + 3] << 2 | src[4 * j + 3] >> 14; |
|
74 |
+ } |
|
75 |
+ |
|
76 |
+ y += pic->linesize[0] >> 1; |
|
77 |
+ u += pic->linesize[1] >> 1; |
|
78 |
+ v += pic->linesize[2] >> 1; |
|
79 |
+ src += aligned_width << 1; |
|
80 |
+ } |
|
81 |
+ |
|
82 |
+ *data_size = sizeof(AVFrame); |
|
83 |
+ *(AVFrame *)data = *pic; |
|
84 |
+ |
|
85 |
+ return avpkt->size; |
|
86 |
+} |
|
87 |
+ |
|
88 |
+static av_cold int y216_decode_close(AVCodecContext *avctx) |
|
89 |
+{ |
|
90 |
+ if (avctx->coded_frame->data[0]) |
|
91 |
+ avctx->release_buffer(avctx, avctx->coded_frame); |
|
92 |
+ |
|
93 |
+ av_freep(&avctx->coded_frame); |
|
94 |
+ |
|
95 |
+ return 0; |
|
96 |
+} |
|
97 |
+ |
|
98 |
+AVCodec ff_targa_y216_decoder = { |
|
99 |
+ .name = "targa_y216", |
|
100 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
101 |
+ .id = AV_CODEC_ID_TARGA_Y216, |
|
102 |
+ .init = y216_decode_init, |
|
103 |
+ .decode = y216_decode_frame, |
|
104 |
+ .close = y216_decode_close, |
|
105 |
+ .capabilities = CODEC_CAP_DR1, |
|
106 |
+ .long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"), |
|
107 |
+}; |
... | ... |
@@ -29,7 +29,7 @@ |
29 | 29 |
#include "libavutil/avutil.h" |
30 | 30 |
|
31 | 31 |
#define LIBAVCODEC_VERSION_MAJOR 54 |
32 |
-#define LIBAVCODEC_VERSION_MINOR 63 |
|
32 |
+#define LIBAVCODEC_VERSION_MINOR 64 |
|
33 | 33 |
#define LIBAVCODEC_VERSION_MICRO 100 |
34 | 34 |
|
35 | 35 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
... | ... |
@@ -104,6 +104,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = { |
104 | 104 |
{ AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') }, /* UNCOMPRESSED 10BIT 4:4:4 */ |
105 | 105 |
{ AV_CODEC_ID_Y41P, MKTAG('Y', '4', '1', 'P') }, /* UNCOMPRESSED 12BIT 4:1:1 */ |
106 | 106 |
{ AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') }, /* libquicktime packed yuv420p */ |
107 |
+ { AV_CODEC_ID_TARGA_Y216, MKTAG('Y', '2', '1', '6') }, |
|
107 | 108 |
|
108 | 109 |
{ AV_CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */ |
109 | 110 |
{ AV_CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') }, /* Motion-JPEG (format A) */ |