[FFmpeg-devel] [PATCH 2/3] avcodec/zmbv: remove useless zero check on dimensions

2018-08-26 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/zmbv.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index f91d2e3931..251a72cf31 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -599,12 +599,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
 
 /* Allocate decompression buffer */
-if (c->decomp_size) {
-if (!(c->decomp_buf = av_mallocz(c->decomp_size))) {
-av_log(avctx, AV_LOG_ERROR,
-   "Can't allocate decompression buffer.\n");
-return AVERROR(ENOMEM);
-}
+c->decomp_buf = av_mallocz(c->decomp_size);
+if (!c->decomp_buf) {
+av_log(avctx, AV_LOG_ERROR,
+"Can't allocate decompression buffer.\n");
+return AVERROR(ENOMEM);
 }
 
 c->zstream.zalloc = Z_NULL;
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 3/3] iavcodec/zmbv: Avoid reallocating cur/prev buffers if they are large enough

2018-08-26 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
9721/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZMBV_fuzzer-5650321660444672

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/zmbv.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 251a72cf31..b01ce1bcf6 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -57,6 +57,7 @@ typedef struct ZmbvContext {
 AVCodecContext *avctx;
 
 int bpp;
+int alloc_bpp;
 unsigned int decomp_size;
 uint8_t* decomp_buf;
 uint8_t pal[768];
@@ -494,12 +495,17 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame, AVPac
 return AVERROR_UNKNOWN;
 }
 
-c->cur  = av_realloc_f(c->cur, avctx->width * avctx->height,  (c->bpp 
/ 8));
-c->prev = av_realloc_f(c->prev, avctx->width * avctx->height,  (c->bpp 
/ 8));
+if (c->alloc_bpp < c->bpp) {
+c->cur  = av_realloc_f(c->cur, avctx->width * avctx->height,  
(c->bpp / 8));
+c->prev = av_realloc_f(c->prev, avctx->width * avctx->height,  
(c->bpp / 8));
+c->alloc_bpp = c->bpp;
+}
 c->bx = (c->width + c->bw - 1) / c->bw;
 c->by = (c->height+ c->bh - 1) / c->bh;
-if (!c->cur || !c->prev)
+if (!c->cur || !c->prev) {
+c->alloc_bpp = 0;
 return AVERROR(ENOMEM);
+}
 memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
 memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
 c->decode_intra= decode_intra;
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec_template: do not ignore the return code of decode_line()

2018-08-26 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
9710/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4918894635515904

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1dec_template.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index f8a42a6d44..fecdbd0025 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -107,7 +107,7 @@ static av_always_inline int RENAME(decode_line)(FFV1Context 
*s, int w,
 return 0;
 }
 
-static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, 
int h, int stride[4])
+static int RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, 
int h, int stride[4])
 {
 int x, y, p;
 TYPE *sample[4][2];
@@ -127,6 +127,7 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, 
uint8_t *src[4], int w, int
 
 for (y = 0; y < h; y++) {
 for (p = 0; p < 3 + transparency; p++) {
+int ret;
 TYPE *temp = sample[p][0]; // FIXME: try a normal buffer
 
 sample[p][0] = sample[p][1];
@@ -135,9 +136,11 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, 
uint8_t *src[4], int w, int
 sample[p][1][-1]= sample[p][0][0  ];
 sample[p][0][ w]= sample[p][0][w-1];
 if (lbd && s->slice_coding_mode == 0)
-RENAME(decode_line)(s, w, sample[p], (p + 1)/2, 9);
+ret = RENAME(decode_line)(s, w, sample[p], (p + 1)/2, 9);
 else
-RENAME(decode_line)(s, w, sample[p], (p + 1)/2, bits + 
(s->slice_coding_mode != 1));
+ret = RENAME(decode_line)(s, w, sample[p], (p + 1)/2, bits + 
(s->slice_coding_mode != 1));
+if (ret < 0)
+return ret;
 }
 for (x = 0; x < w; x++) {
 int g = sample[0][1][x];
@@ -168,4 +171,5 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, 
uint8_t *src[4], int w, int
 }
 }
 }
