Re: [FFmpeg-devel] [PATCH v4 2/2] libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

2018-09-08 Thread Paul B Mahol
On 9/8/18, Jason Stevens  wrote:
> Add missing dnxhr mxf container essence ULs to the mxf encoder.
> set proper mxf frame size for dnxhr using libavformat/dnxhd's get dnxhr size
> function.
>
> This fixes dnxhr mxf files being quarantined by Avid Media Composer.
>
> Signed-off-by: Jason Stevens 
> ---
>  libavformat/mxfenc.c | 53 +++-
>  1 file changed, 52 insertions(+), 1 deletion(-)
>
> +case 1272:
> +sc->index = INDEX_DNXHR_HQ;
> +break;
> +case 1271:
> +sc->index = INDEX_DNXHR_HQX;
> +sc->component_depth = 10;
> +break;
> +case 1270:
> +sc->index = INDEX_DNXHR_444;
> +sc->component_depth = 10;
> +break;

DNxHR HQX/444 can be 12bit.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: add RemotelyAnywhere Screen Capture decoder

2018-09-08 Thread Paul B Mahol
On 9/7/18, Michael Niedermayer  wrote:
> On Thu, Sep 06, 2018 at 10:05:50PM +0200, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  configure   |   1 +
>>  libavcodec/Makefile |   1 +
>>  libavcodec/allcodecs.c  |   1 +
>>  libavcodec/avcodec.h|   1 +
>>  libavcodec/codec_desc.c |   7 +
>>  libavcodec/rasc.c   | 789 
>>  libavformat/riff.c  |   1 +
>>  7 files changed, 801 insertions(+)
>>  create mode 100644 libavcodec/rasc.c
> [...]
>> +static int decode_dlta(AVCodecContext *avctx,
>> +   AVPacket *avpkt, unsigned size)
>> +{
>> +RASCContext *s = avctx->priv_data;
>> +GetByteContext *gb = &s->gb;
>> +GetByteContext dc;
>> +unsigned uncompressed_size, pos;
>> +unsigned x, y, w, h;
>> +int ret, cx, cy, compression;
>> +uint8_t *b1, *b2;
>> +
>> +pos = bytestream2_tell(gb);
>> +bytestream2_skip(gb, 12);
>> +uncompressed_size = bytestream2_get_le32(gb);
>> +x = bytestream2_get_le32(gb);
>> +y = bytestream2_get_le32(gb);
>> +w = bytestream2_get_le32(gb);
>> +h = bytestream2_get_le32(gb);
>> +
>> +if (x >= avctx->width || y >= avctx->height ||
>> +w > avctx->width || h > avctx->height)
>> +return AVERROR_INVALIDDATA;
>> +
>> +if (x + w > avctx->width || y + h > avctx->height)
>> +return AVERROR_INVALIDDATA;
>> +
>> +bytestream2_skip(gb, 4);
>> +compression = bytestream2_get_le32(gb);
>> +
>> +if (compression == 1) {
>> +ret = decode_zlib(avctx, avpkt, size, uncompressed_size);
>> +if (ret < 0)
>> +return ret;
>> +bytestream2_init(&dc, s->delta, uncompressed_size);
>> +} else if (compression == 0) {
>> +if (bytestream2_get_bytes_left(gb) < uncompressed_size)
>> +return AVERROR_INVALIDDATA;
>> +bytestream2_init(&dc, avpkt->data + bytestream2_tell(gb),
>> + uncompressed_size);
>> +} else if (compression == 2) {
>> +avpriv_request_sample(avctx, "compression %d", compression);
>> +return AVERROR_PATCHWELCOME;
>> +} else {
>> +return AVERROR_INVALIDDATA;
>> +}
>> +
>> +if (!s->frame2->data[0] || !s->frame1->data[0])
>> +return AVERROR_INVALIDDATA;
>> +
>> +b1  = s->frame1->data[0] + s->frame1->linesize[0] * (y + h - 1) + x *
>> s->bpp;
>> +b2  = s->frame2->data[0] + s->frame2->linesize[0] * (y + h - 1) + x *
>> s->bpp;
>> +cx = 0, cy = h;
>> +while (bytestream2_get_bytes_left(&dc) > 0) {
>> +int type = bytestream2_get_byte(&dc);
>> +int len = bytestream2_get_byte(&dc);
>> +unsigned fill;
>> +
>> +switch (type) {
>> +case 1:
>> +while (len > 0 && cy > 0) {
>> +cx++;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 2:
>> +while (len > 0 && cy > 0) {
>> +int v0 = b1[cx];
>> +int v1 = b2[cx];
>> +
>> +b2[cx] = v0;
>> +b1[cx] = v1;
>> +cx++;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 3:
>> +while (len > 0 && cy > 0) {
>> +fill = bytestream2_get_byte(&dc);
>> +b1[cx] = b2[cx];
>> +b2[cx] = fill;
>> +cx++;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 4:
>> +fill = bytestream2_get_byte(&dc);
>> +while (len > 0 && cy > 0) {
>> +AV_WL32(b1 + cx, AV_RL32(b2 + cx));
>> +AV_WL32(b2 + cx, fill);
>> +cx++;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 7:
>> +fill = bytestream2_get_le32(&dc);
>> +while (len > 0 && cy > 0) {
>> +AV_WL32(b1 + cx, AV_RL32(b2 + cx));
>> +AV_WL32(b2 + cx, fill);
>> +cx += 4;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 10:
>> +while (len > 0 && cy > 0) {
>> +cx += 4;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 12:
>> +while (len > 0 && cy > 0) {
>> +unsigned v0, v1;
>> +
>> +v0 = AV_RL32(b2 + cx);
>> +v1 = AV_RL32(b1 + cx);
>> +AV_WL32(b2 + cx, v1);
>> +AV_WL32(b1 + cx, v0);
>> +cx += 4;
>> +NEXT_LINE
>> +}
>> +break;
>> +case 13:
>> +while (len > 0 && cy > 0) {
>> +fill = bytestream2_get_le32(&dc);
>> +AV_WL32(b1 + cx, AV_RL32(b2 + cx));
>> +AV_WL32(b2 + cx, fill);
>> +cx += 4;
>> +NEXT_LINE
>> +}
>> +break;
>> +default:
>
>>

[FFmpeg-devel] [PATCH v5 0/2] libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

2018-09-08 Thread Jason Stevens
version 5 of this patch set properly sets DNxHR HQX/444 bit depth.

Jason Stevens (2):
  libavcodec/dnxhd: change ff_dnxhd_get_hr_frame_size to avpriv_
  libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

 libavcodec/dnxhd_parser.c |  2 +-
 libavcodec/dnxhddata.c| 13 ++
 libavcodec/dnxhddata.h| 14 +--
 libavcodec/dnxhdenc.c |  2 +-
 libavformat/mxfenc.c  | 53 ++-
 5 files changed, 68 insertions(+), 16 deletions(-)

-- 
2.18.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v5 1/2] libavcodec/dnxhd: change ff_dnxhd_get_hr_frame_size to avpriv_

2018-09-08 Thread Jason Stevens
refactor ff_dnxhd_get_hr_frame_size to avpriv_dnxhd_get_hr_frame_size, to allow 
cross library usage in libavformat/mxfenc
this change makes this function no longer be always inlined.

Signed-off-by: Jason Stevens 
---
 libavcodec/dnxhd_parser.c |  2 +-
 libavcodec/dnxhddata.c| 13 +
 libavcodec/dnxhddata.h| 14 +-
 libavcodec/dnxhdenc.c |  2 +-
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 79ca1d6718..7c16e251a4 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -75,7 +75,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 
 remaining = avpriv_dnxhd_get_frame_size(cid);
 if (remaining <= 0) {
-remaining = ff_dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
+remaining = avpriv_dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
 if (remaining <= 0)
 continue;
 }
diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index e9dd29ce4c..154be89860 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -1092,6 +1092,19 @@ int avpriv_dnxhd_get_frame_size(int cid)
 return ff_dnxhd_cid_table[i].frame_size;
 }
 
+int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
+{
+int result, i = ff_dnxhd_get_cid_table(cid);
+
+if (i < 0)
+return i;
+
+result = ((h + 15) / 16) * ((w + 15) / 16) * 
(int64_t)ff_dnxhd_cid_table[i].packet_scale.num / 
ff_dnxhd_cid_table[i].packet_scale.den;
+result = (result + 2048) / 4096 * 4096;
+
+return FFMAX(result, 8192);
+}
+
 int avpriv_dnxhd_get_interlaced(int cid)
 {
 int i = ff_dnxhd_get_cid_table(cid);
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index f80ce18f3c..cfa6b0c99d 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -90,20 +90,8 @@ static av_always_inline uint64_t 
ff_dnxhd_parse_header_prefix(const uint8_t *buf
 return ff_dnxhd_check_header_prefix(prefix);
 }
 
-static av_always_inline int ff_dnxhd_get_hr_frame_size(int cid, int w, int h)
-{
-int result, i = ff_dnxhd_get_cid_table(cid);
-
-if (i < 0)
-return i;
-
-result = ((h + 15) / 16) * ((w + 15) / 16) * 
(int64_t)ff_dnxhd_cid_table[i].packet_scale.num / 
ff_dnxhd_cid_table[i].packet_scale.den;
-result = (result + 2048) / 4096 * 4096;
-
-return FFMAX(result, 8192);
-}
-
 int avpriv_dnxhd_get_frame_size(int cid);
+int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h);
 int avpriv_dnxhd_get_interlaced(int cid);
 
 #endif /* AVCODEC_DNXHDDATA_H */
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 9325f38baf..41b8079a09 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -482,7 +482,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
 
 if (ctx->cid_table->frame_size == DNXHD_VARIABLE) {
-ctx->frame_size = ff_dnxhd_get_hr_frame_size(ctx->cid,
+ctx->frame_size = avpriv_dnxhd_get_hr_frame_size(ctx->cid,
  avctx->width, 
avctx->height);
 av_assert0(ctx->frame_size >= 0);
 ctx->coding_unit_size = ctx->frame_size;
-- 
2.18.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v5 2/2] libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

2018-09-08 Thread Jason Stevens
Add missing dnxhr mxf container essence ULs to the mxf encoder.

This fixes dnxhr mxf files being quarantined by Avid Media Composer.

Signed-off-by: Jason Stevens 
---
 libavformat/mxfenc.c | 53 +++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 7f629dbe53..66814ef6a1 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -146,6 +146,11 @@ enum ULIndex {
 INDEX_DNXHD_720p_8bit_HIGH,
 INDEX_DNXHD_720p_8bit_MEDIUM,
 INDEX_DNXHD_720p_8bit_LOW,
+INDEX_DNXHR_LB,
+INDEX_DNXHR_SQ,
+INDEX_DNXHR_HQ,
+INDEX_DNXHR_HQX,
+INDEX_DNXHR_444,
 INDEX_JPEG2000,
 INDEX_H264,
 };
@@ -345,6 +350,31 @@ static const MXFContainerEssenceEntry 
mxf_essence_container_uls[] = {
   { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
   { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x13,0x00,0x00 
},
   mxf_write_cdci_desc },
+// DNxHR LB - CID 1274
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x28,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR SQ - CID 1273
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x27,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR HQ - CID 1272
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x26,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR HQX - CID 1271
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x25,0x00,0x00 
},
+  mxf_write_cdci_desc },
+// DNxHR 444 - CID 1270
+{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x05,0x00 
},
+  { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x71,0x24,0x00,0x00 
},
+  mxf_write_cdci_desc },
 // JPEG2000
 { { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00 
},
   { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x08,0x00 
},
@@ -1959,7 +1989,11 @@ AVPacket *pkt)
 header_cid = pkt->data + 0x28;
 cid = header_cid[0] << 24 | header_cid[1] << 16 | header_cid[2] << 8 | 
header_cid[3];
 
-if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) < 0)
+if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) == DNXHD_VARIABLE) {
+frame_size = avpriv_dnxhd_get_hr_frame_size(cid, st->codecpar->width, 
st->codecpar->height);
+}
+
+if (frame_size < 0)
 return -1;
 if ((sc->interlaced = avpriv_dnxhd_get_interlaced(cid)) < 0)
 return AVERROR_INVALIDDATA;
@@ -1998,6 +2032,23 @@ AVPacket *pkt)
 case 1253:
 sc->index = INDEX_DNXHD_720p_8bit_LOW;
 break;
+case 1274:
+sc->index = INDEX_DNXHR_LB;
+break;
+case 1273:
+sc->index = INDEX_DNXHR_SQ;
+break;
+case 1272:
+sc->index = INDEX_DNXHR_HQ;
+break;
+case 1271:
+sc->index = INDEX_DNXHR_HQX;
+sc->component_depth = st->codecpar->bits_per_raw_sample;
+break;
+case 1270:
+sc->index = INDEX_DNXHR_444;
+sc->component_depth = st->codecpar->bits_per_raw_sample;
+break;
 default:
 return -1;
 }
