[packages/ffmpeg] - adjusted utvideo patch for utvideo 15.4
qboosh
qboosh at pld-linux.org
Sun Jan 17 21:42:46 CET 2016
commit c0d43f3daaec8f26adb43c5373ef5a5119211594
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Jan 17 21:45:04 2016 +0100
- adjusted utvideo patch for utvideo 15.4
ffmpeg-utvideo.patch | 206 +++++++++++++++++++++++++++++++++++++++++++++++----
ffmpeg.spec | 6 +-
2 files changed, 196 insertions(+), 16 deletions(-)
---
diff --git a/ffmpeg.spec b/ffmpeg.spec
index bb6a4aa..8356131 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -162,7 +162,7 @@ BuildRequires: speex-devel >= 1:1.2-rc1
%{?with_doc:BuildRequires: texi2html}
%{?with_doc:BuildRequires: texinfo}
BuildRequires: twolame-devel
-%{?with_utvideo:BuildRequires: utvideo-devel >= 15.3}
+%{?with_utvideo:BuildRequires: utvideo-devel >= 15.4}
%{?with_vidstab:BuildRequires: vid.stab-devel >= 0.98}
BuildRequires: vo-aacenc-devel
BuildRequires: vo-amrwbenc-devel
@@ -181,7 +181,7 @@ BuildRequires: zlib-devel
# overflows maximum hash table size
BuildConflicts: pdksh < 5.2.14-57
Requires: %{name}-libs = %{version}-%{release}
-%{?with_utvideo:Requires: utvideo >= 15.3}
+%{?with_utvideo:Requires: utvideo >= 15.4}
%{?with_ilbc:Requires: webrtc-libilbc}
Requires: xvid >= 1:1.1.0
Obsoletes: libpostproc
@@ -294,7 +294,7 @@ Requires: schroedinger-devel
%{?with_soxr:Requires: soxr-devel}
Requires: speex-devel >= 1:1.2-rc1
Requires: twolame-devel
-%{?with_utvideo:Requires: utvideo-devel >= 15.3}
+%{?with_utvideo:Requires: utvideo-devel >= 15.4}
%{?with_vidstab:Requires: vid.stab-devel >= 0.98}
Requires: vo-aacenc-devel
Requires: vo-amrwbenc-devel
diff --git a/ffmpeg-utvideo.patch b/ffmpeg-utvideo.patch
index f835c84..947bca3 100644
--- a/ffmpeg-utvideo.patch
+++ b/ffmpeg-utvideo.patch
@@ -1,23 +1,203 @@
---- ffmpeg-2.8.3/libavcodec/libutvideodec.cpp.orig 2015-09-09 03:17:45.000000000 +0200
-+++ ffmpeg-2.8.3/libavcodec/libutvideodec.cpp 2015-11-29 21:45:43.984039667 +0100
-@@ -150,7 +150,7 @@
- pic->key_frame = 1;
-
- /* Decode the frame */
-- utv->codec->DecodeFrame(utv->buffer, avpkt->data, true);
-+ utv->codec->DecodeFrame(utv->buffer, avpkt->data);
+--- ffmpeg-2.8.5/libavcodec/libutvideoenc.cpp.orig 2016-01-17 15:47:01.790581181 +0100
++++ ffmpeg-2.8.5/libavcodec/libutvideoenc.cpp 2016-01-17 20:53:18.793143645 +0100
+@@ -38,12 +38,11 @@
+ {
+ UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
+ UtVideoExtra *info;
+- uint32_t flags, in_format;
++ uint32_t flags;
+ int ret;
- /* Set the output data depending on the colorspace */
switch (avctx->pix_fmt) {
---- ffmpeg-2.8.3/libavcodec/libutvideoenc.cpp.orig 2015-11-27 14:41:23.000000000 +0100
-+++ ffmpeg-2.8.3/libavcodec/libutvideoenc.cpp 2015-11-30 17:01:44.241128916 +0100
-@@ -122,8 +122,7 @@
+ case AV_PIX_FMT_YUV420P:
+- in_format = UTVF_YV12;
+ avctx->bits_per_coded_sample = 12;
+ if (avctx->colorspace == AVCOL_SPC_BT709)
+ avctx->codec_tag = MKTAG('U', 'L', 'H', '0');
+@@ -51,7 +50,6 @@
+ avctx->codec_tag = MKTAG('U', 'L', 'Y', '0');
+ break;
+ case AV_PIX_FMT_YUYV422:
+- in_format = UTVF_YUYV;
+ avctx->bits_per_coded_sample = 16;
+ if (avctx->colorspace == AVCOL_SPC_BT709)
+ avctx->codec_tag = MKTAG('U', 'L', 'H', '2');
+@@ -59,12 +57,10 @@
+ avctx->codec_tag = MKTAG('U', 'L', 'Y', '2');
+ break;
+ case AV_PIX_FMT_BGR24:
+- in_format = UTVF_NFCC_BGR_BU;
+ avctx->bits_per_coded_sample = 24;
+ avctx->codec_tag = MKTAG('U', 'L', 'R', 'G');
+ break;
+ case AV_PIX_FMT_RGB32:
+- in_format = UTVF_NFCC_BGRA_BU;
+ avctx->bits_per_coded_sample = 32;
+ avctx->codec_tag = MKTAG('U', 'L', 'R', 'A');
+ break;
+@@ -113,16 +109,14 @@
+ * Create a Ut Video instance. Since the function wants
+ * an "interface name" string, pass it the name of the lib.
+ */
+- utv->codec = CCodec::CreateInstance(UNFCC(avctx->codec_tag), "libavcodec");
++ utv->codec = CCodec::CreateInstance(htobe32(avctx->codec_tag), "libavcodec");
+
+ /* Initialize encoder */
+- utv->codec->EncodeBegin(in_format, avctx->width, avctx->height,
+- CBGROSSWIDTH_WINDOWS);
++ utv->codec->EncodeBegin(avctx->width, avctx->height);
+
/* Get extradata from encoder */
avctx->extradata_size = utv->codec->EncodeGetExtraDataSize();
- utv->codec->EncodeGetExtraData(info, avctx->extradata_size, in_format,
+- utv->codec->EncodeGetExtraData(info, avctx->extradata_size, in_format,
- avctx->width, avctx->height,
- CBGROSSWIDTH_WINDOWS);
++ utv->codec->EncodeGetExtraData(info, avctx->extradata_size,
+ avctx->width, avctx->height);
avctx->extradata = (uint8_t *)info;
+@@ -140,6 +135,7 @@
+ bool keyframe;
+ uint8_t *y, *u, *v;
+ uint8_t *dst;
++ uint32_t in_format;
+
+ /* Alloc buffer */
+ if ((ret = ff_alloc_packet2(avctx, pkt, utv->buf_size, 0)) < 0)
+@@ -150,6 +146,7 @@
+ /* Move input if needed data into Ut Video friendly buffer */
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_YUV420P:
++ in_format = UTVF_YV12;
+ y = utv->buffer;
+ u = y + w * h;
+ v = u + w * h / 4;
+@@ -165,12 +162,14 @@
+ }
+ break;
+ case AV_PIX_FMT_YUYV422:
++ in_format = UTVF_YUYV;
+ for (i = 0; i < h; i++)
+ memcpy(utv->buffer + i * (w << 1),
+ pic->data[0] + i * pic->linesize[0], w << 1);
+ break;
+ case AV_PIX_FMT_BGR24:
+ case AV_PIX_FMT_RGB32:
++ in_format = avctx->pix_fmt == AV_PIX_FMT_BGR24 ? UTVF_NFCC_BGR_BU : UTVF_NFCC_BGRA_BU;
+ /* Ut Video takes bottom-up BGR */
+ rgb_size = avctx->pix_fmt == AV_PIX_FMT_BGR24 ? 3 : 4;
+ for (i = 0; i < h; i++)
+@@ -183,7 +182,7 @@
+ }
+
+ /* Encode frame */
+- pkt->size = utv->codec->EncodeFrame(dst, &keyframe, utv->buffer);
++ pkt->size = utv->codec->EncodeFrame(dst, &keyframe, utv->buffer, in_format, CBGROSSWIDTH_WINDOWS);
+
+ if (!pkt->size) {
+ av_log(avctx, AV_LOG_ERROR, "EncodeFrame failed!\n");
+--- ffmpeg-2.8.5/libavcodec/libutvideodec.cpp.orig 2016-01-17 15:47:01.790581181 +0100
++++ ffmpeg-2.8.5/libavcodec/libutvideodec.cpp 2016-01-17 20:39:38.713177720 +0100
+@@ -36,7 +36,6 @@
+ {
+ UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
+ UtVideoExtra info;
+- int format;
+ int begin_ret;
+
+ if (avctx->extradata_size != 16 && avctx->extradata_size != 8 ) {
+@@ -56,34 +55,27 @@
+ case MKTAG('U', 'L', 'H', '0'):
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ avctx->colorspace = AVCOL_SPC_BT709;
+- format = UTVF_YV12;
+ break;
+ case MKTAG('U', 'L', 'H', '2'):
+ avctx->pix_fmt = AV_PIX_FMT_YUYV422;
+ avctx->colorspace = AVCOL_SPC_BT709;
+- format = UTVF_YUY2;
+ break;
+ #endif
+ case MKTAG('U', 'L', 'Y', '0'):
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+- format = UTVF_YV12;
+ break;
+ case MKTAG('U', 'L', 'Y', '2'):
+ avctx->pix_fmt = AV_PIX_FMT_YUYV422;
+- format = UTVF_YUY2;
+ break;
+ case MKTAG('U', 'L', 'R', 'G'):
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
+- format = UTVF_NFCC_BGR_BU;
+ break;
+ case MKTAG('U', 'L', 'R', 'A'):
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
+- format = UTVF_NFCC_BGRA_BU;
+ break;
+ #ifdef UTVF_UQY2
+ case MKTAG('U', 'Q', 'Y', '2'):
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+- format = UTVF_v210;
+ break;
+ #endif
+ default:
+@@ -95,7 +87,7 @@
+ /* Only allocate the buffer once */
+ utv->buf_size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+ #ifdef UTVF_UQY2
+- if (format == UTVF_v210)
++ if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
+ utv->buf_size += avctx->height * ((avctx->width + 47) / 48) * 128; // the linesize used by the decoder, this does not seem to be exported
+ #endif
+ utv->buffer = (uint8_t *)av_malloc(utv->buf_size * sizeof(uint8_t));
+@@ -121,11 +113,10 @@
+ * Create a Ut Video instance. Since the function wants
+ * an "interface name" string, pass it the name of the lib.
+ */
+- utv->codec = CCodec::CreateInstance(UNFCC(avctx->codec_tag), "libavcodec");
++ utv->codec = CCodec::CreateInstance(htobe32(avctx->codec_tag), "libavcodec");
+
+ /* Initialize Decoding */
+- begin_ret = utv->codec->DecodeBegin(format, avctx->width, avctx->height,
+- CBGROSSWIDTH_WINDOWS, &info, sizeof(UtVideoExtra));
++ begin_ret = utv->codec->DecodeBegin(avctx->width, avctx->height, &info, sizeof(UtVideoExtra));
+
+ /* Check to see if the decoder initlized properly */
+ if (begin_ret != 0) {
+@@ -143,14 +134,35 @@
+ UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
+ AVFrame *pic = avctx->coded_frame;
+ int w = avctx->width, h = avctx->height;
++ int format;
+
/* Set flags */
+ pic->reference = 0;
+ pic->pict_type = AV_PICTURE_TYPE_I;
+ pic->key_frame = 1;
+
++ switch (avctx->pix_fmt) {
++ case AV_PIX_FMT_YUV420P:
++ format = UTVF_YV12;
++ break;
++ case AV_PIX_FMT_YUYV422:
++ format = UTVF_YUY2;
++ break;
++ case AV_PIX_FMT_BGR24:
++ format = UTVF_NFCC_BGR_BU;
++ break;
++ case AV_PIX_FMT_RGB32:
++ format = UTVF_NFCC_BGRA_BU;
++ break;
++#ifdef UTVF_UQY2
++ case AV_PIX_FMT_YUV422P10:
++ format = UTVF_v210;
++ break;
++#endif
++ }
++
+ /* Decode the frame */
+- utv->codec->DecodeFrame(utv->buffer, avpkt->data, true);
++ utv->codec->DecodeFrame(utv->buffer, avpkt->data, format, CBGROSSWIDTH_WINDOWS);
+
+ /* Set the output data depending on the colorspace */
+ switch (avctx->pix_fmt) {
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/ffmpeg.git/commitdiff/c0d43f3daaec8f26adb43c5373ef5a5119211594
More information about the pld-cvs-commit
mailing list