+return 0;
 }
-- 
2.18.0

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


Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8

2018-08-26 Thread Helmut K. C. Tessarek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 2018-08-25 17:15, Michael Niedermayer wrote:
> patches 1-3 work here fine on linux x86-64 / 32, arm, mips,
> wine+mingw32/64

Any chance you (or anyone who's commit access to the repo) could
commit these 3 patches asap?

Cheers,
  K. C.

- -- 
regards Helmut K. C. Tessarek  KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAluDKzIACgkQvgmFNJ1E
3QDy3w//Xy2DQFyT5aQvFhadc+bmnuxMqYMIQy625rPbttPIid1q+oxUGTJPmtTu
tNA8vP+mf11wUMbY4RFH94Te1ClRtYTiCoZgWSGm3gcHemiM2VfCE2SYuj1pAW/M
BxJPmVK7pIy58dvX5DsyiRqLNA89OeV1eHsGfdJ+hpZ90OgvQtsatfj91SJO/Yfe
DoStKl6LrvfcgAR2Y3mSCbWfBpnU8SwmMGra4YuN0OZH9TZDX1vtI1Ok+D1JgtHC
H/64ha08C+56dwil55Zawugii8sAX24cwtxCLQ0CLgIdSFxHbIOiGZCBZFS0gIBL
8zV5GOONZEt0wXzFH1BWZvRra/mr828TEs3I/IbmFuXkAVpLLZpGcB9TTU6noScu
ZKtn005CM2CynjZvm+4cQrLxzzex9XhL5miD8pY9EigKnMixeGP7PftmoCFV8maq
uVlLfF1YEGAXLxW/br4PF6lA/QsSOkosqI8SxSBt/KzE12sgcE5cIWlqxUEBDsBd
P57XAM6qCWFQec2lzcczS6BWL9qtrgQsT4A0Rs+FTGRppnjY3MKFRDKF/5d8ml3W
R7jPfWlmPfR3XKPldivo3GTfNfny3u1HPidrDFjA5QW+0gheuVgyoSrVGjouj1H2
v0JKbDLp95Gg+GmolAyeXfHAqG2vK51/KwVwzUKEauDnxcPuDvE=
=5wNw
-END PGP SIGNATURE-
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8

2018-08-26 Thread Reino Wijnsma
On 26-8-2018 22:27, Dave Yeo  wrote:
> On 08/25/18 11:11 AM, avih wrote:
>> After the previous speedups, configure spent 20-60% of its runtime
>> at check_deps(). It's particularly slow with bash. After some local
>> optimizations - mainly avoid pushvar/popvar and abort early in one
>> notable case (empty deps), it's now x4-x25 faster.
>
> Works great on OS/2, from 700 seconds to 144 seconds
> Dave

I've gone from 857s to 268s on my old WinXP pc. That's really impressive!

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


Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8

2018-08-26 Thread Dave Yeo

On 08/25/18 11:11 AM, avih wrote:

After the previous speedups, configure spent 20-60% of its runtime
at check_deps(). It's particularly slow with bash. After some local
optimizations - mainly avoid pushvar/popvar and abort early in one
notable case (empty deps), it's now x4-x25 faster.


Works great on OS/2, from 700 seconds to 144 seconds
Dave
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/mxfdec: do not use sound essence descriptor quantization bits for bits_per_coded_sample

2018-08-26 Thread Marton Balint
It refers to the uncompressed quantization, therefore is not correct for AAC.

Also change mxf_set_pts to work based on current edit unit if
bits_per_coded_sample is not available.

Fixes error messages in the sample of ticket #7366.

Signed-off-by: Marton Balint 
---
 libavformat/mxfdec.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8e1089620f..134f27784b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2390,7 +2390,6 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 if (st->codecpar->codec_id == AV_CODEC_ID_NONE || 
(st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum 
AVCodecID)container_ul->id != AV_CODEC_ID_NONE))
 st->codecpar->codec_id = (enum AVCodecID)container_ul->id;
 st->codecpar->channels = descriptor->channels;