-- 
2.18.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v4 2/2] libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

2018-09-08 Thread jay


 "Paul B Mahol"  

> On 9/8/18, Jason Stevens  wrote:
>> Add missing dnxhr mxf container essence ULs to the mxf encoder.
>> set proper mxf frame size for dnxhr using libavformat/dnxhd's get dnxhr size
>> function.
>>
>> This fixes dnxhr mxf files being quarantined by Avid Media Composer.
>>
>> Signed-off-by: Jason Stevens 
>> ---
>>  libavformat/mxfenc.c | 53 +++-
>>  1 file changed, 52 insertions(+), 1 deletion(-)
>>
>> +case 1272:
>> +sc->index = INDEX_DNXHR_HQ;
>> +break;
>> +case 1271:
>> +sc->index = INDEX_DNXHR_HQX;
>> +sc->component_depth = 10;
>> +break;
>> +case 1270:
>> +sc->index = INDEX_DNXHR_444;
>> +sc->component_depth = 10;
>> +break;
> 
> DNxHR HQX/444 can be 12bit.
> 

Missed that as the dnxhd encoder doesn't accept 12bit today.
The mxf mxuer should handle both 10/12. fixed in version 5.

-Jason


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter

2018-09-08 Thread Timo Rothenpieler
From: Roman Arzumanyan 

