... | ... |
@@ -28,7 +28,7 @@ version next: |
28 | 28 |
- super2xsai filter ported from libmpcodecs |
29 | 29 |
- add libavresample audio conversion library for compatibility |
30 | 30 |
- MicroDVD decoder |
31 |
-- Avid Meridien (AVUI) decoder |
|
31 |
+- Avid Meridien (AVUI) encoder and decoder |
|
32 | 32 |
- accept + prefix to -pix_fmt option to disable automatic conversions. |
33 | 33 |
- audio filters support in libavfilter and avconv |
34 | 34 |
- add fps filter |
... | ... |
@@ -105,6 +105,7 @@ OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o |
105 | 105 |
OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o |
106 | 106 |
OBJS-$(CONFIG_AVS_DECODER) += avs.o |
107 | 107 |
OBJS-$(CONFIG_AVUI_DECODER) += avuidec.o |
108 |
+OBJS-$(CONFIG_AVUI_ENCODER) += avuienc.o |
|
108 | 109 |
OBJS-$(CONFIG_AYUV_DECODER) += v408dec.o |
109 | 110 |
OBJS-$(CONFIG_AYUV_ENCODER) += v408enc.o |
110 | 111 |
OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o |
... | ... |
@@ -81,7 +81,7 @@ void avcodec_register_all(void) |
81 | 81 |
REGISTER_DECODER (AURA2, aura2); |
82 | 82 |
REGISTER_ENCDEC (AVRP, avrp); |
83 | 83 |
REGISTER_DECODER (AVS, avs); |
84 |
- REGISTER_DECODER (AVUI, avui); |
|
84 |
+ REGISTER_ENCDEC (AVUI, avui); |
|
85 | 85 |
REGISTER_ENCDEC (AYUV, ayuv); |
86 | 86 |
REGISTER_DECODER (BETHSOFTVID, bethsoftvid); |
87 | 87 |
REGISTER_DECODER (BFI, bfi); |
88 | 88 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,107 @@ |
0 |
+/* |
|
1 |
+ * AVID Meridien encoder |
|
2 |
+ * |
|
3 |
+ * Copyright (c) 2012 Carl Eugen Hoyos |
|
4 |
+ * |
|
5 |
+ * This file is part of FFmpeg. |
|
6 |
+ * |
|
7 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
8 |
+ * modify it under the terms of the GNU Lesser General Public |
|
9 |
+ * License as published by the Free Software Foundation; either |
|
10 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
11 |
+ * |
|
12 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
13 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
+ * Lesser General Public License for more details. |
|
16 |
+ * |
|
17 |
+ * You should have received a copy of the GNU Lesser General Public |
|
18 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
19 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+#include "avcodec.h" |
|
23 |
+#include "internal.h" |
|
24 |
+ |
|
25 |
+static av_cold int avui_encode_init(AVCodecContext *avctx) |
|
26 |
+{ |
|
27 |
+ avctx->coded_frame = avcodec_alloc_frame(); |
|
28 |
+ |
|
29 |
+ if (avctx->width != 720 || avctx->height != 486 && avctx->height != 576) { |
|
30 |
+ av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n"); |
|
31 |
+ return AVERROR(EINVAL); |
|
32 |
+ } |
|
33 |
+ if (!avctx->coded_frame) { |
|
34 |
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
|
35 |
+ return AVERROR(ENOMEM); |
|
36 |
+ } |
|
37 |
+ |
|
38 |
+ return 0; |
|
39 |
+} |
|
40 |
+ |
|
41 |
+static int avui_encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
|
42 |
+ const AVFrame *pic, int *got_packet) |
|
43 |
+{ |
|
44 |
+ uint8_t *dst, *src = pic->data[0]; |
|
45 |
+ int i, j, skip, ret, size, interlaced = pic->interlaced_frame; |
|
46 |
+ |
|
47 |
+ if (avctx->height == 486) { |
|
48 |
+ skip = 10; |
|
49 |
+ } else { |
|
50 |
+ skip = 16; |
|
51 |
+ } |
|
52 |
+ size = 2 * avctx->width * (avctx->height + skip) + 8 * interlaced; |
|
53 |
+ if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) |
|
54 |
+ return ret; |
|
55 |
+ dst = pkt->data; |
|
56 |
+ if (!(avctx->extradata = av_mallocz(24 + FF_INPUT_BUFFER_PADDING_SIZE))) |
|
57 |
+ return AVERROR(ENOMEM); |
|
58 |
+ avctx->extradata_size = 24; |
|
59 |
+ memcpy(avctx->extradata, "\0\0\0\x18""APRGAPRG0001", 16); |
|
60 |
+ if (interlaced) { |
|
61 |
+ avctx->extradata[19] = 2; |
|
62 |
+ } else { |
|
63 |
+ avctx->extradata[19] = 1; |
|
64 |
+ dst += avctx->width * skip; |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ avctx->coded_frame->reference = 0; |
|
68 |
+ avctx->coded_frame->key_frame = 1; |
|
69 |
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; |
|
70 |
+ |
|
71 |
+ for (i = 0; i <= interlaced; i++) { |
|
72 |
+ if (interlaced && avctx->height == 486) { |
|
73 |
+ src = pic->data[0] + (1 - i) * pic->linesize[0]; |
|
74 |
+ } else { |
|
75 |
+ src = pic->data[0] + i * pic->linesize[0]; |
|
76 |
+ } |
|
77 |
+ dst += avctx->width * skip + 4 * i; |
|
78 |
+ for (j = 0; j < avctx->height; j += interlaced + 1) { |
|
79 |
+ memcpy(dst, src, avctx->width * 2); |
|
80 |
+ src += (interlaced + 1) * pic->linesize[0]; |
|
81 |
+ dst += avctx->width * 2; |
|
82 |
+ } |
|
83 |
+ } |
|
84 |
+ |
|
85 |
+ pkt->flags |= AV_PKT_FLAG_KEY; |
|
86 |
+ *got_packet = 1; |
|
87 |
+ return 0; |
|
88 |
+} |
|
89 |
+ |
|
90 |
+static av_cold int avui_encode_close(AVCodecContext *avctx) |
|
91 |
+{ |
|
92 |
+ av_freep(&avctx->coded_frame); |
|
93 |
+ |
|
94 |
+ return 0; |
|
95 |
+} |
|
96 |
+ |
|
97 |
+AVCodec ff_avui_encoder = { |
|
98 |
+ .name = "avui", |
|
99 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
100 |
+ .id = CODEC_ID_AVUI, |
|
101 |
+ .init = avui_encode_init, |
|
102 |
+ .encode2 = avui_encode_frame, |
|
103 |
+ .close = avui_encode_close, |
|
104 |
+ .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_UYVY422, PIX_FMT_NONE }, |
|
105 |
+ .long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"), |
|
106 |
+}; |
... | ... |
@@ -350,6 +350,11 @@ do_video_encoding v408.avi "-an -c:v v408 -sws_flags neighbor+bitexact" |
350 | 350 |
do_video_decoding "" "-sws_flags neighbor+bitexact -pix_fmt yuv420p" |
351 | 351 |
fi |
352 | 352 |
|
353 |
+if [ -n "$do_avui" ] ; then |
|
354 |
+do_video_encoding avui.mov "-s pal -an -c:v avui -sws_flags neighbor+bitexact" |
|
355 |
+do_video_decoding "" "-s cif -sws_flags neighbor+bitexact -pix_fmt yuv420p" |
|
356 |
+fi |
|
357 |
+ |
|
353 | 358 |
if [ -n "$do_yuv" ] ; then |
354 | 359 |
do_video_encoding yuv.avi "-an -vcodec rawvideo -pix_fmt yuv420p" |
355 | 360 |
do_video_decoding "" "-pix_fmt yuv420p" |