[FFmpeg-devel] [PATCH] doc/filters: Document geq *sum functions

2019-12-28 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/filters.texi | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 57330d1fd9..4d255d57c6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11374,6 +11374,10 @@ red/green/blue component. Return 0 if there is no such 
component.
 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
 plane. Return 0 if there is no such plane.
 
+@item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), 
bsum(x,y), alphasum(x,y)
+Sum of sample values in the rectangle from (0,0) to (x,y), this allows 
obtaining
+sums of samples within a rectangle. See the functions without the sum postfix.
+
 @item interpolation
 Set one of interpolation methods:
 @table @option
-- 
2.24.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] lavf/libsrt: add version guard for srt encryption control

2019-12-28 Thread Jun Zhao
From: Jun Zhao 

add version guard for srt encryption control.

Signed-off-by: Jun Zhao 
---
 libavformat/libsrt.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 2fdfe8e..f981ef1 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -62,9 +62,11 @@ typedef struct SRTContext {
 int64_t maxbw;
 int pbkeylen;
 char *passphrase;
+#if SRT_VERSION_VALUE >= 0x010302
 int enforced_encryption;
 int kmrefreshrate;
 int kmpreannounce;
+#endif
 int mss;
 int ffs;
 int ipttl;
@@ -105,9 +107,11 @@ static const AVOption libsrt_options[] = {
 { "maxbw",  "Maximum bandwidth (bytes per second) that the 
connection can use", OFFSET(maxbw),AV_OPT_TYPE_INT64,{ .i64 
= -1 }, -1, INT64_MAX, .flags = D|E },
 { "pbkeylen",   "Crypto key len in bytes {16,24,32} Default: 16 
(128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT,  { .i64 
= -1 }, -1, 32,.flags = D|E },
 { "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable 
crypto", OFFSET(passphrase),   AV_OPT_TYPE_STRING,   { .str = 
NULL },  .flags = D|E },
+#if SRT_VERSION_VALUE >= 0x010302
 { "enforced_encryption", "Enforces that both connection parties have the 
same passphrase set ", OFFSET(enforced_encryption), 
AV_OPT_TYPE_BOOL,  { .i64 = -1 }, -1, 1, .flags = D|E },
 { "kmrefreshrate",   "The number of packets to be transmitted after 
which the encryption key is switched to a new key", OFFSET(kmrefreshrate),  
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
 { "kmpreannounce",   "The interval between when a new encryption key 
is sent and when switchover occurs",   OFFSET(kmpreannounce),   
AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
+#endif
 { "mss","The Maximum Segment Size",
 OFFSET(mss),  AV_OPT_TYPE_INT,  { .i64 = -1 }, 
-1, 1500,  .flags = D|E },
 { "ffs","Flight flag size (window size) (in bytes)",   
 OFFSET(ffs),  AV_OPT_TYPE_INT,  { .i64 = -1 }, 
-1, INT_MAX,   .flags = D|E },
 { "ipttl",  "IP Time To Live", 
 OFFSET(ipttl),AV_OPT_TYPE_INT,  { .i64 = -1 }, 
-1, 255,   .flags = D|E },
@@ -327,9 +331,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
 (s->maxbw >= 0 && libsrt_setsockopt(h, fd, SRTO_MAXBW, "SRTO_MAXBW", 
&s->maxbw, sizeof(s->maxbw)) < 0) ||
 (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, 
"SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
 (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, 
"SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
+#if SRT_VERSION_VALUE >= 0x010302
 (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, 
SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, 
sizeof(s->enforced_encryption)) < 0) ||
 (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, 
"SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
 (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, 
"SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
+#endif
 (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MMS", 
&s->mss, sizeof(s->mss)) < 0) ||
 (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, 
sizeof(s->ffs)) < 0) ||
 (s->ipttl >= 0 && libsrt_setsockopt(h, fd, SRTO_IPTTL, "SRTO_UPTTL", 
&s->ipttl, sizeof(s->ipttl)) < 0) ||
-- 
1.7.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavf/libsrt: add version guard for srt encryption control

2019-12-28 Thread Marton Balint



On Sat, 28 Dec 2019, Jun Zhao wrote:


From: Jun Zhao 

add version guard for srt encryption control.


Ok, but the code will still fail in 1.3.2 because that version has no 
constant named SRTO_ENFORCEDENCRYPTION. So I suggest you use the original 
name for it, SRTO_STRICTENC.


Regards,
Marton



Signed-off-by: Jun Zhao 
---
libavformat/libsrt.c |6 ++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 2fdfe8e..f981ef1 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -62,9 +62,11 @@ typedef struct SRTContext {
int64_t maxbw;
int pbkeylen;
char *passphrase;
+#if SRT_VERSION_VALUE >= 0x010302
int enforced_encryption;
int kmrefreshrate;
int kmpreannounce;
+#endif
int mss;
int ffs;
int ipttl;
@@ -105,9 +107,11 @@ static const AVOption libsrt_options[] = {
{ "maxbw",  "Maximum bandwidth (bytes per second) that the connection 
can use", OFFSET(maxbw),AV_OPT_TYPE_INT64,{ .i64 = -1 }, -1, INT64_MAX, 
.flags = D|E },
{ "pbkeylen",   "Crypto key len in bytes {16,24,32} Default: 16 
(128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 32, 
   .flags = D|E },
{ "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable 
crypto", OFFSET(passphrase),   AV_OPT_TYPE_STRING,   { .str = NULL },  
.flags = D|E },
+#if SRT_VERSION_VALUE >= 0x010302
{ "enforced_encryption", "Enforces that both connection parties have the same 
passphrase set ", OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL,  
{ .i64 = -1 }, -1, 1, .flags = D|E },
{ "kmrefreshrate",   "The number of packets to be transmitted after which 
the encryption key is switched to a new key", OFFSET(kmrefreshrate),   AV_OPT_TYPE_INT,   
{ .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
{ "kmpreannounce",   "The interval between when a new encryption key is sent 
and when switchover occurs",   OFFSET(kmpreannounce),   AV_OPT_TYPE_INT,   { 
.i64 = -1 }, -1, INT_MAX,   .flags = D|E },
+#endif
{ "mss","The Maximum Segment Size", 
OFFSET(mss),  AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 1500,  
.flags = D|E },
{ "ffs","Flight flag size (window size) (in bytes)",
OFFSET(ffs),  AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, INT_MAX,   
.flags = D|E },
{ "ipttl",  "IP Time To Live",  
OFFSET(ipttl),AV_OPT_TYPE_INT,  { .i64 = -1 }, -1, 255,   
.flags = D|E },
@@ -327,9 +331,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
(s->maxbw >= 0 && libsrt_setsockopt(h, fd, SRTO_MAXBW, "SRTO_MAXBW", 
&s->maxbw, sizeof(s->maxbw)) < 0) ||
(s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", 
&s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
(s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", 
s->passphrase, strlen(s->passphrase)) < 0) ||
+#if SRT_VERSION_VALUE >= 0x010302
(s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, 
"SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
(s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, 
"SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
(s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, 
"SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
+#endif
(s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MMS", &s->mss, 
sizeof(s->mss)) < 0) ||
(s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, 
sizeof(s->ffs)) < 0) ||
(s->ipttl >= 0 && libsrt_setsockopt(h, fd, SRTO_IPTTL, "SRTO_UPTTL", 
&s->ipttl, sizeof(s->ipttl)) < 0) ||
--
1.7.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCHv2 8/8] avformat/img2enc: add support for specifying protocol options

2019-12-28 Thread Marton Balint
v2: simplified example

Signed-off-by: Marton Balint 
---
 doc/muxers.texi   | 11 +++
 libavformat/img2enc.c | 13 -
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index fb5c9bc4c0..470a11af95 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1193,6 +1193,11 @@ overwritten with new images. Default value is 0.
 @item strftime
 If set to 1, expand the filename with date and time information from
 @code{strftime()}. Default value is 0.
+
+@item protocol_opts @var{options_list}
+Set protocol options as a :-separated list of key=value parameters. Values
+containing the @code{:} special character must be escaped.
+
 @end table
 
 @subsection Examples
@@ -1235,6 +1240,12 @@ You can set the file name with current frame's PTS:
 ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg"
 @end example
 
+A more complex example is to publish contents of your desktop directly to a
+WebDAV server every second:
+@example
+ffmpeg -f x11grab -framerate 1 -i :0.0 -q:v 6 -update 1 -protocol_opts 
method=PUT http://example.com/desktop.jpg
+@end example
+
 @section matroska
 
 Matroska container muxer.
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 39398f37a3..0ad4ee11d7 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/dict.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -44,6 +45,7 @@ typedef struct VideoMuxData {
 int frame_pts;
 const char *muxer;
 int use_rename;
+AVDictionary *protocol_opts;
 } VideoMuxData;
 
 static int write_header(AVFormatContext *s)
@@ -133,6 +135,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(par->format);
 int ret, i;
 int nb_renames = 0;
+AVDictionary *options = NULL;
 
 if (img->update) {
 av_strlcpy(filename, img->path, sizeof(filename));
@@ -161,13 +164,19 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 return AVERROR(EINVAL);
 }
 for (i = 0; i < 4; i++) {
+av_dict_copy(&options, img->protocol_opts, 0);
 snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
 av_strlcpy(img->target[i], filename, sizeof(img->target[i]));
-if (s->io_open(s, &pb[i], img->use_rename ? img->tmp[i] : filename, 
AVIO_FLAG_WRITE, NULL) < 0) {
+if (s->io_open(s, &pb[i], img->use_rename ? img->tmp[i] : filename, 
AVIO_FLAG_WRITE, &options) < 0) {
 av_log(s, AV_LOG_ERROR, "Could not open file : %s\n", 
img->use_rename ? img->tmp[i] : filename);
 ret = AVERROR(EIO);
 goto fail;
 }
+if (options) {
+av_log(s, AV_LOG_ERROR, "Could not recognize some protocol 
options\n");
+ret = AVERROR(EINVAL);
+goto fail;
+}
 
 if (!img->split_planes || i+1 >= desc->nb_components)
 break;
@@ -211,6 +220,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 return 0;
 
 fail:
+av_dict_free(&options);
 for (i = 0; i < FF_ARRAY_ELEMS(pb); i++)
 if (pb[i])
 ff_format_io_close(s, &pb[i]);
@@ -236,6 +246,7 @@ static const AVOption muxoptions[] = {
 { "strftime", "use strftime for filename", OFFSET(use_strftime),  
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
 { "frame_pts","use current frame pts for filename", OFFSET(frame_pts), 
 AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
 { "atomic_writing", "write files atomically (using temporary files and 
renames)", OFFSET(use_rename), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
+{ "protocol_opts", "specify protocol options for the opened files", 
OFFSET(protocol_opts), AV_OPT_TYPE_DICT, {0}, 0, 0, ENC },
 { NULL },
 };
 
-- 
2.16.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avformat/ftp: Exit with error on ftp_open if file does not exist

2019-12-28 Thread Fotyev V.

Add a check for code 550 when requesting file size
---
 libavformat/ftp.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 97ad80d..64a5250 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -391,13 +391,17 @@ static int ftp_file_size(FTPContext *s)
 char command[CONTROL_BUFFER_SIZE];
 char *res = NULL;
 static const int size_codes[] = {213, 0};
+    int resp_code;

 snprintf(command, sizeof(command), "SIZE %s\r\n", s->path);
-    if (ftp_send_command(s, command, size_codes, &res) == 213 && res && 
strlen(res) > 4) {

+    resp_code = ftp_send_command(s, command, size_codes, &res);
+    if (resp_code == 213 && res && strlen(res) > 4) {
 s->filesize = strtoll(&res[4], NULL, 10);
 } else {
 s->filesize = -1;
 av_free(res);
+    if (resp_code == 550)
+    return AVERROR(ENOENT);
 return AVERROR(EIO);
 }

@@ -723,10 +727,13 @@ static int ftp_open(URLContext *h, const char 
*url, int flags)

 if ((err = ftp_connect(h, url)) < 0)
 goto fail;

+    if ((err = ftp_file_size(s)) == AVERROR(ENOENT))
+    goto fail;
+
 if (ftp_restart(s, 0) < 0) {
 h->is_streamed = 1;
 } else {
-    if (ftp_file_size(s) < 0 && flags & AVIO_FLAG_READ)
+    if (err < 0 && flags & AVIO_FLAG_READ)
 h->is_streamed = 1;
 if (s->write_seekable != 1 && flags & AVIO_FLAG_WRITE)
 h->is_streamed = 1;
--
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/5] avcodec/atrac9dec: Clamp band_ext_data to max that can be read if skipped.

2019-12-28 Thread Lynne
Dec 27, 2019, 21:35 by mich...@niedermayer.cc:

> On Thu, Dec 26, 2019 at 05:24:31PM +0100, Lynne wrote:
>
>> Dec 26, 2019, 13:57 by d...@lynne.ee:
>>
>> > Dec 16, 2019, 23:19 by mich...@niedermayer.cc:
>> >
>> >> Fixes: out of array read
>> >> Fixes: 
>> >> 19327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5679823087468544
>> >>
>> >> Found-by: continuous fuzzing process 
>> >> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> >> Signed-off-by: Michael Niedermayer  
>> >>
>>
>> Actually nevermind, patch is good as-is. I think a 0 len just means to reuse 
>> the parameters from the previous. So clipping them should be fine.
>> You should replace the FFMIN(val, (len << 1) - 1) with a av_clip_uintp2(val, 
>> len) which does exactly that.
>>
>
> i think both the FFMIN and av_clip_uintp2 do the same thing here, unless
> iam missing something. But i agree
> The later is a bit prettier, and as you prefer it too, ill change it and will 
> apply with that
>

Why did you use av_clip_uintp2_c() instead of av_clip_uintp2()?

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4] avfilter/buffersrc: deprecate sws_param option

2019-12-28 Thread zhilizhao
Hi Nicolas,

> On Dec 23, 2019, at 8:23 PM, Nicolas George  wrote:
> 
> myp...@gmail.com (12019-12-12):
>> LGTM, but  need to wait next release cycle?
> 
> What do you mean? There is all the necessary code to let the option
> disappear automatically at the next release.
> 
> I shall push soon, unless you point something I have missed.

Could you help apply the patch?

> 
> Regards,
> 
> -- 
>  Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/5] avcodec/atrac9dec: Clamp band_ext_data to max that can be read if skipped.

2019-12-28 Thread Michael Niedermayer
On Sat, Dec 28, 2019 at 02:03:37PM +0100, Lynne wrote:
> Dec 27, 2019, 21:35 by mich...@niedermayer.cc:
> 
> > On Thu, Dec 26, 2019 at 05:24:31PM +0100, Lynne wrote:
> >
> >> Dec 26, 2019, 13:57 by d...@lynne.ee:
> >>
> >> > Dec 16, 2019, 23:19 by mich...@niedermayer.cc:
> >> >
> >> >> Fixes: out of array read
> >> >> Fixes: 
> >> >> 19327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5679823087468544
> >> >>
> >> >> Found-by: continuous fuzzing process 
> >> >> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> >> Signed-off-by: Michael Niedermayer  
> >> >>
> >>
> >> Actually nevermind, patch is good as-is. I think a 0 len just means to 
> >> reuse the parameters from the previous. So clipping them should be fine.
> >> You should replace the FFMIN(val, (len << 1) - 1) with a 
> >> av_clip_uintp2(val, len) which does exactly that.
> >>
> >
> > i think both the FFMIN and av_clip_uintp2 do the same thing here, unless
> > iam missing something. But i agree
> > The later is a bit prettier, and as you prefer it too, ill change it and 
> > will apply with that
> >
> 
> Why did you use av_clip_uintp2_c() instead of av_clip_uintp2()?

Because len is not a constant, av_clip_uintp2() only works with constants
(it will fail to build even on ARM for example if av_clip_uintp2() is used)

Thx

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avformat/ftp: Exit with error on ftp_open if file does not exist

2019-12-28 Thread Michael Niedermayer
On Sat, Dec 28, 2019 at 01:52:04PM +0300, Fotyev V. wrote:
> Add a check for code 550 when requesting file size
> ---
>  libavformat/ftp.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/ftp.c b/libavformat/ftp.c
> index 97ad80d..64a5250 100644
> --- a/libavformat/ftp.c
> +++ b/libavformat/ftp.c
> @@ -391,13 +391,17 @@ static int ftp_file_size(FTPContext *s)
>  char command[CONTROL_BUFFER_SIZE];
>  char *res = NULL;
>  static const int size_codes[] = {213, 0};
> +    int resp_code;
> 
>  snprintf(command, sizeof(command), "SIZE %s\r\n", s->path);
> -    if (ftp_send_command(s, command, size_codes, &res) == 213 && res &&
> strlen(res) > 4) {
> +    resp_code = ftp_send_command(s, command, size_codes, &res);

patch is corrupted by newlines

[...]

thx
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] lavc/qsvdec: fix the error retrun code in ff_qsv_get_continuous_buffer()

2019-12-28 Thread Zhong Li
Signed-off-by: Zhong Li 
---
 libavcodec/qsvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 0d34021b42..baaf1f205f 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -74,7 +74,7 @@ static int ff_qsv_get_continuous_buffer(AVCodecContext 
*avctx, AVFrame *frame, A
 break;
 default:
 av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format.\n");
-return AVERROR(ENOMEM);
+return AVERROR(EINVAL);
 }
 
 frame->linesize[1] = frame->linesize[0];
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] lavc/qsvdec: disable gpu copy when not supported

2019-12-28 Thread Zhong Li
Signed-off-by: Zhong Li 
---
 libavcodec/qsvdec.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index baaf1f205f..fc25dc73e5 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -99,9 +99,11 @@ static int qsv_init_session(AVCodecContext *avctx, 
QSVContext *q, mfxSession ses
 int ret;
 
 if (q->gpu_copy == MFX_GPUCOPY_ON &&
-!(q->iopattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY))
+!(q->iopattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY)) {
 av_log(avctx, AV_LOG_WARNING, "GPU-accelerated memory copy "
-"only works in MFX_IOPATTERN_OUT_SYSTEM_MEMORY.\n");
+"only works in system memory mode.\n");
+q->gpu_copy = MFX_GPUCOPY_OFF;
+}
 if (session) {
 q->session = session;
 } else if (hw_frames_ref) {
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4] avfilter/buffersrc: deprecate sws_param option

2019-12-28 Thread Nicolas George
zhilizhao (12019-12-28):
> Could you help apply the patch?

Since mypopy does not explain themselves, I will apply. But the patch
needs to be rebased and conflicts resolved.

Regards,

-- 
  Nicolas George


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/3] avfilter/vf_geq: fix multiple assignments of ptr in slice_geq_filter

2019-12-28 Thread Marton Balint
Fixes Coverity CID 1427183.

Signed-off-by: Marton Balint 
---
 libavfilter/vf_geq.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index 417b9d..00f02b6ebf 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -375,8 +375,6 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 const int slice_start = (height *  jobnr) / nb_jobs;
 const int slice_end = (height * (jobnr+1)) / nb_jobs;
 int x, y;
-uint8_t *ptr;
-uint16_t *ptr16;
 AVExprState *state = av_expr_state_alloc();
 
 double values[VAR_VARS_NB];
@@ -391,8 +389,8 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 return AVERROR(ENOMEM);
 
 if (geq->bps == 8) {
+uint8_t *ptr = geq->dst + linesize * slice_start;
 for (y = slice_start; y < slice_end; y++) {
-ptr = geq->dst + linesize * y;
 values[VAR_Y] = y;
 
 for (x = 0; x < width; x++) {
@@ -401,15 +399,15 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 }
 ptr += linesize;
 }
-}
-else {
+} else {
+uint16_t *ptr16 = geq->dst16 + (linesize/2) * slice_start;
 for (y = slice_start; y < slice_end; y++) {
-ptr16 = geq->dst16 + (linesize/2) * y;
 values[VAR_Y] = y;
 for (x = 0; x < width; x++) {
 values[VAR_X] = x;
 ptr16[x] = av_expr_eval2(geq->e[plane], state, values, geq);
 }
+ptr16 += linesize/2;
 }
 }
 av_expr_state_free(&state);
-- 
2.16.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] avfilter/vf_geq: use per-thread state for expression evaluation

2019-12-28 Thread Marton Balint
Fixes ticket #7528.

Signed-off-by: Marton Balint 
---
 libavfilter/vf_geq.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index 2905efae24..417b9d 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -377,6 +377,7 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 int x, y;
 uint8_t *ptr;
 uint16_t *ptr16;
+AVExprState *state = av_expr_state_alloc();
 
 double values[VAR_VARS_NB];
 values[VAR_W] = geq->values[VAR_W];
@@ -386,6 +387,9 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 values[VAR_SH] = geq->values[VAR_SH];
 values[VAR_T] = geq->values[VAR_T];
 
+if (!state)
+return AVERROR(ENOMEM);
+
 if (geq->bps == 8) {
 for (y = slice_start; y < slice_end; y++) {
 ptr = geq->dst + linesize * y;
@@ -393,7 +397,7 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 
 for (x = 0; x < width; x++) {
 values[VAR_X] = x;
-ptr[x] = av_expr_eval(geq->e[plane], values, geq);
+ptr[x] = av_expr_eval2(geq->e[plane], state, values, geq);
 }
 ptr += linesize;
 }
@@ -404,10 +408,11 @@ static int slice_geq_filter(AVFilterContext *ctx, void 
*arg, int jobnr, int nb_j
 values[VAR_Y] = y;
 for (x = 0; x < width; x++) {
 values[VAR_X] = x;
-ptr16[x] = av_expr_eval(geq->e[plane], values, geq);
+ptr16[x] = av_expr_eval2(geq->e[plane], state, values, geq);
 }
 }
 }
+av_expr_state_free(&state);
 
 return 0;
 }
-- 
2.16.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] avutil/eval: separate AVExpr state to a new AVExprState struct

2019-12-28 Thread Marton Balint
Also add helper functions to allocate and free such a struct, and make it
usable by providing a new av_eval_expr2 function for which you can specify a
custom AVExprState.

Signed-off-by: Marton Balint 
---
 doc/APIchanges  |  3 +++
 libavutil/eval.c| 31 +--
 libavutil/eval.h| 27 +++
 libavutil/version.h |  2 +-
 4 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 3c24dc6fbc..e4ad364ed9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2020-01-xx - xx - lavu 56.39.100 - eval.h
+  Add av_expr_eval2, av_expr_state_alloc, av_expr_state_free
+
 2019-12-27 - xx - lavu 56.38.100 - eval.h
   Add av_expr_count_func().
 
diff --git a/libavutil/eval.c b/libavutil/eval.c
index d527f6a9d0..86fb634fd8 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -173,7 +173,11 @@ struct AVExpr {
 double (*func2)(void *, double, double);
 } a;
 struct AVExpr *param[3];
-double *var;
+AVExprState *state;
+};
+
+struct AVExprState {
+double vars[VARS];
 };
 
 static double etime(double v)
@@ -333,13 +337,23 @@ static double eval_expr(Parser *p, AVExpr *e)
 
 static int parse_expr(AVExpr **e, Parser *p);
 
+AVExprState *av_expr_state_alloc(void)
+{
+return av_mallocz(sizeof(AVExprState));
+}
+
+void av_expr_state_free(AVExprState **ps)
+{
+av_freep(ps);
+}
+
 void av_expr_free(AVExpr *e)
 {
 if (!e) return;
 av_expr_free(e->param[0]);
 av_expr_free(e->param[1]);
 av_expr_free(e->param[2]);
-av_freep(&e->var);
+av_expr_state_free(&e->state);
 av_freep(&e);
 }
 
@@ -724,8 +738,8 @@ int av_expr_parse(AVExpr **expr, const char *s,
 ret = AVERROR(EINVAL);
 goto end;
 }
-e->var= av_mallocz(sizeof(double) *VARS);
-if (!e->var) {
+e->state = av_expr_state_alloc();
+if (!e->state) {
 ret = AVERROR(ENOMEM);
 goto end;
 }
@@ -763,16 +777,21 @@ int av_expr_count_func(AVExpr *e, unsigned *counter, int 
size, int arg)
 return expr_count(e, counter, size, ((int[]){e_const, e_func1, 
e_func2})[arg]);
 }
 
-double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
+double av_expr_eval2(AVExpr *e, AVExprState *s, const double *const_values, 
void *opaque)
 {
 Parser p = { 0 };
-p.var= e->var;
+p.var = s ? s->vars : e->state->vars;
 
 p.const_values = const_values;
 p.opaque = opaque;
 return eval_expr(&p, e);
 }
 
+double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
+{
+return av_expr_eval2(e, NULL, const_values, opaque);
+}
+
 int av_expr_parse_and_eval(double *d, const char *s,
const char * const *const_names, const double 
*const_values,
const char * const *func1_names, double (* const 
*funcs1)(void *, double),
diff --git a/libavutil/eval.h b/libavutil/eval.h
index 068c62cdab..8bd1592f6c 100644
--- a/libavutil/eval.h
+++ b/libavutil/eval.h
@@ -29,6 +29,7 @@
 #include "avutil.h"
 
 typedef struct AVExpr AVExpr;
+typedef struct AVExprState AVExprState;
 
 /**
  * Parse and evaluate an expression.
@@ -86,6 +87,22 @@ int av_expr_parse(AVExpr **expr, const char *s,
  */
 double av_expr_eval(AVExpr *e, const double *const_values, void *opaque);
 
+/**
+ * Evaluate a previously parsed expression using a custom state.
+ *
+ * Some expressions can use stateful functions, like random(), st() and ld().
+ * With this function you can provide your own state to the evaluator instead
+ * of using the internal state of the AVExpr. This makes it possible to use the
+ * same AVExpr in multiple threads each with their own AVExprState avoiding
+ * unprotected concurrent access of the internal AVExpr state.
+ *
+ * @param s the state of the expression, if NULL, the internal state of AVExpr 
will be used
+ * @param const_values a zero terminated array of values for the identifiers 
from av_expr_parse() const_names
+ * @param opaque a pointer which will be passed to all functions from funcs1 
and funcs2
+ * @return the value of the expression
+ */
+double av_expr_eval2(AVExpr *e, AVExprState *s, const double *const_values, 
void *opaque);
+
 /**
  * Track the presence of variables and their number of occurrences in a parsed 
expression
  *
@@ -134,4 +151,14 @@ void av_expr_free(AVExpr *e);
  */
 double av_strtod(const char *numstr, char **tail);
 
+/**
+ * Allocate a new AVExprState struct
+ */
+AVExprState *av_expr_state_alloc(void);
+
+/**
+ * Free an allocated AVExprState struct and set its pointer to NULL
+ */
+void av_expr_state_free(AVExprState **ps);
+
 #endif /* AVUTIL_EVAL_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index af8f614aff..2bc1b98615 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_M

Re: [FFmpeg-devel] [PATCH] avformat/ftp: Exit with error on ftp_open if file does not exist

2019-12-28 Thread Fotyev V.

See attached

On 2019-12-28 17:17, Michael Niedermayer wrote:

On Sat, Dec 28, 2019 at 01:52:04PM +0300, Fotyev V. wrote:

Add a check for code 550 when requesting file size
---
  libavformat/ftp.c | 11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 97ad80d..64a5250 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -391,13 +391,17 @@ static int ftp_file_size(FTPContext *s)
  char command[CONTROL_BUFFER_SIZE];
  char *res = NULL;
  static const int size_codes[] = {213, 0};
+    int resp_code;

  snprintf(command, sizeof(command), "SIZE %s\r\n", s->path);
-    if (ftp_send_command(s, command, size_codes, &res) == 213 && res &&
strlen(res) > 4) {
+    resp_code = ftp_send_command(s, command, size_codes, &res);

patch is corrupted by newlines

[...]

thx

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
From 46108143e535962dd2d65398e7f794cbeb3e9cd7 Mon Sep 17 00:00:00 2001
From: ftk 
Date: Sat, 28 Dec 2019 13:40:52 +0300
Subject: [PATCH] libavformat: ftp: Exit with error on ftp_open if file does
 not exist

Add a check for code 550 when requesting file size
---
 libavformat/ftp.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 97ad80d..64a5250 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -391,13 +391,17 @@ static int ftp_file_size(FTPContext *s)
 char command[CONTROL_BUFFER_SIZE];
 char *res = NULL;
 static const int size_codes[] = {213, 0};
+int resp_code;
 
 snprintf(command, sizeof(command), "SIZE %s\r\n", s->path);
-if (ftp_send_command(s, command, size_codes, &res) == 213 && res && 
strlen(res) > 4) {
+resp_code = ftp_send_command(s, command, size_codes, &res);
+if (resp_code == 213 && res && strlen(res) > 4) {
 s->filesize = strtoll(&res[4], NULL, 10);
 } else {
 s->filesize = -1;
 av_free(res);
+if (resp_code == 550)
+return AVERROR(ENOENT);
 return AVERROR(EIO);
 }
 
@@ -723,10 +727,13 @@ static int ftp_open(URLContext *h, const char *url, int 
flags)
 if ((err = ftp_connect(h, url)) < 0)
 goto fail;
 
+if ((err = ftp_file_size(s)) == AVERROR(ENOENT))
+goto fail;
+
 if (ftp_restart(s, 0) < 0) {
 h->is_streamed = 1;
 } else {
-if (ftp_file_size(s) < 0 && flags & AVIO_FLAG_READ)
+if (err < 0 && flags & AVIO_FLAG_READ)
 h->is_streamed = 1;
 if (s->write_seekable != 1 && flags & AVIO_FLAG_WRITE)
 h->is_streamed = 1;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] lavc/qsv: remove the unused funtion ff_qsv_profile_to_mfx()

2019-12-28 Thread Zhong Li
Signed-off-by: Zhong Li 
---
 libavcodec/qsv.c  | 52 ---
 libavcodec/qsv_internal.h |  1 -
 2 files changed, 53 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index b00e427435..db98c75073 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -72,58 +72,6 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
 return AVERROR(ENOSYS);
 }
 
-
-static const struct {
-enum AVCodecID codec_id;
-int codec_profile;
-int mfx_profile;
-} qsv_profile_map[] = {
-#define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v }
-MAP(MPEG2VIDEO,  MPEG2_SIMPLE,MPEG2_SIMPLE ),
-MAP(MPEG2VIDEO,  MPEG2_MAIN,  MPEG2_MAIN   ),
-MAP(MPEG2VIDEO,  MPEG2_HIGH,  MPEG2_HIGH   ),
-
-MAP(H264,H264_BASELINE,   AVC_BASELINE ),
-MAP(H264,H264_CONSTRAINED_BASELINE, AVC_BASELINE),
-#if QSV_VERSION_ATLEAST(1, 3)
-MAP(H264,H264_EXTENDED,   AVC_EXTENDED ),
-#endif
-MAP(H264,H264_MAIN,   AVC_MAIN ),
-MAP(H264,H264_HIGH,   AVC_HIGH ),
-MAP(H264,H264_HIGH_422,   AVC_HIGH_422 ),
-
-#if QSV_VERSION_ATLEAST(1, 8)
-MAP(HEVC,HEVC_MAIN,   HEVC_MAIN),
-MAP(HEVC,HEVC_MAIN_10,HEVC_MAIN10  ),
-MAP(HEVC,HEVC_MAIN_STILL_PICTURE,HEVC_MAINSP ),
-#endif
-#if QSV_VERSION_ATLEAST(1, 16)
-MAP(HEVC,HEVC_REXT,   HEVC_REXT),
-#endif
-
-MAP(VC1, VC1_SIMPLE,  VC1_SIMPLE   ),
-MAP(VC1, VC1_MAIN,VC1_MAIN ),
-MAP(VC1, VC1_COMPLEX, VC1_ADVANCED ),
-MAP(VC1, VC1_ADVANCED,VC1_ADVANCED ),
-#undef MAP
-};
-
-int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile)
-{
-int i;
-if (profile == FF_PROFILE_UNKNOWN)
-return MFX_PROFILE_UNKNOWN;
-
-for (i = 0; i < FF_ARRAY_ELEMS(qsv_profile_map); i++) {
-if (qsv_profile_map[i].codec_id != codec_id)
-continue;
-if (qsv_profile_map[i].codec_profile == profile)
-return qsv_profile_map[i].mfx_profile;
-}
-
-return MFX_PROFILE_UNKNOWN;
-}
-
 int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level)
 {
 if (level == FF_LEVEL_UNKNOWN)
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 37559270e5..6489836a67 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -116,7 +116,6 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err,
  const char *warning_string);
 
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
-int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile);
 int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level);
 
 enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc);
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] tools/target_dec_fuzzer: Stop negative block_align and sampling rate

2019-12-28 Thread Michael Niedermayer
These are checked for early in avcodec_open2() and do not really test the 
decoder
but instead waste resources which could be better spend fuzzing the actual 
decoder

Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index c232f6d41a..2d9d28b46d 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -206,9 +206,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 
 extradata_size = bytestream2_get_le32(&gbc);
 
-ctx->sample_rate= bytestream2_get_le32(&gbc);
+ctx->sample_rate= bytestream2_get_le32(&gbc) & 
0x7FFF;
 ctx->channels   = 
(unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
-ctx->block_align= bytestream2_get_le32(&gbc);
+ctx->block_align= bytestream2_get_le32(&gbc) & 
0x7FFF;
 ctx->codec_tag  = bytestream2_get_le32(&gbc);
 keyframes   = bytestream2_get_le64(&gbc);
 ctx->request_channel_layout = bytestream2_get_le64(&gbc);
-- 
2.24.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: List valid codec tags (based on fate)

2019-12-28 Thread Michael Niedermayer
I am a bit undecided on listing them like this but it seems the
fuzzer has difficulty finding valid tags (like in hapdec/snappy)

With this it finds issues in hapdec within seconds locally (with constrained 
w/h)
while before on googles machienes it seemed not to get past the codec_tag
switch at all on the days i checked

Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 40 ++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 2d9d28b46d..03ff45a0f4 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -57,6 +57,43 @@
 //For FF_SANE_NB_CHANNELS, so we dont waste energy testing things that will 
get instantly rejected
 #include "libavcodec/internal.h"
 
+unsigned codec_tags[] = {
+ 0x, 0x0001, 0x0002, 0x0003, 0x0004, 0x0006, 
0x0007, 0x000A,
+ 0x000F, 0x0011, 0x0017, 0x001B, 0x0020, 0x0022, 
0x0024, 0x0031,
+ 0x0045, 0x0050, 0x0055, 0x0061, 0x0062, 0x0065, 
0x0069, 0x007C,
+ 0x0081, 0x0082, 0x0100, 0x0160, 0x0161, 0x0162, 
0x0163, 0x0200,
+ 0x0270, 0x028F, 0x0401, 0x0500, 0x2000, 0xA109, 
0x0200736D, 0x08505350,
+ 0x0F424752, 0x10424752, 0x10445350, 0x10445550, 0x10505350, 0x10544942, 
0x1100736D, 0x18424752,
+ 0x18445550, 0x18505350, 0x18524742, 0x2033504D, 0x20335056, 0x20445550, 
0x20455041, 0x204D4250,
+ 0x20505350, 0x20545344, 0x20636D73, 0x20637664, 0x20656C72, 0x20776172, 
0x302E3151, 0x30303859,
+ 0x30313272, 0x30313276, 0x30313476, 0x30315652, 0x30323449, 0x30324C4D, 
0x30324D54, 0x30325254,
+ 0x30325652, 0x30335652, 0x30345056, 0x30345652, 0x30355056, 0x30355649, 
0x30375056, 0x30385056,
+ 0x30395056, 0x30484C55, 0x30573142, 0x30594C55, 0x312D6376, 0x31325452, 
0x31335056, 0x31345649,
+ 0x31363248, 0x31474E50, 0x31515653, 0x31524356, 0x31535046, 0x3153534D, 
0x31564256, 0x31564646,
+ 0x3156474B, 0x31564D57, 0x31564E57, 0x31565053, 0x31565341, 0x31573042, 
0x31637661, 0x31637668,
+ 0x31706148, 0x31766568, 0x32335649, 0x32336E69, 0x3234504D, 0x32484C55, 
0x324B4D53, 0x324D3247,
+ 0x324D4451, 0x32514853, 0x32524356, 0x32525541, 0x3253534D, 0x3253544D, 
0x32564D57, 0x32565341,
+ 0x32594C55, 0x32595559, 0x32637374, 0x3267706D, 0x32706A6D, 0x332D6365, 
0x3334504D, 0x33363248,
+ 0x3343414D, 0x33445844, 0x334D3247, 0x33515653, 0x33564D57, 0x33637661, 
0x34326E69, 0x34355053,
+ 0x34363248, 0x3447504D, 0x34484C55, 0x344D3247, 0x34504D46, 0x34616D69, 
0x34767579, 0x3535354C,
+ 0x3536354C, 0x35706148, 0x3643414D, 0x38303376, 0x38303476, 0x385F3832, 
0x39565559, 0x3A44534C,
+ 0x41365056, 0x41424752, 0x414B4D53, 0x41524742, 0x41524C55, 0x41525541, 
0x41706148, 0x42313459,
+ 0x42323459, 0x42494C5A, 0x43414658, 0x43435349, 0x43435352, 0x434C4C43, 
0x43534141, 0x43534454,
+ 0x43564D46, 0x43564D4B, 0x4356534D, 0x43565543, 0x44435343, 0x44484643, 
0x44495658, 0x44535342,
+ 0x454C4256, 0x454D414C, 0x454E4F4E, 0x4649464A, 0x46564D41, 0x47423432, 
0x474E504D, 0x47504A4C,
+ 0x47504A4D, 0x47504A52, 0x47524C55, 0x48564646, 0x485A534D, 0x49445844, 
0x49544C55, 0x49555641,
+ 0x4A63706C, 0x4B435544, 0x4C584956, 0x4D415243, 0x4D424C49, 0x4D435041, 
0x4D706148, 0x4F43455A,
+ 0x4F434F4C, 0x50303434, 0x50313459, 0x50343434, 0x50444147, 0x50444152, 
0x50535010, 0x50554410,
+ 0x50554418, 0x50554420, 0x524A4C43, 0x5347414C, 0x534C4A4D, 0x53504238, 
0x55575246, 0x55594648,
+ 0x56424D5A, 0x56434946, 0x574D5632, 0x574F4E53, 0x58514843, 0x58565338, 
0x5947414D, 0x59706148,
+ 0x6134706D, 0x617A7072, 0x624B4942, 0x62706A6D, 0x62776173, 0x63616C61, 
0x63617264, 0x63637374,
+ 0x636E4D56, 0x64697663, 0x646F6369, 0x64756164, 0x664B4942, 0x67337874, 
0x68347061, 0x68637061,
+ 0x68645641, 0x694B4942, 0x6B6F6F63, 0x6D63706C, 0x6D736761, 0x6E617858, 
0x6E637061, 0x6E645641,
+ 0x6F56736D, 0x6F637061, 0x726D6173, 0x726F7478, 0x72706973, 0x73637061, 
0x736F7774, 0x7375704F,
+ 0x74656E64, 0x746C7870, 0x74776F73, 0x76323130, 0x7634706D, 0x76757963, 
0x77616C61, 0x77616C75,
+ 0x77726471, 0x,
+};
+
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
 
 extern AVCodec * codec_list[];
@@ -209,7 +246,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 ctx->sample_rate= bytestream2_get_le32(&gbc) & 
0x7FFF;
 ctx->channels   = 
(unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
 ctx->block_align= bytestream2_get_le32(&gbc) & 
0x7FFF;
-ctx->codec_tag  = bytestream2_get_le32(&gbc);
+ctx->codec_tag  = 
codec_tags[bytestream2_get_le32(&gbc) % FF_ARRAY_ELEMS(codec_tags)];
+
 keyframes   = bytestream2_get_le64(&gbc);
 ctx->request_channel_layout = bytestream2_get_le64(&gbc);
 
-- 
2.24.0

___

[FFmpeg-devel] [PATCH 3/3] avcodec/libx265: export encoded frame stats

2019-12-28 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/libx265.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 581732d169..68eba17fca 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -416,6 +416,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 x265_picture x265pic_out = { 0 };
 x265_nal *nal;
 uint8_t *dst;
+int pict_type;
 int payload = 0;
 int nnal;
 int ret;
@@ -475,20 +476,23 @@ static int libx265_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 pkt->pts = x265pic_out.pts;
 pkt->dts = x265pic_out.dts;
 
-#if FF_API_CODED_FRAME
-FF_DISABLE_DEPRECATION_WARNINGS
 switch (x265pic_out.sliceType) {
 case X265_TYPE_IDR:
 case X265_TYPE_I:
-avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+pict_type = AV_PICTURE_TYPE_I;
 break;
 case X265_TYPE_P:
-avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
+pict_type = AV_PICTURE_TYPE_P;
 break;
 case X265_TYPE_B:
-avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B;
+case X265_TYPE_BREF:
+pict_type = AV_PICTURE_TYPE_B;
 break;
 }
+
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
@@ -499,6 +503,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
 
+ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * 
FF_QP2LAMBDA, NULL, 0, pict_type);
+
 *got_packet = 1;
 return 0;
 }
-- 
2.24.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] avcodec/libx265: apply some global AVCodecContext settings to the encoder context

2019-12-28 Thread James Almer
There's no reason to ignore them if set.

Signed-off-by: James Almer 
---
 doc/encoders.texi| 14 ++
 libavcodec/libx265.c | 13 +
 2 files changed, 27 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index a207363650..673eaf6496 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2415,6 +2415,20 @@ during configuration. You need to explicitly configure 
the build with
 @subsection Options
 
 @table @option
+@item b
+Sets target video bitrate.
+
+@item bf
+
+@item g
+Set the GOP size.
+
+@item keyint_min
+Minimum GOP size.
+
+@item refs
+Number of reference frames each P-frame can use. The range is from @var{1-16}.
+
 @item preset
 Set the x265 preset.
 
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 963c28fb1d..508fade98b 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -241,6 +241,15 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
 ctx->params->bRepeatHeaders = 1;
 
+if (avctx->gop_size >= 0)
+ctx->params->keyframeMax = avctx->gop_size;
+if (avctx->keyint_min > 0)
+ctx->params->keyframeMin = avctx->keyint_min;
+if (avctx->max_b_frames >= 0)
+ctx->params->bframes = avctx->max_b_frames;
+if (avctx->refs >= 0)
+ctx->params->maxNumReferences = avctx->refs;
+
 if (ctx->x265_opts) {
 AVDictionary *dict= NULL;
 AVDictionaryEntry *en = NULL;
@@ -556,6 +565,10 @@ static const AVClass class = {
 
 static const AVCodecDefault x265_defaults[] = {
 { "b", "0" },
+{ "bf", "-1" },
+{ "g", "-1" },
+{ "keyint_min", "-1" },
+{ "refs", "-1" },
 { NULL },
 };
 
-- 
2.24.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] avcodec/libx265: add a qp option and apply the relevant global AVCodecContext settings to the encoder context

2019-12-28 Thread James Almer
Signed-off-by: James Almer 
---
 doc/encoders.texi| 22 ++
 libavcodec/libx265.c | 28 
 2 files changed, 50 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 673eaf6496..61e674cf96 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2441,6 +2441,28 @@ Set profile restrictions.
 @item crf
 Set the quality for constant quality mode.
 
+@item qp
+Set constant quantization rate control method parameter.
+
+@item qmin
+Minimum quantizer scale.
+
+@item qmax
+Maximum quantizer scale.
+
+@item qdiff
+Maximum difference between quantizer scales.
+
+@item qblur
+Quantizer curve blur
+
+@item qcomp
+Quantizer curve compression factor
+
+@item i_qfactor
+
+@item b_qfactor
+
 @item forced-idr
 Normally, when forcing a I-frame type, the encoder can select any type
 of I-frame. This option forces it to choose an IDR-frame.
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 508fade98b..581732d169 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -42,6 +42,7 @@ typedef struct libx265Context {
 const x265_api *api;
 
 float crf;
+int   cqp;
 int   forced_idr;
 char *preset;
 char *tune;
@@ -223,11 +224,30 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 av_log(avctx, AV_LOG_ERROR, "Invalid crf: %2.2f.\n", ctx->crf);
 return AVERROR(EINVAL);
 }
+ctx->params->rc.rateControlMode = X265_RC_CRF;
 } else if (avctx->bit_rate > 0) {
 ctx->params->rc.bitrate = avctx->bit_rate / 1000;
 ctx->params->rc.rateControlMode = X265_RC_ABR;
+} else if (ctx->cqp >= 0) {
+ctx->params->rc.qp  = ctx->cqp;
+ctx->params->rc.rateControlMode = X265_RC_CQP;
 }
 
+if (avctx->qmin >= 0)
+ctx->params->rc.qpMin = avctx->qmin;
+if (avctx->qmax >= 0)
+ctx->params->rc.qpMax = avctx->qmax;
+if (avctx->max_qdiff >= 0)
+ctx->params.rc.qpStep = avctx->max_qdiff;
+if (avctx->qblur >= 0)
+ctx->params->rc.qblur = avctx->qblur;
+if (avctx->qcompress >= 0)
+ctx->params->rc.qCompress = avctx->qcompress;
+if (avctx->i_quant_factor > 0)
+ctx->params->rc.ipFactor = 1 / fabs(avctx->i_quant_factor);
+if (avctx->b_quant_factor > 0)
+ctx->params->rc.pbFactor = avctx->b_quant_factor;
+
 ctx->params->rc.vbvBufferSize = avctx->rc_buffer_size / 1000;
 ctx->params->rc.vbvMaxBitrate = avctx->rc_max_rate/ 1000;
 
@@ -548,6 +568,7 @@ static av_cold void libx265_encode_init_csp(AVCodec *codec)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
 { "crf", "set the x265 crf",   
 OFFSET(crf),   AV_OPT_TYPE_FLOAT,  { .dbl = -1 }, -1, 
FLT_MAX, VE },
+{ "qp",  "set the x265 qp",
 OFFSET(cqp),   AV_OPT_TYPE_INT,{ .i64 = -1 }, -1, 
INT_MAX, VE },
 { "forced-idr",  "if forcing keyframes, force them as IDR frames", 
 OFFSET(forced_idr),AV_OPT_TYPE_BOOL,   { .i64 =  0 },  0,  
 1, VE },
 { "preset",  "set the x265 preset",
 OFFSET(preset),AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
 { "tune","set the x265 tune parameter",
 OFFSET(tune),  AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
@@ -569,6 +590,13 @@ static const AVCodecDefault x265_defaults[] = {
 { "g", "-1" },
 { "keyint_min", "-1" },
 { "refs", "-1" },
+{ "qmin", "-1" },
+{ "qmax", "-1" },
+{ "qdiff", "-1" },
+{ "qblur", "-1" },
+{ "qcomp", "-1" },
+{ "i_qfactor", "-1" },
+{ "b_qfactor", "-1" },
 { NULL },
 };
 
-- 
2.24.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] fate/matroska: Add test for ProRes and bz2 compression

2019-12-28 Thread James Almer
On 12/27/2019 11:40 PM, Andreas Rheinhardt wrote:
> This test tests that demuxing ProRes that is muxed like it should be in
> Matroska (i.e. with the first header ("icpf") atom stripped away) works;
> it also tests bz2 decompression as well as the handling of
> unknown-length clusters.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> The samples have already been sent to James for uploading.
> 
>  tests/fate/matroska.mak  |  5 +
>  .../fate/matroska-prores-header-insertion-bz2| 16 
>  2 files changed, 21 insertions(+)
>  create mode 100644 tests/ref/fate/matroska-prores-header-insertion-bz2
> 
> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> index 99145338ae..597be7346c 100644
> --- a/tests/fate/matroska.mak
> +++ b/tests/fate/matroska.mak
> @@ -1,6 +1,11 @@
>  FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER ZLIB) += 
> fate-matroska-prores-zlib
>  fate-matroska-prores-zlib: CMD = framecrc -i 
> $(TARGET_SAMPLES)/mkv/prores_zlib.mkv -c:v copy
>  
> +# This tests that the matroska demuxer correctly adds the icpf header atom
> +# upon demuxing; it also tests bz2 decompression and unknown-length cluster.
> +FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER BZLIB) += 
> fate-matroska-prores-header-insertion-bz2
> +fate-matroska-prores-header-insertion-bz2: CMD = framecrc -i 
> $(TARGET_SAMPLES)/mkv/prores_bz2.mkv -map 0 -c copy
> +
>  # This tests that the matroska demuxer supports modifying the colorspace
>  # properties in remuxing (-c:v copy)
>  # It also tests automatic insertion of the vp9_superframe bitstream filter
> diff --git a/tests/ref/fate/matroska-prores-header-insertion-bz2 
> b/tests/ref/fate/matroska-prores-header-insertion-bz2
> new file mode 100644
> index 00..63a59f9b8d
> --- /dev/null
> +++ b/tests/ref/fate/matroska-prores-header-insertion-bz2
> @@ -0,0 +1,16 @@
> +#extradata 0:4, 0x0402019c
> +#extradata 1:4, 0x0402019c
> +#tb 0: 1/1000
> +#media_type 0: video
> +#codec_id 0: prores
> +#dimensions 0: 720x480
> +#sar 0: 186/157
> +#tb 1: 1/1000
> +#media_type 1: video
> +#codec_id 1: prores
> +#dimensions 1: 720x480
> +#sar 1: 186/157
> +0,  0,  0,0, 4304, 0x3625b1fc
> +1,  0,  0,0, 4304, 0x3625b1fc
> +0, 42, 42,0, 4304, 0x3625b1fc
> +1, 42, 42,0, 4304, 0x3625b1fc

Pushed alongside the sample. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avformat/matroskadec: Fix lzo decompression

2019-12-28 Thread James Almer
On 12/27/2019 11:40 PM, Andreas Rheinhardt wrote:
> When a Matroska Block is only stored in compressed form, the size of
> the uncompressed block is not explicitly coded and therefore not known
> before decompressing it. Therefore the demuxer uses a guess for the
> uncompressed size: The first guess is three times the compressed size
> and if this is not enough, it is repeatedly incremented by a factor of
> three. But when this happens with lzo, the decompression is neither
> resumed nor started again. Instead when av_lzo1x_decode indicates that x
> bytes of input data could not be decoded, because the output buffer is
> already full, the first (not the last) x bytes of the input buffer are
> resent for decoding in the next try; they overwrite already decoded
> data.
> 
> This commit fixes this by instead restarting the decompression anew,
> just with a bigger buffer.
> 
> This seems to be a regression since 935ec5a1.
> 
> A FATE-test for this has been added.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/matroskadec.c |  3 ++-
>  tests/fate/matroska.mak   |  4 
>  tests/ref/fate/matroska-lzo-decompression | 10 ++
>  3 files changed, 16 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/fate/matroska-lzo-decompression
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 72624dc3f1..75f72d330c 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1599,6 +1599,7 @@ static int matroska_decode_buffer(uint8_t **buf, int 
> *buf_size,
>  #if CONFIG_LZO
>  case MATROSKA_TRACK_ENCODING_COMP_LZO:
>  do {
> +int insize = isize;
>  olen   = pkt_size *= 3;
>  newpktdata = av_realloc(pkt_data, pkt_size + 
> AV_LZO_OUTPUT_PADDING
> + 
> AV_INPUT_BUFFER_PADDING_SIZE);
> @@ -1607,7 +1608,7 @@ static int matroska_decode_buffer(uint8_t **buf, int 
> *buf_size,
>  goto failed;
>  }
>  pkt_data = newpktdata;
> -result   = av_lzo1x_decode(pkt_data, &olen, data, &isize);
> +result   = av_lzo1x_decode(pkt_data, &olen, data, &insize);
>  } while (result == AV_LZO_OUTPUT_FULL && pkt_size < 1000);
>  if (result) {
>  result = AVERROR_INVALIDDATA;
> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> index 597be7346c..4aca4dc8eb 100644
> --- a/tests/fate/matroska.mak
> +++ b/tests/fate/matroska.mak
> @@ -22,6 +22,10 @@ fate-matroska-xiph-lacing: CMD = framecrc -i 
> $(TARGET_SAMPLES)/mkv/xiph_lacing.m
>  FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER ZLIB) += 
> fate-matroska-zlib-decompression
>  fate-matroska-zlib-decompression: CMD = framecrc -i 
> $(TARGET_SAMPLES)/mkv/subtitle_zlib.mks -c:s copy
>  
> +# This tests that the matroska demuxer can decompress lzo compressed tracks.
> +FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER LZO) += 
> fate-matroska-lzo-decompression
> +fate-matroska-lzo-decompression: CMD = framecrc -i 
> $(TARGET_SAMPLES)/mkv/lzo.mka -c copy
> +
>  # This tests that the matroska demuxer correctly propagates
>  # the channel layout contained in vorbis comments in the CodecPrivate
>  # of flac tracks. It also tests header removal compression.
> diff --git a/tests/ref/fate/matroska-lzo-decompression 
> b/tests/ref/fate/matroska-lzo-decompression
> new file mode 100644
> index 00..241d5adf44
> --- /dev/null
> +++ b/tests/ref/fate/matroska-lzo-decompression
> @@ -0,0 +1,10 @@
> +#tb 0: 11337/5
> +#media_type 0: audio
> +#codec_id 0: pcm_s16le
> +#sample_rate 0: 44100
> +#channel_layout 0: 3
> +#channel_layout_name 0: stereo
> +0,  0,  0, 4096,16384, 0x
> +0,   4096,   4096, 4096,16384, 0xad7eebf4
> +0,   8192,   8192, 4096,16384, 0x1d1ff9d9
> +0,  12288,  12288, 4097,16384, 0xf1d9e2e2

Pushed alongside the sample. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH V2] lavf/libsrt: add version guard for srt encryption control

2019-12-28 Thread Jun Zhao
From: Jun Zhao 

add version guard for srt encryption control. and use
SRTO_STRICTENC(53) for compatibility.

Signed-off-by: Jun Zhao 
---
 libavformat/libsrt.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 2fdfe8e..a727b1c 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -62,9 +62,11 @@ typedef struct SRTContext {
 int64_t maxbw;
 int pbkeylen;
 char *passphrase;
+#if SRT_VERSION_VALUE >= 0x010302
 int enforced_encryption;
 int kmrefreshrate;
 int kmpreannounce;
+#endif
 int mss;
 int ffs;
 int ipttl;
@@ -105,9 +107,11 @@ static const AVOption libsrt_options[] = {
 { "maxbw",  "Maximum bandwidth (bytes per second) that the 
connection can use", OFFSET(maxbw),AV_OPT_TYPE_INT64,{ .i64 
= -1 }, -1, INT64_MAX, .flags = D|E },
 { "pbkeylen",   "Crypto key len in bytes {16,24,32} Default: 16 
(128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT,  { .i64 
= -1 }, -1, 32,.flags = D|E },
 { "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable 
crypto", OFFSET(passphrase),   AV_OPT_TYPE_STRING,   { .str = 
NULL },  .flags = D|E },
-{ "enforced_encryption", "Enforces that both connection parties have the 
same passphrase set ", OFFSET(enforced_encryption), 
AV_OPT_TYPE_BOOL,  { .i64 = -1 }, -1, 1, .flags = D|E },
+#if SRT_VERSION_VALUE >= 0x010302
+{ "enforced_encryption", "Enforces that both connection parties have the 
same passphrase set",  OFFSET(enforced_encryption), 
AV_OPT_TYPE_BOOL,  { .i64 = -1 }, -1, 1, .flags = D|E },
 { "kmrefreshrate",   "The number of packets to be transmitted after 
which the encryption key is switched to a new key", OFFSET(kmrefreshrate),  
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
 { "kmpreannounce",   "The interval between when a new encryption key 
is sent and when switchover occurs",   OFFSET(kmpreannounce),   
AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX,   .flags = D|E },
+#endif
 { "mss","The Maximum Segment Size",
 OFFSET(mss),  AV_OPT_TYPE_INT,  { .i64 = -1 }, 
-1, 1500,  .flags = D|E },
 { "ffs","Flight flag size (window size) (in bytes)",   
 OFFSET(ffs),  AV_OPT_TYPE_INT,  { .i64 = -1 }, 
-1, INT_MAX,   .flags = D|E },
 { "ipttl",  "IP Time To Live", 
 OFFSET(ipttl),AV_OPT_TYPE_INT,  { .i64 = -1 }, 
-1, 255,   .flags = D|E },
@@ -327,9 +331,12 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
 (s->maxbw >= 0 && libsrt_setsockopt(h, fd, SRTO_MAXBW, "SRTO_MAXBW", 
&s->maxbw, sizeof(s->maxbw)) < 0) ||
 (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, 
"SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
 (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, 
"SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
-(s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, 
SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, 
sizeof(s->enforced_encryption)) < 0) ||
+#if SRT_VERSION_VALUE >= 0x010302
+/* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for 
compatibility, we used SRTO_STRICTENC */
+(s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, 
SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, 
sizeof(s->enforced_encryption)) < 0) ||
 (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, 
"SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
 (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, 
"SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
+#endif
 (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MMS", 
&s->mss, sizeof(s->mss)) < 0) ||
 (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, 
sizeof(s->ffs)) < 0) ||
 (s->ipttl >= 0 && libsrt_setsockopt(h, fd, SRTO_IPTTL, "SRTO_UPTTL", 
&s->ipttl, sizeof(s->ipttl)) < 0) ||
-- 
1.7.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 3/4] FATE: add a test for lut1d and lut3d

2019-12-28 Thread Limin Wang
On Thu, Nov 14, 2019 at 10:55:30PM +0100, Michael Niedermayer wrote:
> On Thu, Nov 14, 2019 at 09:46:22PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > have tested with x86_64(apple darwin, linux gcc), x86_32(linux), mips
> 
> tested on mingw32/64, qemu arm/mips 

ping, please help to push the patchset(except 4) if no other issues.


> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Freedom in capitalist society always remains about the same as it was in
> ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


-- 
Thanks,
Limin Wang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] lavc/vp9: support hardware decode with resolution changing on inter frame

2019-12-28 Thread Fu, Linjie
> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Hendrik Leppkes
> Sent: Friday, December 27, 2019 18:22
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/2] lavc/vp9: support hardware
> decode with resolution changing on inter frame
> 
> On Fri, Dec 27, 2019 at 9:59 AM Linjie Fu  wrote:
> >
> > VP9 decoder should be able to handle resolution changing on inter
> > frame without re-initialization. For hardware decoder, re-allocate hardware
> > frame surface.
> >
> > Fix #8068 for VA-API.
> >
> > Signed-off-by: Linjie Fu 
> > ---
> > Request for comments.
> > This works for VA-API, however for dxva2 it didn't cover all cases.
> >
> > Another idea is to register a call-back function in AVHWAccel (such as
> > ff_vp9_dxva2_hwaccel) to handle surface re-allocation according to
> > the hardware decoder.
> >
> >  libavcodec/vp9.c | 18 ++
> >  1 file changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> > index 0fd15ef..a7b4c6a 100644
> > --- a/libavcodec/vp9.c
> > +++ b/libavcodec/vp9.c
> > @@ -34,6 +34,7 @@
> >  #include "vp9dec.h"
> >  #include "libavutil/avassert.h"
> >  #include "libavutil/pixdesc.h"
> > +#include "decode.h"
> >
> >  #define VP9_SYNCCODE 0x498342
> >
> > @@ -220,11 +221,20 @@ static int update_size(AVCodecContext *avctx,
> int w, int h)
> >  *fmtp++ = s->pix_fmt;
> >  *fmtp = AV_PIX_FMT_NONE;
> >
> > -ret = ff_thread_get_format(avctx, pix_fmts);
> > -if (ret < 0)
> > -return ret;
> > +if (avctx->internal->hwaccel_priv_data && s->pix_fmt == s->gf_fmt
> && (s->w != w || s->h != h)) {
> > +const AVHWDeviceContext *device_ctx =
> > +(AVHWDeviceContext*)avctx->hw_device_ctx->data;
> > +ret = ff_decode_get_hw_frames_ctx(avctx, device_ctx->type);
> > +if (ret < 0)
> > +return ret;
> > +} else {
> > +ret = ff_thread_get_format(avctx, pix_fmts);
> > +if (ret < 0)
> > +return ret;
> > +
> > +avctx->pix_fmt = ret;
> > +}
> >
> > -avctx->pix_fmt = ret;
> >  s->gf_fmt  = s->pix_fmt;
> >  s->w = w;
> >  s->h = h;
> 
> hwaccels are not guaranteed to have a hw_frames ctx, and avcodec is
> not guaranteed to manage the surfaces it decodes to at all (they could
> be shared with eg. a renderer and allocated externally), as such a

Thanks, and would you please help to share more information about how to 
reproduce?
1. no hw_frame_ctx, only hw_device_ctx
2. surfaces shared with a rendered and allocated externally
(externally provided hw_frames_ctx)

I'd like to step into these and try to find a proper/general solution.

> decoder really can't reliably re-allocate this itself - thats what the
> get_format callback is for, which informs the user that new dimensions
> are required.

It's vp9 (and AV1) specific, so I didn't intend to modify in the general 
path(ff_get_format) firstly.

Instead of fixing in codec(update_size() in vp9.c),  if we are going to handle 
this in user
(ff_get_format() in decode.c) to manage the surface, IMHO a modification in API 
may be needed
to register a reinit function in AVHWAccel.
See:
https://github.com/intel-media-ci/ffmpeg/pull/153

thx

- linjie


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 2/2] cmdutils: add show_help_protocol for get protocol options

2019-12-28 Thread Liu Steven


> 在 2019年11月28日,上午5:24,Michael Niedermayer  写道:
> 
> On Wed, Nov 27, 2019 at 01:57:02PM +0800, Steven Liu wrote:
>> Signed-off-by: Steven Liu 
>> ---
>> fftools/cmdutils.c   | 14 ++
>> fftools/ffmpeg_opt.c |  2 +-
>> 2 files changed, 15 insertions(+), 1 deletion(-)
> 
> i think the patchset looks good, but maybe wait a bit before applying
> as it involves public API and others may have comments too
ping?
> 
> Thanks
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> When the tyrant has disposed of foreign enemies by conquest or treaty, and
> there is nothing more to fear from them, then he is always stirring up
> some war or other, in order that the people may require a leader. -- Plato
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Steven
Thanks



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".