-st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;
 
 if (descriptor->sample_rate.den > 0) {
 st->codecpar->sample_rate = descriptor->sample_rate.num / 
descriptor->sample_rate.den;
@@ -2423,6 +2422,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {
 st->need_parsing = AVSTREAM_PARSE_FULL;
 }
+st->codecpar->bits_per_coded_sample = 
av_get_bits_per_sample(st->codecpar->codec_id);
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
 enum AVMediaType type;
 container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, 
essence_container_ul);
@@ -3269,7 +3269,8 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, 
AVStream *st, int64_t
 static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
  AVPacket *pkt)
 {
-MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
+AVStream *st = mxf->fc->streams[pkt->stream_index];
+MXFTrack *track = st->priv_data;
 int64_t bits_per_sample = par->bits_per_coded_sample;
 
 if (!bits_per_sample)
@@ -3280,8 +3281,10 @@ static int mxf_set_audio_pts(MXFContext *mxf, 
AVCodecParameters *par,
 if (   par->channels <= 0
 || bits_per_sample <= 0
 || par->channels * (int64_t)bits_per_sample < 8)
-return AVERROR(EINVAL);
-track->sample_count += pkt->size / (par->channels * 
(int64_t)bits_per_sample / 8);
+track->sample_count = mxf_compute_sample_count(mxf, st, 
av_rescale_q(track->sample_count, st->time_base, av_inv_q(track->edit_rate)) + 
1);
+else
+track->sample_count += pkt->size / (par->channels * 
(int64_t)bits_per_sample / 8);
+
 return 0;
 }
 
-- 
2.16.4

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


Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8

2018-08-26 Thread Helmut K. C. Tessarek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 2018-08-25 14:11, avih wrote:
> For overview see: 
> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
> 
> Attached is patch 3/3 which was at "main.patch" of that message.
> 
> After the previous speedups, configure spent 20-60% of its runtime 
> at check_deps(). It's particularly slow with bash. After some
> local optimizations - mainly avoid pushvar/popvar and abort early
> in one notable case (empty deps), it's now x4-x25 faster.

Patch 1-3 work fine on macOS. The configure time decreased by 75% on
my machine.

Awesome patch.

Cheers,
  K. C.

- -- 
regards Helmut K. C. Tessarek  KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAluDAdwACgkQvgmFNJ1E
3QAYLg//T1ftuIcO9t5jLRKYYSi9mHQau0y0LlsNqvPyGk0ht+Wu04WumtsS/K0z
aLAWTSX+vWShkwn/ncGCxZlrgUdXDfmc/y8jIGKXuHV/39ZhN5Y7CO11vNn/efdE
XjWlXsdpadtyqnwtWdrmOmvufiVNhVxXbLAHETnT6afFNRDVxKWl4JboiU3kNVUX
K7WTqvBBMqeSRIHhgRX/n40mNItp4vxk9WQGz8E+rcoipR5DIpokYb987aLzl0Y2
6gTFXY7HqCtY3oWJe70XuHY+/a/6z3Y6YD6i5o7QpYfyXJcbBz3PvzKJxdg/5W8S
Q92780We9H61wXxf5cpoobJJcEIZ3/HTXE7O5zEWKrLrmNbGwV4wecBoWWaoHa9V
5lMkmC5yrx2b2WKoLG6sYTgq9h1UYSi3bNHTvuGKZ36mmgGz2Tx89ctr5hteakEB
dreAmeLZGgI4g+PFjastnWGl9C+JmgUQwe0sTHNsKNqOyio0zQXgk+cpjuRNOx+X
USD6hYp9sn6A0d8vh1Pgw3FnbWp2yc5NDmkwRIl/39icH19WJUtgHZKd1x40SHyV
fPhLJKPaNmbdR4kSM/AMUUlVmthAD3nZyvPOdR/b94i/SsivRhWiiuk0L2lODOx0
mtNU8vJG1rcqLbNTQo0tkorH31CalzXnekInUrX5soeDZg8ywe8=
=6p2H
-END PGP SIGNATURE-
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] decklink: Add support for output of Active Format Description (AFD)

2018-08-26 Thread Marton Balint



On Wed, 22 Aug 2018, Devin Heitmueller wrote:


Implement support for including AFD in decklink output.  This
includes making sure the AFD data is preserved when going from
an AVFrame to a V210 packet (needed for 10-bit support).

Updated to reflect feedback from Marton Balint ,
Carl Eugen Hoyos  and Aaron Levinson
.

Signed-off-by: Devin Heitmueller 
---
libavcodec/avcodec.h |  6 +
libavcodec/v210enc.c |  8 +++
libavdevice/decklink_enc.cpp | 54 ++--
3 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 31e50d5a94..192e15746d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1362,6 +1362,12 @@ enum AVPacketSideDataType {
AV_PKT_DATA_ENCRYPTION_INFO,

/**
+ * Active Format Description data consisting of a single byte as specified
+ * in ETSI TS 101 154 using AVActiveFormatDescription enum.
+ */
+AV_PKT_DATA_AFD,
+
+/**
 * The number of side data types.
 * This is not part of the public API/ABI in the sense that it may
 * change when new side data types are added.


Such addition requires a libavcodec minor version bump and maybe an entry 
in doc/APIChanges.



diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index b9dcf9a672..b024806d0b 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -242,6 +242,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
memcpy(buf, side_data->data, side_data->size);
}

+side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_AFD);
+if (side_data && side_data->size) {
+uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_AFD, 
side_data->size);
+if (!buf)
+return AVERROR(ENOMEM);
+memcpy(buf, side_data->data, side_data->size);
+}
+
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;


A separate patch from decklink is preferred here as well for the API and 
v210enc addition.



diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index de7758cb91..2d03d33554 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -303,7 +303,8 @@ av_cold int ff_decklink_write_trailer(AVFormatContext 
*avctx)

#if CONFIG_LIBKLVANC
static int decklink_construct_vanc(AVFormatContext *avctx, struct decklink_ctx 
*ctx,
-   AVPacket *pkt, decklink_frame *frame)
+   AVPacket *pkt, decklink_frame *frame,
+   AVStream *st)
{
struct klvanc_line_set_s vanc_lines = { 0 };
int ret, size, i;
@@ -363,6 +364,55 @@ static int decklink_construct_vanc(AVFormatContext *avctx, 
struct decklink_ctx *
}
}

+data = av_packet_get_side_data(pkt, AV_PKT_DATA_AFD, &size);
+if (data) {


if (data && size)


+struct klvanc_packet_afd_s *pkt;


Maybe pkt is not the best name, can be confused with the AVPacket pkt...


+uint16_t *afd;
+uint16_t len;
+
+ret = klvanc_create_AFD(&pkt);
+if (ret) {
+for (i = 0; i < vanc_lines.num_lines; i++)
+klvanc_line_free(vanc_lines.lines[i]);
+return AVERROR(ENOMEM);


As I mentioned in the previous patch, replace these with something like:

ret = AVERROR(ENOMEM);
goto out;


+}
+
+ret = klvanc_set_AFD_val(pkt, data[0]);
+if (ret) {
+av_log(avctx, AV_LOG_ERROR, "Invalid AFD value specified: %d\n",
+   data[0]);
+klvanc_destroy_AFD(pkt);
+for (i = 0; i < vanc_lines.num_lines; i++)
+klvanc_line_free(vanc_lines.lines[i]);
+return AVERROR(EINVAL);


here


+}
+
+/* FIXME: Should really rely on the coded_width but seems like that
+   is not accessible to libavdevice outputs */
+if (av_cmp_q((AVRational) {st->codecpar->width, st->codecpar->height}, 
(AVRational) {4, 3}) == 1)
+pkt->aspectRatio = ASPECT_16x9;
+else
+pkt->aspectRatio = ASPECT_4x3;
+
+ret = klvanc_convert_AFD_to_words(pkt, &afd, &len);
+klvanc_destroy_AFD(pkt);
+if (ret) {
+av_log(avctx, AV_LOG_ERROR, "Failed converting AFD packet to 
words\n");
+for (i = 0; i < vanc_lines.num_lines; i++)
+klvanc_line_free(vanc_lines.lines[i]);
+return AVERROR(ENOMEM);


here


+}
+
+ret = klvanc_line_insert(ctx->vanc_ctx, &vanc_lines, afd, len, 12, 0);
+free(afd);
+if (ret) {
+av_log(avctx, AV_LOG_ERROR, "VANC line insertion failed\n");
+for (i = 0; i < vanc_lines.num_lines; i++)
+klvanc_line_free(vanc_lines.lines[i]);
+return AVERROR(ENOMEM);


and here.


+}
+}
+
IDeckLinkVideoFrameAncillary *vanc;
int result = ctx->dlo->CreateAncillaryData(bmdFormat10BitYUV, &vanc);
   

Re: [FFmpeg-devel] [PATCH 1/2] libavdevice/decklink: Add support for EIA-708 output over SDI

2018-08-26 Thread Marton Balint


On Wed, 22 Aug 2018, Devin Heitmueller wrote:


Hook in libklvanc and use it for output of EIA-708 captions over
SDI.  The bulk of this patch is just general support for ancillary
data for the Decklink SDI module - the real work for construction
of the EIA-708 CDP and VANC line construction is done by libklvanc.

Libklvanc can be found at: https://github.com/stoth68000/libklvanc

Updated to reflect feedback from Marton Balint ,
Carl Eugen Hoyos , Aaron Levinson
, and Moritz Barsnick 


Thanks, I have a few minor (mostly code style) comments below:



Signed-off-by: Devin Heitmueller 
---
configure   |   4 +
libavcodec/v210enc.c|   9 ++
libavdevice/decklink_common.cpp |  16 +++-
libavdevice/decklink_common.h   |  10 +++
libavdevice/decklink_enc.cpp| 179 ++--
5 files changed, 207 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 9b5421d5a8..ecc86c606f 100755
--- a/configure
+++ b/configure
@@ -239,6 +239,7 @@ External library support:
  --enable-libiec61883 enable iec61883 via libiec61883 [no]
  --enable-libilbc enable iLBC de/encoding via libilbc [no]
  --enable-libjack enable JACK audio sound server [no]
+  --enable-libklvanc   enable Kernel Labs VANC processing [no]
  --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
  --enable-liblensfun  enable lensfun lens correction [no]
  --enable-libmodplug  enable ModPlug via libmodplug [no]
@@ -1700,6 +1701,7 @@ EXTERNAL_LIBRARY_LIST="
libiec61883
libilbc
libjack
+libklvanc
libkvazaar
libmodplug
libmp3lame
@@ -3210,6 +3212,7 @@ decklink_deps_any="libdl LoadLibrary"
decklink_indev_deps="decklink threads"
decklink_indev_extralibs="-lstdc++"
decklink_outdev_deps="decklink threads"
+decklink_outdev_suggest="libklvanc"
decklink_outdev_extralibs="-lstdc++"
libndi_newtek_indev_deps="libndi_newtek"
libndi_newtek_indev_extralibs="-lndi"
@@ -6034,6 +6037,7 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
"gsm/gsm.h"; do
   check_lib libgsm "${gsm_hdr}" gsm_create -lgsm 
&& break;
   done || die "ERROR: libgsm not found"; }
enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
-lilbc $pthreads_extralibs
+enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 0.8.1" 
kvazaar.h kvz_api_get
enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_new
# While it may appear that require is being used as a pkg-config
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index a6afbbfc41..b9dcf9a672 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -123,6 +123,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
int aligned_width = ((avctx->width + 47) / 48) * 48;
int stride = aligned_width * 8 / 3;
int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
+AVFrameSideData *side_data;
int h, w, ret;
uint8_t *dst;

@@ -233,6 +234,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
}
}

+side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_A53_CC);
+if (side_data && side_data->size) {
+uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, 
side_data->size);
+if (!buf)
+return AVERROR(ENOMEM);
+memcpy(buf, side_data->data, side_data->size);
+}
+
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;


Strictly speaking the v210enc part should be separate patch.


diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index aab9d85b94..503417bb35 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -239,10 +239,18 @@ int ff_decklink_set_format(AVFormatContext *avctx,
   &support, NULL) != S_OK)
return -1;
} else {
-if (ctx->dlo->DoesSupportVideoMode(ctx->bmd_mode, bmdFormat8BitYUV,
-   bmdVideoOutputFlagDefault,
-   &support, NULL) != S_OK)
-return -1;
+if (!ctx->supports_vanc || ctx->dlo->DoesSupportVideoMode(ctx->bmd_mode, 
ctx->raw_format,
+  
bmdVideoOutputVANC,
+  &support, 
NULL) != S_OK) {
+/* Try without VANC enabled */
+if (ctx->dlo->DoesSupportVideoMode(ctx->bmd_mode, ctx->raw_format,
+   bmdVideoOutputFlagDefault,
+   &support, NULL) != S_OK) {
+return -1;
+}
+ctx->supports_vanc = 0;
+}
+
}
if (support == bmdDisp

[FFmpeg-devel] [PATCH] avcodec/wmv2dec: skip frames that have only skiped MBs

2018-08-26 Thread Michael Niedermayer
This requires us to pre-parse the skip data, as we want to
detect this before allocating all the arrays

Fixes: Timeout
Fixes: 
9708/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5729709861109760

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/wmv2dec.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index ea0e0594b5..4f97d9227c 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -141,6 +141,21 @@ int ff_wmv2_decode_picture_header(MpegEncContext *s)
 if (s->qscale <= 0)
 return AVERROR_INVALIDDATA;
 
+if (s->pict_type != AV_PICTURE_TYPE_I && show_bits(&s->gb, 1)) {
+GetBitContext gb = s->gb;
+int skip_type = get_bits(&gb, 2);
+int run = skip_type == SKIP_TYPE_COL ? s->mb_width : s->mb_height;
+
+while (run > 0) {
+int block = FFMIN(run, 25);
+if (get_bits(&gb, block) + 1 != 1

Re: [FFmpeg-devel] [PATCH] lavfi/avf_concat: switch to activate.

2018-08-26 Thread Nicolas George
Nicolas George (2018-08-22):
> > Fix trac ticket #7351.
> > 
> > Signed-off-by: Nicolas George 
> > ---
> >  libavfilter/avf_concat.c | 156 +++
> >  1 file changed, 78 insertions(+), 78 deletions(-)
> 
> Will push soon unless I forget.

Done.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 1/1] libavformat/mxfenc: add missing dnxhr mxf container essence ULs

2018-08-26 Thread jay
Baptiste you are right that DNxHR is variable frame size (0) from 
avpriv_dnxhd_get_frame_size and that it breaks the index.

is there a reason not to use the pkt->size as frame_size since DNxHR is a 
constant frame_size for a given resolution and quality profile?


-Original Message-
From: "Baptiste Coudurier" 
Sent: Saturday, August 25, 2018 11:35am
To: "FFmpeg development discussions and patches" 
Cc: "Jason Stevens" 
Subject: Re: [FFmpeg-devel] [PATCH 1/1] libavformat/mxfenc: add missing dnxhr 
mxf container essence ULs

On Sat, Aug 25, 2018 at 5:02 AM, Tomas Härdin  wrote:

> lör 2018-08-25 klockan 02:00 -0700 skrev j...@wizardofthenet.com:
> > > From: Jason Stevens 
> >
> > ---
> >  libavformat/mxfenc.c | 47 
> >  1 file changed, 47 insertions(+)
> >
> > diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> > index 7f629dbe53..cf58c8b834 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
> },
> > @@ -1998,6 +2028,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;
> >  default:
> >  return -1;
> >  }
>
> Don't have any idea about DNxHR, else the code looks OK enough.


I think DNxHR is variable frame size, and in the code frame_size will be 0
and that will cause issues in the index table later,
creating broken files.

-- 
Baptiste




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


Re: [FFmpeg-devel] [PATCH] avcodec/proresdec2: add frame threading support

2018-08-26 Thread Paul B Mahol
On 8/22/18, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/proresdec2.c | 18 --
>  1 file changed, 16 insertions(+), 2 deletions(-)
>

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