Signed-off-by: Timo Rothenpieler 
---
I'm not overly a fan of a rotate filter that only support 90° angles
either.
So here's my modified version of the original transpose filter, which
now behaves the exact same as the software transpose filter.

Additionally, I removed the format conversion from the filter. That's
the job of the scale filter, and also saves you from doing pointless
double format conversion if you scale and transpose NV12 video.
Nvenc accepts yuv420p/444p input anyway, and if you really need to, one
can add another scale_npp after to get back nv12.

A possible commandline for this is:
./ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i in.mkv -c copy -c:v h264_nvenc 
-vf scale_npp=format=yuv420p,transpose_npp=cclock_flip out.mkv


 configure  |   5 +-
 doc/filters.texi   |  55 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_transpose_npp.c | 483 +
 6 files changed, 544 insertions(+), 3 deletions(-)
 create mode 100644 libavfilter/vf_transpose_npp.c

diff --git a/configure b/configure
index 0d6ee0abfc..e1f229f052 100755
--- a/configure
+++ b/configure
@@ -2923,6 +2923,7 @@ hwupload_cuda_filter_deps="ffnvcodec"
 scale_npp_filter_deps="ffnvcodec libnpp"
 scale_cuda_filter_deps="cuda_sdk"
 thumbnail_cuda_filter_deps="cuda_sdk"
+transpose_npp_filter_deps="ffnvcodec libnpp"
 
 amf_deps_any="libdl LoadLibrary"
 nvenc_deps="ffnvcodec"
@@ -6082,8 +6083,8 @@ enabled libmodplug&& require_pkg_config 
libmodplug libmodplug libmodplug
 enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
lame_set_VBR_quality -lmp3lame $libm_extralibs
 enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h 
mysofa_load ||
require libmysofa mysofa.h mysofa_load -lmysofa 
$zlib_extralibs; }
-enabled libnpp&& { check_lib libnpp npp.h nppGetLibVersion -lnppig 
-lnppicc -lnppc ||
-   check_lib libnpp npp.h nppGetLibVersion -lnppi 
-lnppc ||
+enabled libnpp&& { check_lib libnpp npp.h nppGetLibVersion -lnppig 
-lnppicc -lnppc -lnppidei ||
+   check_lib libnpp npp.h nppGetLibVersion -lnppi 
-lnppc -lnppidei ||
die "ERROR: libnpp not found"; }
 enabled libopencore_amrnb && require libopencore_amrnb 
opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h 
D_IF_init -lopencore-amrwb
diff --git a/doc/filters.texi b/doc/filters.texi
index 37e79d34e1..5b839b6419 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16284,6 +16284,61 @@ The command above can also be specified as:
 transpose=1:portrait
 @end example
 
+@section transpose_npp
+
+Transpose rows with columns in the input video and optionally flip it.
+For more in depth examples see the @ref{transpose} video filter, which shares 
mostly the same options.
+
+It accepts the following parameters:
+
+@table @option
+
+@item dir
+Specify the transposition direction.
+
+Can assume the following values:
+@table @samp
+@item cclock_flip
+Rotate by 90 degrees counterclockwise and vertically flip. (default)
+
+@item clock
+Rotate by 90 degrees clockwise.
+
+@item cclock
+Rotate by 90 degrees counterclockwise.
+
+@item clock_flip
+Rotate by 90 degrees clockwise and vertically flip.
+@end table
+
+@item passthrough
+Do not apply the transposition if the input geometry matches the one
+specified by the specified value. It accepts the following values:
+@table @samp
+@item none
+Always apply transposition. (default)
+@item portrait
+Preserve portrait geometry (when @var{height} >= @var{width}).
+@item landscape
+Preserve landscape geometry (when @var{width} >= @var{height}).
+@end table
+
+@item interp_algo
+The interpolation algorithm used for rotating. One of the following:
+@table @option
+@item nn
+Nearest neighbour
+
+@item linear
+Linear
+
+@item cubic
+Cubid (default)
+
+@end table
+
+@end table
+
 @section trim
 Trim the input so that the output contains one continuous subpart of the input.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index e412000c8f..cc0cc15fd2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -374,6 +374,7 @@ OBJS-$(CONFIG_TONEMAP_FILTER)+= 
vf_tonemap.o colorspace.o
 OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o 
colorspace.o opencl.o \
 opencl/tonemap.o 
opencl/colorspace_common.o
 OBJS-$(CONFIG_TRANSPOSE_FILTER)  += vf_transpose.o
+OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER)  += vf_transpose_npp.o
 OBJS-$(CONFIG_TRIM_FILTER)   += trim.o
 OBJS-$(CONFIG_UNPREMULTIPLY_FILTER)  += vf_premultiply.o framesync.o
 OBJS-$(CONFIG_UNSHARP_FILTER)

Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/wcmv: fix output on big-endian with rgb565 format

2018-09-08 Thread Carl Eugen Hoyos
2018-09-08 15:51 GMT+02:00, Paul B Mahol :
> ffmpeg | branch: master | Paul B Mahol  | Sat Sep  8
> 15:48:53 2018 +0200| [af71a3ff3eb86c349bf7de09bea47575c4a882f7] | committer:
> Paul B Mahol
>
> avcodec/wcmv: fix output on big-endian with rgb565 format
>
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af71a3ff3eb86c349bf7de09bea47575c4a882f7
> ---
>
>  libavcodec/wcmv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c
> index 233427f3fa..384ceecd32 100644
> --- a/libavcodec/wcmv.c
> +++ b/libavcodec/wcmv.c
> @@ -209,7 +209,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
>  int zret;
>
>  switch (avctx->bits_per_coded_sample) {
> -case 16: avctx->pix_fmt = AV_PIX_FMT_RGB565; break;
> +case 16: avctx->pix_fmt = AV_PIX_FMT_RGB565LE; break;

Thank you, I had seen it but forgot...

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 2/2] libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

