Originally committed as revision 20915 to svn://svn.ffmpeg.org/ffmpeg/trunk
Kostya Shishkov authored on 2009/12/24 01:01:15... | ... |
@@ -318,6 +318,7 @@ following image formats are supported: |
318 | 318 |
@item ATI VCR2 @tab @tab X |
319 | 319 |
@tab fourcc: VCR2 |
320 | 320 |
@item Auravision Aura @tab @tab X |
321 |
+@item Auravision Aura 2 @tab @tab X |
|
321 | 322 |
@item Autodesk Animator Flic video @tab @tab X |
322 | 323 |
@item Autodesk RLE @tab @tab X |
323 | 324 |
@tab fourcc: AASC |
... | ... |
@@ -61,6 +61,7 @@ OBJS-$(CONFIG_ASV2_ENCODER) += asv1.o mpeg12data.o |
61 | 61 |
OBJS-$(CONFIG_ATRAC1_DECODER) += atrac1.o atrac.o |
62 | 62 |
OBJS-$(CONFIG_ATRAC3_DECODER) += atrac3.o atrac.o |
63 | 63 |
OBJS-$(CONFIG_AURA_DECODER) += cyuv.o |
64 |
+OBJS-$(CONFIG_AURA2_DECODER) += aura.o |
|
64 | 65 |
OBJS-$(CONFIG_AVS_DECODER) += avs.o |
65 | 66 |
OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o |
66 | 67 |
OBJS-$(CONFIG_BFI_DECODER) += bfi.o |
... | ... |
@@ -66,6 +66,7 @@ void avcodec_register_all(void) |
66 | 66 |
REGISTER_ENCDEC (ASV1, asv1); |
67 | 67 |
REGISTER_ENCDEC (ASV2, asv2); |
68 | 68 |
REGISTER_DECODER (AURA, aura); |
69 |
+ REGISTER_DECODER (AURA2, aura2); |
|
69 | 70 |
REGISTER_DECODER (AVS, avs); |
70 | 71 |
REGISTER_DECODER (BETHSOFTVID, bethsoftvid); |
71 | 72 |
REGISTER_DECODER (BFI, bfi); |
72 | 73 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,138 @@ |
0 |
+/* |
|
1 |
+ * Aura 2 decoder |
|
2 |
+ * |
|
3 |
+ * This file is part of FFmpeg. |
|
4 |
+ * |
|
5 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * @file libavcodec/aura.c |
|
22 |
+ * Aura 2 decoder |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+#include "avcodec.h" |
|
26 |
+ |
|
27 |
+typedef struct AuraDecodeContext { |
|
28 |
+ AVCodecContext *avctx; |
|
29 |
+ AVFrame frame; |
|
30 |
+} AuraDecodeContext; |
|
31 |
+ |
|
32 |
+static av_cold int aura_decode_init(AVCodecContext *avctx) |
|
33 |
+{ |
|
34 |
+ AuraDecodeContext *s = avctx->priv_data; |
|
35 |
+ |
|
36 |
+ s->avctx = avctx; |
|
37 |
+ /* width needs to be divisible by 4 for this codec to work */ |
|
38 |
+ if (avctx->width & 0x3) |
|
39 |
+ return -1; |
|
40 |
+ avctx->pix_fmt = PIX_FMT_YUV422P; |
|
41 |
+ |
|
42 |
+ return 0; |
|
43 |
+} |
|
44 |
+ |
|
45 |
+static int aura_decode_frame(AVCodecContext *avctx, |
|
46 |
+ void *data, int *data_size, |
|
47 |
+ AVPacket *pkt) |
|
48 |
+{ |
|
49 |
+ AuraDecodeContext *s=avctx->priv_data; |
|
50 |
+ |
|
51 |
+ uint8_t *Y, *U, *V; |
|
52 |
+ uint8_t val; |
|
53 |
+ int x, y; |
|
54 |
+ const uint8_t *buf = pkt->data; |
|
55 |
+ |
|
56 |
+ /* prediction error tables (make it clear that they are signed values) */ |
|
57 |
+ const int8_t *delta_table = (const int8_t*)buf + 16; |
|
58 |
+ |
|
59 |
+ if (pkt->size != 48 + avctx->height * avctx->width) { |
|
60 |
+ av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n", |
|
61 |
+ pkt->size, 48 + avctx->height * avctx->width); |
|
62 |
+ return -1; |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ /* pixel data starts 48 bytes in, after 3x16-byte tables */ |
|
66 |
+ buf += 48; |
|
67 |
+ |
|
68 |
+ if(s->frame.data[0]) |
|
69 |
+ avctx->release_buffer(avctx, &s->frame); |
|
70 |
+ |
|
71 |
+ s->frame.buffer_hints = FF_BUFFER_HINTS_VALID; |
|
72 |
+ s->frame.reference = 0; |
|
73 |
+ if(avctx->get_buffer(avctx, &s->frame) < 0) { |
|
74 |
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
|
75 |
+ return -1; |
|
76 |
+ } |
|
77 |
+ |
|
78 |
+ Y = s->frame.data[0]; |
|
79 |
+ U = s->frame.data[1]; |
|
80 |
+ V = s->frame.data[2]; |
|
81 |
+ |
|
82 |
+ /* iterate through each line in the height */ |
|
83 |
+ for (y = 0; y < avctx->height; y++) { |
|
84 |
+ /* reset predictors */ |
|
85 |
+ val = *buf++; |
|
86 |
+ U[0] = val & 0xF0; |
|
87 |
+ Y[0] = val << 4; |
|
88 |
+ val = *buf++; |
|
89 |
+ V[0] = val & 0xF0; |
|
90 |
+ Y[1] = Y[0] + delta_table[val & 0xF]; |
|
91 |
+ Y += 2; U++; V++; |
|
92 |
+ |
|
93 |
+ /* iterate through the remaining pixel groups (4 pixels/group) */ |
|
94 |
+ for (x = 1; x < (avctx->width >> 1); x++) { |
|
95 |
+ val = *buf++; |
|
96 |
+ U[0] = U[-1] + delta_table[val >> 4]; |
|
97 |
+ Y[0] = Y[-1] + delta_table[val & 0xF]; |
|
98 |
+ val = *buf++; |
|
99 |
+ V[0] = V[-1] + delta_table[val >> 4]; |
|
100 |
+ Y[1] = Y[ 0] + delta_table[val & 0xF]; |
|
101 |
+ Y += 2; U++; V++; |
|
102 |
+ } |
|
103 |
+ Y += s->frame.linesize[0] - avctx->width; |
|
104 |
+ U += s->frame.linesize[1] - (avctx->width >> 1); |
|
105 |
+ V += s->frame.linesize[2] - (avctx->width >> 1); |
|
106 |
+ } |
|
107 |
+ |
|
108 |
+ *data_size=sizeof(AVFrame); |
|
109 |
+ *(AVFrame*)data= s->frame; |
|
110 |
+ |
|
111 |
+ return pkt->size; |
|
112 |
+} |
|
113 |
+ |
|
114 |
+static av_cold int aura_decode_end(AVCodecContext *avctx) |
|
115 |
+{ |
|
116 |
+ AuraDecodeContext *s = avctx->priv_data; |
|
117 |
+ |
|
118 |
+ if (s->frame.data[0]) |
|
119 |
+ avctx->release_buffer(avctx, &s->frame); |
|
120 |
+ |
|
121 |
+ return 0; |
|
122 |
+} |
|
123 |
+ |
|
124 |
+AVCodec aura2_decoder = { |
|
125 |
+ "aura2", |
|
126 |
+ CODEC_TYPE_VIDEO, |
|
127 |
+ CODEC_ID_AURA2, |
|
128 |
+ sizeof(AuraDecodeContext), |
|
129 |
+ aura_decode_init, |
|
130 |
+ NULL, |
|
131 |
+ aura_decode_end, |
|
132 |
+ aura_decode_frame, |
|
133 |
+ CODEC_CAP_DR1, |
|
134 |
+ NULL, |
|
135 |
+ .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"), |
|
136 |
+}; |
|
137 |
+ |
... | ... |
@@ -30,7 +30,7 @@ |
30 | 30 |
#include "libavutil/avutil.h" |
31 | 31 |
|
32 | 32 |
#define LIBAVCODEC_VERSION_MAJOR 52 |
33 |
-#define LIBAVCODEC_VERSION_MINOR 44 |
|
33 |
+#define LIBAVCODEC_VERSION_MINOR 45 |
|
34 | 34 |
#define LIBAVCODEC_VERSION_MICRO 0 |
35 | 35 |
|
36 | 36 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |