Fixes last part of ticket #470.
Reviewed-by: Paul B Mahol
| ... | ... |
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, |
| 2 | 2 |
releases are sorted from youngest to oldest. |
| 3 | 3 |
|
| 4 | 4 |
version next: |
| 5 |
+- v408 Quicktime amd Microsoft AYUV Uncompressed 4:4:4:4 encoder and decoder |
|
| 5 | 6 |
|
| 6 | 7 |
version 0.10: |
| 7 | 8 |
- Fixes: CVE-2011-3929, CVE-2011-3934, CVE-2011-3935, CVE-2011-3936, |
| ... | ... |
@@ -444,6 +444,8 @@ following image formats are supported: |
| 444 | 444 |
@tab fourcc: AVrp |
| 445 | 445 |
@item AVS (Audio Video Standard) video @tab @tab X |
| 446 | 446 |
@tab Video encoding used by the Creature Shock game. |
| 447 |
+@item AYUV @tab X @tab X |
|
| 448 |
+ @tab Microsoft uncompressed packed 4:4:4:4 |
|
| 447 | 449 |
@item Beam Software VB @tab @tab X |
| 448 | 450 |
@item Bethesda VID video @tab @tab X |
| 449 | 451 |
@tab Used in some games from Bethesda Softworks. |
| ... | ... |
@@ -613,6 +615,7 @@ following image formats are supported: |
| 613 | 613 |
@item Ut Video @tab @tab X |
| 614 | 614 |
@item v210 QuickTime uncompressed 4:2:2 10-bit @tab X @tab X |
| 615 | 615 |
@item v308 QuickTime uncompressed 4:4:4 @tab X @tab X |
| 616 |
+@item v408 QuickTime uncompressed 4:4:4:4 @tab X @tab X |
|
| 616 | 617 |
@item v410 QuickTime uncompressed 4:4:4 10-bit @tab X @tab X |
| 617 | 618 |
@item VBLE Lossless Codec @tab @tab X |
| 618 | 619 |
@item VMware Screen Codec / VMware Video @tab @tab X |
| ... | ... |
@@ -95,6 +95,8 @@ OBJS-$(CONFIG_AURA2_DECODER) += aura.o |
| 95 | 95 |
OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o |
| 96 | 96 |
OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o |
| 97 | 97 |
OBJS-$(CONFIG_AVS_DECODER) += avs.o |
| 98 |
+OBJS-$(CONFIG_AYUV_DECODER) += v408dec.o |
|
| 99 |
+OBJS-$(CONFIG_AYUV_ENCODER) += v408enc.o |
|
| 98 | 100 |
OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o |
| 99 | 101 |
OBJS-$(CONFIG_BFI_DECODER) += bfi.o |
| 100 | 102 |
OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o |
| ... | ... |
@@ -422,6 +424,8 @@ OBJS-$(CONFIG_V210_DECODER) += v210dec.o |
| 422 | 422 |
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o |
| 423 | 423 |
OBJS-$(CONFIG_V308_DECODER) += v308dec.o |
| 424 | 424 |
OBJS-$(CONFIG_V308_ENCODER) += v308enc.o |
| 425 |
+OBJS-$(CONFIG_V408_DECODER) += v408dec.o |
|
| 426 |
+OBJS-$(CONFIG_V408_ENCODER) += v408enc.o |
|
| 425 | 427 |
OBJS-$(CONFIG_V410_DECODER) += v410dec.o |
| 426 | 428 |
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o |
| 427 | 429 |
OBJS-$(CONFIG_V210X_DECODER) += v210x.o |
| ... | ... |
@@ -81,6 +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_ENCDEC (AYUV, ayuv); |
|
| 84 | 85 |
REGISTER_DECODER (BETHSOFTVID, bethsoftvid); |
| 85 | 86 |
REGISTER_DECODER (BFI, bfi); |
| 86 | 87 |
REGISTER_DECODER (BINK, bink); |
| ... | ... |
@@ -218,6 +219,7 @@ void avcodec_register_all(void) |
| 218 | 218 |
REGISTER_ENCDEC (V210, v210); |
| 219 | 219 |
REGISTER_DECODER (V210X, v210x); |
| 220 | 220 |
REGISTER_ENCDEC (V308, v308); |
| 221 |
+ REGISTER_ENCDEC (V408, v408); |
|
| 221 | 222 |
REGISTER_ENCDEC (V410, v410); |
| 222 | 223 |
REGISTER_DECODER (VB, vb); |
| 223 | 224 |
REGISTER_DECODER (VBLE, vble); |
| ... | ... |
@@ -251,7 +251,9 @@ enum CodecID {
|
| 251 | 251 |
CODEC_ID_AVRP = MKBETAG('A','V','R','P'),
|
| 252 | 252 |
|
| 253 | 253 |
CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), |
| 254 |
+ CODEC_ID_AYUV = MKBETAG('A','Y','U','V'),
|
|
| 254 | 255 |
CODEC_ID_V308 = MKBETAG('V','3','0','8'),
|
| 256 |
+ CODEC_ID_V408 = MKBETAG('V','4','0','8'),
|
|
| 255 | 257 |
CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'),
|
| 256 | 258 |
|
| 257 | 259 |
/* various PCM "codecs" */ |
| 258 | 260 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,127 @@ |
| 0 |
+/* |
|
| 1 |
+ * v408 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 v408_decode_init(AVCodecContext *avctx) |
|
| 24 |
+{
|
|
| 25 |
+ avctx->pix_fmt = PIX_FMT_YUVA444P; |
|
| 26 |
+ |
|
| 27 |
+ avctx->coded_frame = avcodec_alloc_frame(); |
|
| 28 |
+ |
|
| 29 |
+ if (!avctx->coded_frame) {
|
|
| 30 |
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
|
| 31 |
+ return AVERROR(ENOMEM); |
|
| 32 |
+ } |
|
| 33 |
+ |
|
| 34 |
+ return 0; |
|
| 35 |
+} |
|
| 36 |
+ |
|
| 37 |
+static int v408_decode_frame(AVCodecContext *avctx, void *data, |
|
| 38 |
+ int *data_size, AVPacket *avpkt) |
|
| 39 |
+{
|
|
| 40 |
+ AVFrame *pic = avctx->coded_frame; |
|
| 41 |
+ const uint8_t *src = avpkt->data; |
|
| 42 |
+ uint8_t *y, *u, *v, *a; |
|
| 43 |
+ int i, j; |
|
| 44 |
+ |
|
| 45 |
+ if (pic->data[0]) |
|
| 46 |
+ avctx->release_buffer(avctx, pic); |
|
| 47 |
+ |
|
| 48 |
+ if (avpkt->size < 4 * avctx->height * avctx->width) {
|
|
| 49 |
+ av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); |
|
| 50 |
+ return AVERROR(EINVAL); |
|
| 51 |
+ } |
|
| 52 |
+ |
|
| 53 |
+ pic->reference = 0; |
|
| 54 |
+ |
|
| 55 |
+ if (avctx->get_buffer(avctx, pic) < 0) {
|
|
| 56 |
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); |
|
| 57 |
+ return AVERROR(ENOMEM); |
|
| 58 |
+ } |
|
| 59 |
+ |
|
| 60 |
+ pic->key_frame = 1; |
|
| 61 |
+ pic->pict_type = AV_PICTURE_TYPE_I; |
|
| 62 |
+ |
|
| 63 |
+ y = pic->data[0]; |
|
| 64 |
+ u = pic->data[1]; |
|
| 65 |
+ v = pic->data[2]; |
|
| 66 |
+ a = pic->data[3]; |
|
| 67 |
+ |
|
| 68 |
+ for (i = 0; i < avctx->height; i++) {
|
|
| 69 |
+ for (j = 0; j < avctx->width; j++) {
|
|
| 70 |
+ if (avctx->codec_id==CODEC_ID_AYUV) {
|
|
| 71 |
+ v[j] = *src++; |
|
| 72 |
+ u[j] = *src++; |
|
| 73 |
+ y[j] = *src++; |
|
| 74 |
+ a[j] = *src++; |
|
| 75 |
+ } else {
|
|
| 76 |
+ u[j] = *src++; |
|
| 77 |
+ y[j] = *src++; |
|
| 78 |
+ v[j] = *src++; |
|
| 79 |
+ a[j] = *src++; |
|
| 80 |
+ } |
|
| 81 |
+ } |
|
| 82 |
+ |
|
| 83 |
+ y += pic->linesize[0]; |
|
| 84 |
+ u += pic->linesize[1]; |
|
| 85 |
+ v += pic->linesize[2]; |
|
| 86 |
+ a += pic->linesize[3]; |
|
| 87 |
+ } |
|
| 88 |
+ |
|
| 89 |
+ *data_size = sizeof(AVFrame); |
|
| 90 |
+ *(AVFrame *)data = *pic; |
|
| 91 |
+ |
|
| 92 |
+ return avpkt->size; |
|
| 93 |
+} |
|
| 94 |
+ |
|
| 95 |
+static av_cold int v408_decode_close(AVCodecContext *avctx) |
|
| 96 |
+{
|
|
| 97 |
+ if (avctx->coded_frame->data[0]) |
|
| 98 |
+ avctx->release_buffer(avctx, avctx->coded_frame); |
|
| 99 |
+ |
|
| 100 |
+ av_freep(&avctx->coded_frame); |
|
| 101 |
+ |
|
| 102 |
+ return 0; |
|
| 103 |
+} |
|
| 104 |
+ |
|
| 105 |
+AVCodec ff_ayuv_decoder = {
|
|
| 106 |
+ .name = "ayuv", |
|
| 107 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
| 108 |
+ .id = CODEC_ID_AYUV, |
|
| 109 |
+ .init = v408_decode_init, |
|
| 110 |
+ .decode = v408_decode_frame, |
|
| 111 |
+ .close = v408_decode_close, |
|
| 112 |
+ .capabilities = CODEC_CAP_DR1, |
|
| 113 |
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"),
|
|
| 114 |
+}; |
|
| 115 |
+ |
|
| 116 |
+AVCodec ff_v408_decoder = {
|
|
| 117 |
+ .name = "v408", |
|
| 118 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
| 119 |
+ .id = CODEC_ID_V408, |
|
| 120 |
+ .init = v408_decode_init, |
|
| 121 |
+ .decode = v408_decode_frame, |
|
| 122 |
+ .close = v408_decode_close, |
|
| 123 |
+ .capabilities = CODEC_CAP_DR1, |
|
| 124 |
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"),
|
|
| 125 |
+}; |
|
| 126 |
+ |
| 0 | 127 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,112 @@ |
| 0 |
+/* |
|
| 1 |
+ * v408 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 "libavutil/intreadwrite.h" |
|
| 23 |
+#include "avcodec.h" |
|
| 24 |
+ |
|
| 25 |
+static av_cold int v408_encode_init(AVCodecContext *avctx) |
|
| 26 |
+{
|
|
| 27 |
+ avctx->coded_frame = avcodec_alloc_frame(); |
|
| 28 |
+ |
|
| 29 |
+ if (!avctx->coded_frame) {
|
|
| 30 |
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); |
|
| 31 |
+ return AVERROR(ENOMEM); |
|
| 32 |
+ } |
|
| 33 |
+ |
|
| 34 |
+ return 0; |
|
| 35 |
+} |
|
| 36 |
+ |
|
| 37 |
+static int v408_encode_frame(AVCodecContext *avctx, uint8_t *buf, |
|
| 38 |
+ int buf_size, void *data) |
|
| 39 |
+{
|
|
| 40 |
+ AVFrame *pic = data; |
|
| 41 |
+ uint8_t *dst = buf; |
|
| 42 |
+ uint8_t *y, *u, *v, *a; |
|
| 43 |
+ int i, j; |
|
| 44 |
+ int output_size = 0; |
|
| 45 |
+ |
|
| 46 |
+ if (buf_size < avctx->width * avctx->height * 4) {
|
|
| 47 |
+ av_log(avctx, AV_LOG_ERROR, "Out buffer is too small.\n"); |
|
| 48 |
+ return AVERROR(ENOMEM); |
|
| 49 |
+ } |
|
| 50 |
+ |
|
| 51 |
+ avctx->coded_frame->reference = 0; |
|
| 52 |
+ avctx->coded_frame->key_frame = 1; |
|
| 53 |
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; |
|
| 54 |
+ |
|
| 55 |
+ y = pic->data[0]; |
|
| 56 |
+ u = pic->data[1]; |
|
| 57 |
+ v = pic->data[2]; |
|
| 58 |
+ a = pic->data[3]; |
|
| 59 |
+ |
|
| 60 |
+ for (i = 0; i < avctx->height; i++) {
|
|
| 61 |
+ for (j = 0; j < avctx->width; j++) {
|
|
| 62 |
+ if (avctx->codec_id==CODEC_ID_AYUV) {
|
|
| 63 |
+ *dst++ = v[j]; |
|
| 64 |
+ *dst++ = u[j]; |
|
| 65 |
+ *dst++ = y[j]; |
|
| 66 |
+ *dst++ = a[j]; |
|
| 67 |
+ } else {
|
|
| 68 |
+ *dst++ = u[j]; |
|
| 69 |
+ *dst++ = y[j]; |
|
| 70 |
+ *dst++ = v[j]; |
|
| 71 |
+ *dst++ = a[j]; |
|
| 72 |
+ } |
|
| 73 |
+ output_size += 4; |
|
| 74 |
+ } |
|
| 75 |
+ y += pic->linesize[0]; |
|
| 76 |
+ u += pic->linesize[1]; |
|
| 77 |
+ v += pic->linesize[2]; |
|
| 78 |
+ a += pic->linesize[3]; |
|
| 79 |
+ } |
|
| 80 |
+ |
|
| 81 |
+ return output_size; |
|
| 82 |
+} |
|
| 83 |
+ |
|
| 84 |
+static av_cold int v408_encode_close(AVCodecContext *avctx) |
|
| 85 |
+{
|
|
| 86 |
+ av_freep(&avctx->coded_frame); |
|
| 87 |
+ |
|
| 88 |
+ return 0; |
|
| 89 |
+} |
|
| 90 |
+ |
|
| 91 |
+AVCodec ff_ayuv_encoder = {
|
|
| 92 |
+ .name = "ayuv", |
|
| 93 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
| 94 |
+ .id = CODEC_ID_AYUV, |
|
| 95 |
+ .init = v408_encode_init, |
|
| 96 |
+ .encode = v408_encode_frame, |
|
| 97 |
+ .close = v408_encode_close, |
|
| 98 |
+ .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUVA444P, PIX_FMT_NONE },
|
|
| 99 |
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"),
|
|
| 100 |
+}; |
|
| 101 |
+ |
|
| 102 |
+AVCodec ff_v408_encoder = {
|
|
| 103 |
+ .name = "v408", |
|
| 104 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
| 105 |
+ .id = CODEC_ID_V408, |
|
| 106 |
+ .init = v408_encode_init, |
|
| 107 |
+ .encode = v408_encode_frame, |
|
| 108 |
+ .close = v408_encode_close, |
|
| 109 |
+ .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUVA444P, PIX_FMT_NONE },
|
|
| 110 |
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"),
|
|
| 111 |
+}; |
| ... | ... |
@@ -21,8 +21,8 @@ |
| 21 | 21 |
#define AVCODEC_VERSION_H |
| 22 | 22 |
|
| 23 | 23 |
#define LIBAVCODEC_VERSION_MAJOR 54 |
| 24 |
-#define LIBAVCODEC_VERSION_MINOR 0 |
|
| 25 |
-#define LIBAVCODEC_VERSION_MICRO 102 |
|
| 24 |
+#define LIBAVCODEC_VERSION_MINOR 1 |
|
| 25 |
+#define LIBAVCODEC_VERSION_MICRO 100 |
|
| 26 | 26 |
|
| 27 | 27 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 28 | 28 |
LIBAVCODEC_VERSION_MINOR, \ |
| ... | ... |
@@ -93,6 +93,7 @@ const AVCodecTag codec_movvideo_tags[] = {
|
| 93 | 93 |
{ CODEC_ID_AVRP, MKTAG('S', 'U', 'D', 'S') }, /* Avid DS Uncompressed */
|
| 94 | 94 |
{ CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
|
| 95 | 95 |
{ CODEC_ID_V308, MKTAG('v', '3', '0', '8') }, /* UNCOMPRESSED 8BIT 4:4:4 */
|
| 96 |
+ { CODEC_ID_V408, MKTAG('v', '4', '0', '8') }, /* UNCOMPRESSED 8BIT 4:4:4:4 */
|
|
| 96 | 97 |
{ CODEC_ID_V410, MKTAG('v', '4', '1', '0') }, /* UNCOMPRESSED 10BIT 4:4:4 */
|
| 97 | 98 |
{ CODEC_ID_Y41P, MKTAG('Y', '4', '1', 'P') }, /* UNCOMPRESSED 12BIT 4:1:1 */
|
| 98 | 99 |
{ CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') }, /* libquicktime packed yuv420p */
|
| ... | ... |
@@ -202,6 +202,8 @@ const AVCodecTag ff_codec_bmp_tags[] = {
|
| 202 | 202 |
{ CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
|
| 203 | 203 |
{ CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
|
| 204 | 204 |
{ CODEC_ID_V308, MKTAG('v', '3', '0', '8') },
|
| 205 |
+ { CODEC_ID_V408, MKTAG('v', '4', '0', '8') },
|
|
| 206 |
+ { CODEC_ID_AYUV, MKTAG('A', 'Y', 'U', 'V') },
|
|
| 205 | 207 |
{ CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
|
| 206 | 208 |
{ CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') },
|
| 207 | 209 |
{ CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
|