2018-09-08 Thread Tomas Härdin
fre 2018-09-07 klockan 16:40 +0200 skrev Carl Eugen Hoyos:
> > 2018-09-07 10:54 GMT+02:00, Tomas Härdin :
> > fre 2018-09-07 klockan 01:03 -0700 skrev Jason Stevens:
> > > Add missing dnxhr mxf container essence ULs to the mxf encoder.
> > > set proper mxf frame size for dnxhr using libavformat/dnxhd's get dnxhr
> > > size function.
> > > 
> > > This fixes dnxhr mxf files being quarantined by Avid Media Composer.
> > > 
> > > > Signed-off-by: Jason Stevens 
> > > 
> > > ---
> > >  libavformat/mxfenc.c | 53 +++-
> > >  1 file changed, 52 insertions(+), 1 deletion(-)
> > > 
> > > @@ -1959,7 +1989,11 @@ AVPacket *pkt)
> > >  header_cid = pkt->data + 0x28;
> > >  cid = header_cid[0] << 24 | header_cid[1] << 16 | header_cid[2] << 8
> > > > header_cid[3];
> > > 
> > > -if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) < 0)
> > > +if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) ==
> > > DNXHD_VARIABLE) {
> > > +frame_size = avpriv_dnxhd_get_hr_frame_size(cid,
> > > st->codecpar->width, st->codecpar->height);
> > > +}
> > > +
> > > +if (frame_size < 0)
> > >  return -1;
> > >  if ((sc->interlaced = avpriv_dnxhd_get_interlaced(cid)) < 0)
> > >  return AVERROR_INVALIDDATA;
> > > @@ -1998,6 +2032,23 @@ AVPacket *pkt)
> > >  case 1253:
> > >  sc->index = INDEX_DNXHD_720p_8bit_LOW;
> > >  break;
> > > +case 1274:
> > > +sc->index = INDEX_DNXHR_LB;
> > > +break;
> > > +case 1273:
> > > +sc->index = INDEX_DNXHR_SQ;
> > > +break;
> > > +case 1272:
> > > +sc->index = INDEX_DNXHR_HQ;
> > > +break;
> > > +case 1271:
> > > +sc->index = INDEX_DNXHR_HQX;
> > > +sc->component_depth = 10;
> > > +break;
> > > +case 1270:
> > > +sc->index = INDEX_DNXHR_444;
> > > +sc->component_depth = 10;
> > > +break;
> > 
> > Is there some spec one can reference to for these magic constants?
> 
> Which magic constants?

The "case" values. Not that I'm suggesting adding #defines for them or
anything, just a comment for where one might look up potential future
values

/Tomas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter

2018-09-08 Thread Timo Rothenpieler

On 9/8/2018 3:49 PM, Timo Rothenpieler wrote:

From: Roman Arzumanyan 

Signed-off-by: Timo Rothenpieler 
---
I'm not overly a fan of a rotate filter that only support 90° angles
either.
So here's my modified version of the original transpose filter, which
now behaves the exact same as the software transpose filter.

Additionally, I removed the format conversion from the filter. That's
the job of the scale filter, and also saves you from doing pointless
double format conversion if you scale and transpose NV12 video.
Nvenc accepts yuv420p/444p input anyway, and if you really need to, one
can add another scale_npp after to get back nv12.

A possible commandline for this is:
./ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i in.mkv -c copy -c:v h264_nvenc 
-vf scale_npp=format=yuv420p,transpose_npp=cclock_flip out.mkv


I'll probably remove the interp_algo from this before committing, hard 
coding it to nearest neighbor. I'm unable to see any difference between 
them for perfect 90° angles except that NN is easily 10 times faster 
than the current default Cubic.




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 2/2] libavformat/mxfenc: add missing dnxhr mxfcontainer essence ULs

2018-09-08 Thread Paul B Mahol
On 9/8/18, Tomas Haerdin  wrote:
> fre 2018-09-07 klockan 16:40 +0200 skrev Carl Eugen Hoyos:
>> > 2018-09-07 10:54 GMT+02:00, Tomas Haerdin :
>> > fre 2018-09-07 klockan 01:03 -0700 skrev Jason Stevens:
>> > > Add missing dnxhr mxf container essence ULs to the mxf encoder.
>> > > set proper mxf frame size for dnxhr using libavformat/dnxhd's get
>> > > dnxhr
>> > > size function.
>> > >
>> > > This fixes dnxhr mxf files being quarantined by Avid Media Composer.
>> > >
>> > > > Signed-off-by: Jason Stevens 
>> > >
>> > > ---
>> > >  libavformat/mxfenc.c | 53
>> > > +++-
>> > >  1 file changed, 52 insertions(+), 1 deletion(-)
>> > >
>> > > @@ -1959,7 +1989,11 @@ AVPacket *pkt)
>> > >  header_cid = pkt->data + 0x28;
>> > >  cid = header_cid[0] << 24 | header_cid[1] << 16 | header_cid[2]
>> > > << 8
>> > > > header_cid[3];
>> > >
>> > > -if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) < 0)
>> > > +if ((frame_size = avpriv_dnxhd_get_frame_size(cid)) ==
>> > > DNXHD_VARIABLE) {
>> > > +frame_size = avpriv_dnxhd_get_hr_frame_size(cid,
>> > > st->codecpar->width, st->codecpar->height);
>> > > +}
>> > > +
>> > > +if (frame_size < 0)
>> > >  return -1;
>> > >  if ((sc->interlaced = avpriv_dnxhd_get_interlaced(cid)) < 0)
>> > >  return AVERROR_INVALIDDATA;
>> > > @@ -1998,6 +2032,23 @@ AVPacket *pkt)
>> > >  case 1253:
>> > >  sc->index = INDEX_DNXHD_720p_8bit_LOW;
>> > >  break;
>> > > +case 1274:
>> > > +sc->index = INDEX_DNXHR_LB;
>> > > +break;
>> > > +case 1273:
>> > > +sc->index = INDEX_DNXHR_SQ;
>> > > +break;
>> > > +case 1272:
>> > > +sc->index = INDEX_DNXHR_HQ;
>> > > +break;
>> > > +case 1271:
>> > > +sc->index = INDEX_DNXHR_HQX;
>> > > +sc->component_depth = 10;
>> > > +break;
>> > > +case 1270:
>> > > +sc->index = INDEX_DNXHR_444;
>> > > +sc->component_depth = 10;
>> > > +break;
>> >
>> > Is there some spec one can reference to for these magic constants?
>>
>> Which magic constants?
>
> The "case" values. Not that I'm suggesting adding #defines for them or
> anything, just a comment for where one might look up potential future
> values

In specification.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter

2018-09-08 Thread Paul B Mahol
On 9/8/18, Timo Rothenpieler  wrote:
> On 9/8/2018 3:49 PM, Timo Rothenpieler wrote:
>> From: Roman Arzumanyan 
>>
>> Signed-off-by: Timo Rothenpieler 
>> ---
>> I'm not overly a fan of a rotate filter that only support 90DEG angles
>> either.
>> So here's my modified version of the original transpose filter, which
>> now behaves the exact same as the software transpose filter.
>>
>> Additionally, I removed the format conversion from the filter. That's
>> the job of the scale filter, and also saves you from doing pointless
>> double format conversion if you scale and transpose NV12 video.
>> Nvenc accepts yuv420p/444p input anyway, and if you really need to, one
>> can add another scale_npp after to get back nv12.
>>
>> A possible commandline for this is:
>> ./ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i in.mkv -c copy -c:v
>> h264_nvenc -vf scale_npp=format=yuv420p,transpose_npp=cclock_flip out.mkv
>
> I'll probably remove the interp_algo from this before committing, hard
> coding it to nearest neighbor. I'm unable to see any difference between
> them for perfect 90DEG angles except that NN is easily 10 times faster
> than the current default Cubic.

Perhaps interpolation is useful for other pixel format where vertical
and horizontal subsampling are not same.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter

2018-09-08 Thread Timo Rothenpieler

On 9/8/2018 5:38 PM, Paul B Mahol wrote:

I'll probably remove the interp_algo from this before committing, hard
coding it to nearest neighbor. I'm unable to see any difference between
them for perfect 90DEG angles except that NN is easily 10 times faster
than the current default Cubic.


Perhaps interpolation is useful for other pixel format where vertical
and horizontal subsampling are not same.


This only supports yuv420p and yuv444p so I don't think it's an issue. 
It's impossible for such formats to end up in a CUDA frame to begin 
with, since nothing supports putting them in there.




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/libaomenc.c: Added code for computing PSNR/SSIM for libaom encoder.

