From patchwork Mon Aug 8 22:57:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 124 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp364581vsd; Mon, 8 Aug 2016 15:57:40 -0700 (PDT) X-Received: by 10.194.123.228 with SMTP id md4mr81646707wjb.91.1470697060896; Mon, 08 Aug 2016 15:57:40 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fa4si6870912wjd.246.2016.08.08.15.57.40; Mon, 08 Aug 2016 15:57:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7C0BF68A223; Tue, 9 Aug 2016 01:57:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-1.mx.upcmail.net (vie01a-dmta-pe04-1.mx.upcmail.net [62.179.121.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 563E668A14D for ; Tue, 9 Aug 2016 01:57:15 +0300 (EEST) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1bWtU2-0007sS-9B for ffmpeg-devel@ffmpeg.org; Tue, 09 Aug 2016 00:57:22 +0200 Received: from [192.168.1.3] ([80.110.106.244]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id UmxM1t0025GQKw001mxNgC; Tue, 09 Aug 2016 00:57:22 +0200 X-SourceIP: 80.110.106.244 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Tue, 9 Aug 2016 00:57:20 +0200 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201608090057.21011.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH v2]Support QT b64a ARGB64 rawvideo X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi! New patch attached that fixes ticket #5657. Please comment, Carl Eugen From ed664a5b16d0200675d64c564a9f776bdece569a Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 9 Aug 2016 00:55:27 +0200 Subject: [PATCH] lavc/raw: Support QT b64a ARGB64 rawvideo. Decoder based on a patch by v0lt, v0lt rambler ru Fixes ticket #5657. --- libavcodec/raw.c | 1 + libavcodec/rawdec.c | 11 +++++++++++ libavcodec/rawenc.c | 8 ++++++++ libavcodec/version.h | 2 +- libavformat/isom.c | 1 + libavformat/version.h | 2 +- 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libavcodec/raw.c b/libavcodec/raw.c index d36b68b..d6aaf76 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c @@ -225,6 +225,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..87c7259 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -444,6 +444,17 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, } } + if (avctx->codec_tag == AV_RL32("b64a") && + avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) { + uint8_t *dst = frame->data[0]; + uint64_t v; + int x; + for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) { + v = AV_RB64(&dst[x]); + AV_WB64(&dst[x], v << 16 | v >> 48); + } + } + 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/rawenc.c b/libavcodec/rawenc.c index d837056..a2d5ccc 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 v; + int x; + for (x = 0; x < frame->height * frame->width; x++) { + v = AV_RB64(&pkt->data[8 * x]); + AV_WB64(&pkt->data[8 * x], v << 48 | v >> 16); + } } pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; diff --git a/libavcodec/version.h b/libavcodec/version.h index 4ded1ee..306c280 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MINOR 51 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #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') }, diff --git a/libavformat/version.h b/libavformat/version.h index 07df407..590902d 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -33,7 +33,7 @@ // Also please add any ticket numbers that you belive might be affected here #define LIBAVFORMAT_VERSION_MAJOR 57 #define LIBAVFORMAT_VERSION_MINOR 46 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 102 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \