[FFmpeg-devel] [PATCH]Support QT b64a ARGB64 rawvideo
Carl Eugen Hoyos
cehoyos at ag.or.at
Mon Jul 4 00:08:15 EEST 2016
Hi!
Attached patches fix ticket #5657.
Please comment, Carl Eugen
-------------- next part --------------
From 1bba7103c093951cab1bb9aa7b5eaf07b44d2781 Mon Sep 17 00:00:00 2001
From: v0lt <v0lt at rambler.ru>
Date: Sun, 3 Jul 2016 23:04:08 +0200
Subject: [PATCH 1/2] lavc/rawdec: Support QuickTime b64a ARGB64 rawvideo.
Fixes ticket #5657.
---
libavcodec/raw.c | 1 +
libavcodec/rawdec.c | 9 +++++++++
libavcodec/version.h | 2 +-
libavformat/isom.c | 1 +
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index bfa2537..35dfbab 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -224,6 +224,7 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
{ AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
{ AV_PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') },
{ AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') },
+ { AV_PIX_FMT_RGBA64BE,MKTAG('b', '6', '4', 'a') },
/* vlc */
{ AV_PIX_FMT_YUV410P, MKTAG('I', '4', '1', '0') },
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 765e567..8085ffa 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -444,6 +444,15 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
}
}
+ if (avctx->codec_tag == MKTAG('b', '6', '4', 'a') &&
+ avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) {
+ uint64_t *pixel = frame->data[0];
+ int i, n = avctx->width * avctx->height;
+ for (i = 0; i < n; i++) {
+ *pixel++ = *pixel << 48 | *pixel >> 16;
+ }
+ }
+
if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced material flagged in container */
frame->interlaced_frame = 1;
if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4f6423b..5e04754 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 48
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index d412f06..cb457dd 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -86,6 +86,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
{ AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
{ AV_CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') },
{ AV_CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('b', '6', '4', 'a') },
{ AV_CODEC_ID_RAWVIDEO, MKTAG('b', 'x', 'b', 'g') }, /* BOXX */
{ AV_CODEC_ID_RAWVIDEO, MKTAG('b', 'x', 'r', 'g') },
{ AV_CODEC_ID_RAWVIDEO, MKTAG('b', 'x', 'y', 'v') },
--
1.7.10.4
-------------- next part --------------
From a39dab26a0ea6d89eef761492ea09b45346fd413 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Sun, 3 Jul 2016 23:05:44 +0200
Subject: [PATCH 2/2] lavc/rawenc: Support QuickTime b64a ARGB64 rawvideo.
---
libavcodec/rawenc.c | 8 ++++++++
libavcodec/version.h | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index d837056..f1c0c5a 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -69,6 +69,14 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
int x;
for(x = 1; x < frame->height*frame->width*2; x += 2)
pkt->data[x] ^= 0x80;
+ } else if (avctx->codec_tag == AV_RL32("b64a") && ret > 0 &&
+ frame->format == AV_PIX_FMT_RGBA64BE) {
+ uint64_t pixel;
+ int x;
+ for (x = 0; x < frame->height * frame->width; x++) {
+ pixel = AV_RN64(&pkt->data[8 * x]);
+ AV_WN64(&pkt->data[8 * x], pixel << 16 | pixel >> 48);
+ }
}
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e04754..310aa95 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 48
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
1.7.10.4
More information about the ffmpeg-devel
mailing list