2018-09-08 Thread James Almer
On 9/7/2018 8:51 PM, Sam John wrote:
> ---
>  libavcodec/libaomenc.c | 117 +
>  1 file changed, 96 insertions(+), 21 deletions(-)
> 
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 9431179886..e62057177d 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -50,6 +50,9 @@ struct FrameListData {
>  unsigned long duration;  /**< duration to show frame
>(in timebase units) */
>  uint32_t flags;  /**< flags for this frame */
> +uint64_t sse[4];
> +int have_sse;/**< true if we have pending sse[] */
> +uint64_t frame_number;
>  struct FrameListData *next;
>  };
>  
> @@ -68,6 +71,9 @@ typedef struct AOMEncoderContext {
>  int static_thresh;
>  int drop_threshold;
>  int noise_sensitivity;
> +uint64_t sse[4];
> +int have_sse; /**< true if we have pending sse[] */
> +uint64_t frame_number;
>  } AOMContext;
>  
>  static const char *const ctlidstr[] = {
> @@ -289,7 +295,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  {
>  AOMContext *ctx = avctx->priv_data;
>  struct aom_codec_enc_cfg enccfg = { 0 };
> -aom_codec_flags_t flags = 0;
> +aom_codec_flags_t flags =
> +(avctx->flags & AV_CODEC_FLAG_PSNR) ? AOM_CODEC_USE_PSNR : 0;
>  AVCPBProperties *cpb_props;
>  int res;
>  aom_img_fmt_t img_fmt;
> @@ -499,13 +506,30 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  }
>  
>  static inline void cx_pktcpy(struct FrameListData *dst,
> - const struct aom_codec_cx_pkt *src)
> + const struct aom_codec_cx_pkt *src,
> + AOMContext *ctx)
>  {
>  dst->pts  = src->data.frame.pts;
>  dst->duration = src->data.frame.duration;
>  dst->flags= src->data.frame.flags;
>  dst->sz   = src->data.frame.sz;
>  dst->buf  = src->data.frame.buf;
> +dst->have_sse = 0;
> +/* For alt-ref frame, don't store PSNR or increment frame_number */
> +if (!(dst->flags & AOM_FRAME_IS_INVISIBLE)) {

Did you copy this chunk from the libvpxenc wrapper? Because I don't
think this is valid at all for libaom. A quick grep on their tree shows
that AOM_FRAME_IS_INVISIBLE is never set anywhere. It looks like a
leftover flag they forgot to remove from the libvpx codebase.

> +dst->frame_number = ++ctx->frame_number;
> +dst->have_sse = ctx->have_sse;
> +if (ctx->have_sse) {
> +/* associate last-seen SSE to the frame. */
> +/* Transfers ownership from ctx to dst. */
> +/* WARNING! This makes the assumption that PSNR_PKT comes
> +   just before the frame it refers to! */
> +memcpy(dst->sse, ctx->sse, sizeof(dst->sse));
> +ctx->have_sse = 0;
> +}
> +} else {
> +dst->frame_number = -1;   /* sanity marker */
> +}
>  }
>  
>  /**
> @@ -524,26 +548,68 @@ static int storeframe(AVCodecContext *avctx, struct 
> FrameListData *cx_frame,
>  av_log(avctx, AV_LOG_ERROR,
> "Error getting output packet of size %"SIZE_SPECIFIER".\n", 
> cx_frame->sz);
>  return ret;
> -}
> -memcpy(pkt->data, cx_frame->buf, pkt->size);
> -pkt->pts = pkt->dts = cx_frame->pts;
> +} else {
> +int pict_type;
> +memcpy(pkt->data, cx_frame->buf, pkt->size);
> +pkt->pts = pkt->dts = cx_frame->pts;
> +#if FF_API_CODED_FRAME
> +FF_DISABLE_DEPRECATION_WARNINGS
> +avctx->coded_frame->pts   = cx_frame->pts;
> +avctx->coded_frame->key_frame = !!(cx_frame->flags & 
> AOM_FRAME_IS_KEY);

coded_frame is deprecated and it's not meant to be used in new modules.
It's left on old ones until removal for backwards compatibility reasons.

> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
> +
> +if (!!(cx_frame->flags & AOM_FRAME_IS_KEY)) {
> +pict_type = AV_PICTURE_TYPE_I;
> +#if FF_API_CODED_FRAME
> +FF_DISABLE_DEPRECATION_WARNINGS
> +avctx->coded_frame->pict_type = pict_type;
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
> +pkt->flags |= AV_PKT_FLAG_KEY;
> +} else {
> +pict_type = AV_PICTURE_TYPE_P;

I'm fairly sure libaom can return I frames that are not key frames. The
INTRA_ONLY type ones.

Does libaom have a flag or field to signal the type of the visible frame
in the returned packet?

> +#if FF_API_CODED_FRAME
> +FF_DISABLE_DEPRECATION_WARNINGS
> +avctx->coded_frame->pict_type = pict_type;
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
> +}
>  
> -if (!!(cx_frame->flags & AOM_FRAME_IS_KEY))
> -pkt->flags |= AV_PKT_FLAG_KEY;
> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> +ret = av_bsf_send_packet(ctx->bsf, pkt);
> +if (ret < 0) {
> +av_log(avctx, AV_LOG_ERROR, "extract_extrada

Re: [FFmpeg-devel] Reduce static table size for VLC tables in h264_cavlc.c

2018-09-08 Thread James Almer
On 9/7/2018 8:50 PM, Dale Curtis wrote:
> These tables represent ~70k so moving the allocation to when
> they're actually used reduces memory usage in cases where the
> h264 decoder isn't used.
> 
> 
> cavlc-size.patch
> 
> 
> From e1cbe52a1f41a39698136efb4695d8d019117853 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Fri, 31 Aug 2018 16:50:23 -0700
> Subject: [PATCH] Reduce static table size for VLC tables in h264_cavlc.c
> 
> These tables represent ~70k so moving the allocation to when
> they're actually used reduces memory usage in cases where the
> h264 decoder isn't used.
> 
> Signed-off-by: Dale Curtis 
> ---
>  libavcodec/h264_cavlc.c | 43 +
>  1 file changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
> index a7e60676a0..7769202401 100644
> --- a/libavcodec/h264_cavlc.c
> +++ b/libavcodec/h264_cavlc.c
> @@ -236,35 +236,35 @@ static const uint8_t run_bits[7][16]={
>  };
>  
>  static VLC coeff_token_vlc[4];
> -static VLC_TYPE coeff_token_vlc_tables[520+332+280+256][2];
> +static VLC_TYPE (*coeff_token_vlc_tables)[520+332+280+256][2];
>  static const int coeff_token_vlc_tables_size[4]={520,332,280,256};
>  
>  static VLC chroma_dc_coeff_token_vlc;
> -static VLC_TYPE chroma_dc_coeff_token_vlc_table[256][2];
> +static VLC_TYPE (*chroma_dc_coeff_token_vlc_table)[256][2];
>  static const int chroma_dc_coeff_token_vlc_table_size = 256;
>  
>  static VLC chroma422_dc_coeff_token_vlc;
> -static VLC_TYPE chroma422_dc_coeff_token_vlc_table[8192][2];
> +static VLC_TYPE (*chroma422_dc_coeff_token_vlc_table)[8192][2];
>  static const int chroma422_dc_coeff_token_vlc_table_size = 8192;
>  
>  static VLC total_zeros_vlc[15+1];
> -static VLC_TYPE total_zeros_vlc_tables[15][512][2];
> +static VLC_TYPE (*total_zeros_vlc_tables)[15][512][2];
>  static const int total_zeros_vlc_tables_size = 512;
>  
>  static VLC chroma_dc_total_zeros_vlc[3+1];
> -static VLC_TYPE chroma_dc_total_zeros_vlc_tables[3][8][2];
> +static VLC_TYPE (*chroma_dc_total_zeros_vlc_tables)[3][8][2];
>  static const int chroma_dc_total_zeros_vlc_tables_size = 8;
>  
>  static VLC chroma422_dc_total_zeros_vlc[7+1];
> -static VLC_TYPE chroma422_dc_total_zeros_vlc_tables[7][32][2];
> +static VLC_TYPE (*chroma422_dc_total_zeros_vlc_tables)[7][32][2];
>  static const int chroma422_dc_total_zeros_vlc_tables_size = 32;
>  
>  static VLC run_vlc[6+1];
> -static VLC_TYPE run_vlc_tables[6][8][2];
> +static VLC_TYPE (*run_vlc_tables)[6][8][2];
>  static const int run_vlc_tables_size = 8;
>  
>  static VLC run7_vlc;
> -static VLC_TYPE run7_vlc_table[96][2];
> +static VLC_TYPE (*run7_vlc_table)[96][2];
>  static const int run7_vlc_table_size = 96;
>  
>  #define LEVEL_TAB_BITS 8
> @@ -331,14 +331,23 @@ av_cold void ff_h264_decode_init_vlc(void){
>  int offset;
>  done = 1;
>  
> -chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table;
> +coeff_token_vlc_tables = av_mallocz(sizeof(*coeff_token_vlc_tables));
> +chroma_dc_coeff_token_vlc_table = 
> av_mallocz(sizeof(*chroma_dc_coeff_token_vlc_table));
> +chroma422_dc_coeff_token_vlc_table = 
> av_mallocz(sizeof(*chroma422_dc_coeff_token_vlc_table));
> +total_zeros_vlc_tables = av_mallocz(sizeof(*total_zeros_vlc_tables));
> +chroma_dc_total_zeros_vlc_tables = 
> av_mallocz(sizeof(*chroma_dc_total_zeros_vlc_tables));
> +chroma422_dc_total_zeros_vlc_tables = 
> av_mallocz(sizeof(*chroma422_dc_total_zeros_vlc_tables));
> +run_vlc_tables = av_mallocz(sizeof(*run_vlc_tables));
> +run7_vlc_table = av_mallocz(sizeof(*run7_vlc_table));

Missing allocation checks.

> +
> +chroma_dc_coeff_token_vlc.table = *chroma_dc_coeff_token_vlc_table;
>  chroma_dc_coeff_token_vlc.table_allocated = 
> chroma_dc_coeff_token_vlc_table_size;
>  init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 
> 4*5,
>   &chroma_dc_coeff_token_len [0], 1, 1,
>   &chroma_dc_coeff_token_bits[0], 1, 1,
>   INIT_VLC_USE_NEW_STATIC);
>  
> -chroma422_dc_coeff_token_vlc.table = 
> chroma422_dc_coeff_token_vlc_table;
> +chroma422_dc_coeff_token_vlc.table = 
> *chroma422_dc_coeff_token_vlc_table;
>  chroma422_dc_coeff_token_vlc.table_allocated = 
> chroma422_dc_coeff_token_vlc_table_size;
>  init_vlc(&chroma422_dc_coeff_token_vlc, 
> CHROMA422_DC_COEFF_TOKEN_VLC_BITS, 4*9,
>   &chroma422_dc_coeff_token_len [0], 1, 1,
> @@ -347,7 +356,7 @@ av_cold void ff_h264_decode_init_vlc(void){
>  
>  offset = 0;
>  for(i=0; i<4; i++){
> -coeff_token_vlc[i].table = coeff_token_vlc_tables+offset;
> +coeff_token_vlc[i].table = (*coeff_token_vlc_tables)+offset;
>  coeff_token_vlc[i].table_allocated = 
> coeff_token_vlc_tables_size[i];
>  init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_V

Re: [FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format

2018-09-08 Thread James Almer
On 9/7/2018 12:27 PM, John Stebbins wrote:
> On 09/07/2018 08:16 AM, James Almer wrote:
>> On 9/7/2018 12:09 PM, John Stebbins wrote:
>>> On 09/06/2018 03:40 PM, James Almer wrote:
 On 8/27/2018 6:07 PM, John Stebbins wrote:
> On 08/27/2018 02:03 PM, James Almer wrote:
>> On 8/27/2018 5:48 PM, John Stebbins wrote:
>>> On 08/27/2018 01:29 PM, James Almer wrote:
 On 8/27/2018 4:57 PM, John Stebbins wrote:
> Fixes ticket #6897
> ---
>  libavformat/movenc.c | 40 +---
>  1 file changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 8a3b651514..dd6281d210 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1589,6 +1589,26 @@ static const AVCodecTag 
> codec_cover_image_tags[] = {
>  { AV_CODEC_ID_NONE, 0 },
>  };
>  
> +static int validate_codec_tag(const AVCodecTag *const *tags,
> +  unsigned int tag, int codec_id)
> +{
> +int i;
> +
> +/**
> + * Check that tag + id is in the table
> + */
> +for (i = 0; tags && tags[i]; i++) {
> +const AVCodecTag *codec_tags = tags[i];
> +while (codec_tags->id != AV_CODEC_ID_NONE) {
> +if (codec_tags->tag == tag && codec_tags->id == 
> codec_id) {
 Make both tag checks case insensitive using avpriv_toupper4(), then
 return codec_tags->tag instead of 1 if the check succeeds.
>>> I've never seen mismatched case in these tags, but sure, why not... 
>>> there's plenty I haven't seen.
>> AV1 in IVF is AV01, wheres in mp4 it's av01. That's the case i had in
>> mind when requesting this.
> Hmm, I should probably return codec_tags->tag in this case rather than 
> tag since it is the expected capitalization for
> the container.  I'll have to fix that (again).
 What's the status of this? With that change i think it should be good to
 go in.
>>> It's good as far as I'm concerned.  I don't have commit privs.
>> Did you send the updated version returning codec_tags->tag? I can't find
>> it in my inbox. Otherwise I'd have pushed it.
>>
> 
> Yup
> https://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233739.html

Ok, pushed the set then. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]configure: Do not use -fomit-frame-pointer on sparc

2018-09-08 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes many warnings when compiling for sparc.

Please comment, Carl Eugen
From 9239602b04abb2ee7b986897923a929a2e6a5028 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sun, 9 Sep 2018 01:01:24 +0200
Subject: [PATCH] configure: Do not use -fomit-frame-pointer on sparc.

Silences many warnings on compilation.
---
 configure |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 0d6ee0a..556414e 100755
--- a/configure
+++ b/configure
@@ -5471,7 +5471,7 @@ set_default libdir
 set_default $PATHS_LIST
 set_default nm
 
-disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
+disabled optimizations || enabled ossfuzz || enabled sparc || check_cflags -fomit-frame-pointer
 
 enable_weak_pic() {
 disabled pic && return
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter

2018-09-08 Thread Michael Niedermayer
On Sat, Sep 08, 2018 at 03:49:29PM +0200, Timo Rothenpieler wrote:
> From: Roman Arzumanyan 
> 
> Signed-off-by: Timo Rothenpieler 
> ---
> I'm not overly a fan of a rotate filter that only support 90° angles
> either.
> So here's my modified version of the original transpose filter, which
> now behaves the exact same as the software transpose filter.
> 
> Additionally, I removed the format conversion from the filter. That's
> the job of the scale filter, and also saves you from doing pointless
> double format conversion if you scale and transpose NV12 video.
> Nvenc accepts yuv420p/444p input anyway, and if you really need to, one
> can add another scale_npp after to get back nv12.
> 
> A possible commandline for this is:
> ./ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i in.mkv -c copy -c:v h264_nvenc 
> -vf scale_npp=format=yuv420p,transpose_npp=cclock_flip out.mkv
> 
> 
>  configure  |   5 +-
>  doc/filters.texi   |  55 
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/version.h  |   2 +-
>  libavfilter/vf_transpose_npp.c | 483 +
>  6 files changed, 544 insertions(+), 3 deletions(-)
>  create mode 100644 libavfilter/vf_transpose_npp.c

breaks build:

HTMLdoc/ffmpeg-filters.html
HTMLdoc/ffplay-all.html
HTMLdoc/ffmpeg-all.html
HTMLdoc/ffprobe-all.html
doc/filters.texi:16290: @ref reference to nonexistent node `transpose'
make: *** [doc/ffmpeg-filters.html] Error 1
doc/filters.texi:16290: @ref reference to nonexistent node `transpose'
doc/filters.texi:16290: @ref reference to nonexistent node `transpose'
make: *** [doc/ffplay-all.html] Error 1
make: *** [doc/ffprobe-all.html] Error 1
doc/filters.texi:16290: @ref reference to nonexistent node `transpose'
make: *** [doc/ffmpeg-all.html] Error 1
make: Target `all' not remade because of errors.



[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]configure: Do not use -fomit-frame-pointer on sparc

2018-09-08 Thread Michael Niedermayer
On Sun, Sep 09, 2018 at 01:03:36AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes many warnings when compiling for sparc.
> 
> Please comment, Carl Eugen

>  configure |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 92a4853fbf697e9528ab000924a001fd6366b279  
> 0001-configure-Do-not-use-fomit-frame-pointer-on-sparc.patch
> From 9239602b04abb2ee7b986897923a929a2e6a5028 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Sun, 9 Sep 2018 01:01:24 +0200
> Subject: [PATCH] configure: Do not use -fomit-frame-pointer on sparc.
> 
> Silences many warnings on compilation.

can you show some examples of these warnings ?
(its hard to review this without knowing what warnings this is about
 exactly i think)
 
thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Reduce static table size for VLC tables in h264_cavlc.c

2018-09-08 Thread Michael Niedermayer
On Fri, Sep 07, 2018 at 04:50:57PM -0700, Dale Curtis wrote:
> These tables represent ~70k so moving the allocation to when
> they're actually used reduces memory usage in cases where the
> h264 decoder isn't used.

>  h264_cavlc.c |   43 ++-
>  1 file changed, 26 insertions(+), 17 deletions(-)
> c7d67012a2207911076717c1667e698842fa101a  cavlc-size.patch
> From e1cbe52a1f41a39698136efb4695d8d019117853 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Fri, 31 Aug 2018 16:50:23 -0700
> Subject: [PATCH] Reduce static table size for VLC tables in h264_cavlc.c
> 
> These tables represent ~70k so moving the allocation to when
> they're actually used reduces memory usage in cases where the
> h264 decoder isn't used.
> 
> Signed-off-by: Dale Curtis 
> ---
>  libavcodec/h264_cavlc.c | 43 +
>  1 file changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
> index a7e60676a0..7769202401 100644
> --- a/libavcodec/h264_cavlc.c
> +++ b/libavcodec/h264_cavlc.c
> @@ -236,35 +236,35 @@ static const uint8_t run_bits[7][16]={
>  };
>  
>  static VLC coeff_token_vlc[4];
> -static VLC_TYPE coeff_token_vlc_tables[520+332+280+256][2];
> +static VLC_TYPE (*coeff_token_vlc_tables)[520+332+280+256][2];
>  static const int coeff_token_vlc_tables_size[4]={520,332,280,256};

dont all modern OS assign physical memory only once something is stored
in these tables?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/aacenc: report channel layout by name

2018-09-08 Thread Michael Niedermayer
On Fri, Jul 06, 2018 at 11:49:50PM +0200, Moritz Barsnick wrote:
> Possibly useful in the error case.
> 
> Signed-off-by: Moritz Barsnick 
> ---
>  libavcodec/aacenc.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avutil/mips: [loongson] simplify macro TRANSPOSE_4H and TRANSPOSE_8B

2018-09-08 Thread Michael Niedermayer
On Fri, Sep 07, 2018 at 11:51:05AM +0800, Shiyou Yin wrote:
> >-Original Message-
> >From: ffmpeg-devel-boun...@ffmpeg.org 
> >[mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> >Shiyou Yin
> >Sent: Thursday, September 6, 2018 4:11 PM
> >To: ffmpeg-devel@ffmpeg.org
> >Subject: [FFmpeg-devel] [PATCH 2/2] avutil/mips: [loongson] simplify macro 
> >TRANSPOSE_4H and
> >TRANSPOSE_8B
> >
> >Simplify macro TRANSPOSE_4H in mmiutils.h and add TRANSPOSE_8B as a common 
> >macro.
> >---
> > libavcodec/mips/vc1dsp_mmi.c | 12 +++
> > libavcodec/mips/vp8dsp_mmi.c | 72 +
> > libavutil/mips/mmiutils.h| 84 
> > 
> > 3 files changed, 65 insertions(+), 103 deletions(-)
> >
> >diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
> >index a439b40..80778a5 100644
> >--- a/libavcodec/mips/vc1dsp_mmi.c
> >+++ b/libavcodec/mips/vc1dsp_mmi.c
> >@@ -248,8 +248,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
> >0xfff70004, 0xffff, %[ff_pw_4])
> >
> > TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
> >- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
> >- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
> >+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
> >
> > MMI_SDC1(%[ftmp15], %[dst], 0x00)
> > MMI_SDC1(%[ftmp16], %[dst], 0x10)
> >@@ -257,8 +256,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
> > MMI_SDC1(%[ftmp18], %[dst], 0x30)
> >
> > TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
> >- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
> >- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
> >+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
> >
> > MMI_SDC1(%[ftmp19], %[dst], 0x08)
> > MMI_SDC1(%[ftmp20], %[dst], 0x18)
> >@@ -301,8 +299,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
> >0xfff70004, 0xffff, %[ff_pw_4])
> >
> > TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
> >- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
> >- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
> >+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
> >
> > MMI_SDC1(%[ftmp15], %[dst], 0x40)
> > MMI_SDC1(%[ftmp16], %[dst], 0x50)
> >@@ -310,8 +307,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64])
> > MMI_SDC1(%[ftmp18], %[dst], 0x70)
> >
> > TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
> >- %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
> >- %[ftmp5], %[tmp0],  %[ftmp6], %[ftmp7])
> >+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
> >
> > MMI_SDC1(%[ftmp19], %[dst], 0x48)
> > MMI_SDC1(%[ftmp20], %[dst], 0x58)
> >diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
> >index b24a87a..bd80aa1 100644
> >--- a/libavcodec/mips/vp8dsp_mmi.c
> >+++ b/libavcodec/mips/vp8dsp_mmi.c
> >@@ -44,58 +44,6 @@
> > "punpcklbh  "#dst_r",   "#src", %[db_2] \n\t"   
> > \
> > "punpckhbh  "#dst_l",   "#src", %[db_2] \n\t"
> >
> >-#define MMI_TRANSPOSE8x8_UB_UB(src_0, src_1, src_2, src_3,  
> >\
> >-   src_4, src_5, src_6, src_7,  
> >\
> >-   dst_0, dst_1, dst_2, dst_3,  
> >\
> >-   dst_4, dst_5, dst_6, dst_7)  
> >\
> >-"li %[it_1],0xe4\n\t"   
> >\
> >-"dmtc1  %[it_1],%[db_1] \n\t"   
> >\
> >-"pshufh %[db_2],"#src_0",   %[db_1] \n\t"   
> >\
> >-"punpcklbh  "#dst_0",   "#src_0",   "#src_1"\n\t"   
> >\
> >-"punpckhbh  "#dst_1",   %[db_2],"#src_1"\n\t"   
> >\
> >-"pshufh %[db_2],"#src_2",   %[db_1] \n\t"   
> >\
> >-"punpcklbh  "#dst_2",   "#src_2",   "#src_3"\n\t"   
> >\
> >-"punpckhbh  "#dst_3",   %[db_2],"#src_3"\n\t"   
> >\
> >-"pshufh %[db_2],"#src_4",   %[db_1] \n\t"   
> >\
> >-"punpcklbh  "#dst_4",   "#src_4",   "#src_5"\n\t"   
> >\
> >-"punpckhbh  "#dst_5",   %[db_2],"#src_5"\n\t"   
> >\
> >-"pshufh %[db_2],"#src_6",   %[db_1] \n\t"   
> >\
> >-"punpcklbh  "#dst_6",   "#src_6",   "#src_7"\n\t"   
> >\
> >-"punpckhbh  "#dst_7",   %[db_2],"#src_7"\n\t"   
> >\
> >-
> >\
> >-"pshufh %[db_2],"#dst_0",   %[db_1]   

Re: [FFmpeg-devel] Don't calculate duration using AV_NOPTS_VALUE for start_time.

2018-09-08 Thread Michael Niedermayer
On Fri, Sep 07, 2018 at 04:46:02PM -0700, Dale Curtis wrote:
> Found by ClusterFuzz, https://crbug.com/879852

>  utils.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> e5a29fc92c11899d4c54660cb17ff822058a5837  fix-av-nopts-start-time.patch
> From 68614e9a099ee4ae754da5fa36fbb6a570f4aa73 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Fri, 7 Sep 2018 15:37:09 -0700
> Subject: [PATCH] Don't calculate duration using AV_NOPTS_VALUE for start_time.
> 
> Found by ClusterFuzz, https://crbug.com/879852
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel