Re: [FFmpeg-devel] [PATCH V3 2/3] doc/filters: update how to generate native model for sr filter

2019-07-01 Thread Gyan



On 02-07-2019 06:16 AM, Guo, Yejun wrote:



-Original Message-
From: Guo, Yejun
Sent: Thursday, June 13, 2019 1:31 PM
To: ffmpeg-devel@ffmpeg.org
Cc: Guo, Yejun 
Subject: [PATCH V3 2/3] doc/filters: update how to generate native model for sr
filter

Signed-off-by: Guo, Yejun 
---
  doc/filters.texi | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index ec1c7c7..fe6725a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16588,10 +16588,13 @@ Efficient Sub-Pixel Convolutional Neural
Network model (ESPCN).
  See @url{https://arxiv.org/abs/1609.05158}.
  @end itemize

-Training scripts as well as scripts for model generation can be found at
+Training scripts as well as scripts for model file (.pb) saving can be found at
  @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original
repository
  is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.

+Native model files (.model) can be generated from TensorFlow model
+files (.pb) by using tools/python/convert.py
+
  The filter accepts the following options:

  @table @option
--
2.7.4

this patch asks for review, thanks.

Will push.

Thanks,
Gyan
___
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] MIPS: replace addi with addiu

2019-07-01 Thread YunQiang Su
addi/daddi are deprecated by MIPS for years, and MIPS r6 remove
them.

They should be replace with addiu:
   ADDIU performs the same arithmetic operation but
   does not trap on overflow.
---
 libavcodec/mips/cabac.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mips/cabac.h b/libavcodec/mips/cabac.h
index 82cee29..2a05e5a 100644
--- a/libavcodec/mips/cabac.h
+++ b/libavcodec/mips/cabac.h
@@ -72,7 +72,7 @@ static av_always_inline int get_cabac_inline(CABACContext *c,
 
 "and  %[tmp0],   %[c_low],   %[cabac_mask] \n\t"
 "bnez %[tmp0],   1f\n\t"
-PTR_ADDI "%[tmp0],   %[c_low],   -0X01 \n\t"
+PTR_ADDIU"%[tmp0],   %[c_low],   -0x01 \n\t"
 "xor  %[tmp0],   %[c_low],   %[tmp0]   \n\t"
 PTR_SRA  "%[tmp0],   %[tmp0],0x0f  \n\t"
 PTR_ADDU "%[tmp0],   %[tmp0],%[tables] \n\t"
-- 
2.20.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] fate: add hls_init_time option fate

2019-07-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 tests/fate/hlsenc.mak|  11 ++
 tests/ref/fate/hls-init-time | 313 +++
 2 files changed, 324 insertions(+)
 create mode 100644 tests/ref/fate/hls-init-time

diff --git a/tests/fate/hlsenc.mak b/tests/fate/hlsenc.mak
index e81fb5411a..4d3a6157a6 100644
--- a/tests/fate/hlsenc.mak
+++ b/tests/fate/hlsenc.mak
@@ -52,3 +52,14 @@ FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER 
MPEGTS_DEMUXER AEVALSRC_FIL
 fate-hls-segment-size: tests/data/hls_segment_size.m3u8
 fate-hls-segment-size: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/hls_segment_size.m3u8 -vf setpts=N*23
 
+tests/data/hls_init_time.m3u8: TAG = GEN
+tests/data/hls_init_time.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+   -f lavfi -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t):d=11" -f hls 
-hls_init_time 1 -hls_time 3 -map 0 \
+   -hls_list_size 5 -codec:a mp2fixed -hls_segment_filename 
$(TARGET_PATH)/tests/data/hls_init_time_%d.ts \
+   $(TARGET_PATH)/tests/data/hls_init_time.m3u8 2>/dev/null
+
+FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER 
AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-hls-init-time
+fate-hls-init-time: tests/data/hls_init_time.m3u8
+fate-hls-init-time: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/hls_init_time.m3u8 -vf setpts=N*23
+
diff --git a/tests/ref/fate/hls-init-time b/tests/ref/fate/hls-init-time
new file mode 100644
index 00..5bc12272cc
--- /dev/null
+++ b/tests/ref/fate/hls-init-time
@@ -0,0 +1,313 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+#channel_layout_name 0: mono
+0,  0,  0, 1152, 2304, 0x28123557
+0,   1152,   1152, 1152, 2304, 0x838c7e81
+0,   2304,   2304, 1152, 2304, 0x4fb8704c
+0,   3456,   3456, 1152, 2304, 0x5f787f9e
+0,   4608,   4608, 1152, 2304, 0xc866749f
+0,   5760,   5760, 1152, 2304, 0x30057e19
+0,   6912,   6912, 1152, 2304, 0xaa64747f
+0,   8064,   8064, 1152, 2304, 0x8d3c84e4
+0,   9216,   9216, 1152, 2304, 0xffb871e1
+0,  10368,  10368, 1152, 2304, 0x0dfe84bc
+0,  11520,  11520, 1152, 2304, 0x341385e0
+0,  12672,  12672, 1152, 2304, 0x069e72bb
+0,  13824,  13824, 1152, 2304, 0xc3b175a6
+0,  14976,  14976, 1152, 2304, 0x3f777972
+0,  16128,  16128, 1152, 2304, 0xb7598a65
+0,  17280,  17280, 1152, 2304, 0x9bd178a4
+0,  18432,  18432, 1152, 2304, 0xedca7972
+0,  19584,  19584, 1152, 2304, 0x8db2625c
+0,  20736,  20736, 1152, 2304, 0x99c67c29
+0,  21888,  21888, 1152, 2304, 0x54f984be
+0,  23040,  23040, 1152, 2304, 0x4669828a
+0,  24192,  24192, 1152, 2304, 0x3e4b8b6b
+0,  25344,  25344, 1152, 2304, 0x7f1f7180
+0,  26496,  26496, 1152, 2304, 0x3af882a9
+0,  27648,  27648, 1152, 2304, 0x091181cb
+0,  28800,  28800, 1152, 2304, 0x7b9187fc
+0,  29952,  29952, 1152, 2304, 0x59f55cec
+0,  31104,  31104, 1152, 2304, 0xdf07
+0,  32256,  32256, 1152, 2304, 0xe0216c14
+0,  33408,  33408, 1152, 2304, 0x91248470
+0,  34560,  34560, 1152, 2304, 0xe7d07576
+0,  35712,  35712, 1152, 2304, 0xdb446fb4
+0,  36864,  36864, 1152, 2304, 0x815d85d0
+0,  38016,  38016, 1152, 2304, 0x67e877ac
+0,  39168,  39168, 1152, 2304, 0x51307bc9
+0,  40320,  40320, 1152, 2304, 0xad597c5c
+0,  41472,  41472, 1152, 2304, 0x84a77124
+0,  42624,  42624, 1152, 2304, 0xcef5717e
+0,  43776,  43776, 1152, 2304, 0xc1596f9a
+0,  44928,  44928, 1152, 2304, 0xcbb57986
+0,  46080,  46080, 1152, 2304, 0x5dd97b17
+0,  47232,  47232, 1152, 2304, 0x88d882c5
+0,  48384,  48384, 1152, 2304, 0x869491ba
+0,  49536,  49536, 1152, 2304, 0x254e69da
+0,  50688,  50688, 1152, 2304, 0xe4b579d7
+0,  51840,  51840, 1152, 2304, 0x1fcd7271
+0,  52992,  52992, 1152, 2304, 0x872c7bcc
+0,  54144,  54144, 1152, 2304, 0x23818bab
+0,  55296,  55296, 1152, 2304, 0x3cc28b72
+0,  56448,  56448, 1152, 2304, 0x9cd79250
+0,  57600,  57600, 1152, 2304, 0xeb3979af
+0,  58752,  58752, 1152, 2304, 0xbe647d72
+0,  59904,  59904, 1152, 2304, 0xa5858875
+0,  61056,  61056, 1152, 2304, 0xbb247834
+0,  62208,  62208, 1152, 2304, 

Re: [FFmpeg-devel] [PATCH V3 2/3] doc/filters: update how to generate native model for sr filter

2019-07-01 Thread Guo, Yejun


> -Original Message-
> From: Guo, Yejun
> Sent: Thursday, June 13, 2019 1:31 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Guo, Yejun 
> Subject: [PATCH V3 2/3] doc/filters: update how to generate native model for 
> sr
> filter
> 
> Signed-off-by: Guo, Yejun 
> ---
>  doc/filters.texi | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index ec1c7c7..fe6725a 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -16588,10 +16588,13 @@ Efficient Sub-Pixel Convolutional Neural
> Network model (ESPCN).
>  See @url{https://arxiv.org/abs/1609.05158}.
>  @end itemize
> 
> -Training scripts as well as scripts for model generation can be found at
> +Training scripts as well as scripts for model file (.pb) saving can be found 
> at
>  @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original
> repository
>  is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
> 
> +Native model files (.model) can be generated from TensorFlow model
> +files (.pb) by using tools/python/convert.py
> +
>  The filter accepts the following options:
> 
>  @table @option
> --
> 2.7.4

this patch asks for review, 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 v2] Add 2 timestamp print formats

2019-07-01 Thread Ulf Zibis

Am 02.07.19 um 00:28 schrieb Ulf Zibis:
>> If this could be done without float/double that would be preferred as it
>> avoids inaccuracies / slight differences between platforms
> I too thought on that, but the existing functions too rely on
> float/double. Should I anyway provide a solution with integer arithmetic?
Then there could be inconsistencies with the existing
av_ts_make_time_string function.

My current approach is result of this discussion:
https://stackoverflow.com/questions/56797715/which-format-string-to-use-with-printf-for-a-time-as-78901-234/56814382#

-Ulf

___
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] Add 2 timestamp print formats

2019-07-01 Thread Ulf Zibis
Thanks Michael for your review, answers inline ...

Am 01.07.19 um 17:16 schrieb Michael Niedermayer:
>>  timestamp.h |   78 
>> 
>>  1 file changed, 73 insertions(+), 5 deletions(-)
>> 3d1275421b1b8d4952815151158c7af954d38ca6  timestamp_2.patch
>> From 709cb4662132deff2d17a8700f58fa91b118c56d Mon Sep 17 00:00:00 2001
>> From: Ulf Zibis 
>> Date: 29.06.2019, 17:52:06
>>
>> avutil/timestamp: added 2 new print formats
>>
>> diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
>> index e082f01..b94e5ce 100644
>> --- a/libavutil/timestamp.h
>> +++ b/libavutil/timestamp.h
>> @@ -48,14 +48,14 @@
>>  }
>>  
>>  /**
>> - * Convenience macro, the return value should be used only directly in
>> + * Convenience macro. The return value should be used only directly in
>>   * function arguments but never stand-alone.
>>   */
>> -#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, 
>> ts)
>> +#define av_ts2str(ts) 
>> av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts)
>>  
>>  /**
>>   * Fill the provided buffer with a string containing a timestamp time
>> - * representation.
>> + * representation in seconds.
>>   *
>>   * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
>>   * @param ts the timestamp to represent
>> @@ -70,9 +70,77 @@
>>  }
>>  
>>  /**
>> - * Convenience macro, the return value should be used only directly in
>> + * Convenience macro. The return value should be used only directly in
>>   * function arguments but never stand-alone.
>>   */
> Unrelated change, belongs in a seperate patch
The following change I think should be part of the patch, as it helps to
distinguish between the existing timestamp functions and my new ones:
- * representation.
+ * representation in seconds.
The other above changes are cosmetic and can go in a separate patch. But
would you endorse them?

>> -#define av_ts2timestr(ts, tb) 
>> av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
>> +#define av_ts2timestr(ts, tb) 
>> av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
>> +
>> +/**
>> + * Fill the provided buffer with a string containing a timestamp time
>> + * representation in minutes and seconds.
>> + *
>> + * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
>> + * @param ts the timestamp to represent
>> + * @param tb the timebase of the timestamp
>> + * @return the buffer in input
>> + */
>> +static inline char *av_ts_make_minute_string(char *buf, int64_t ts, 
>> AVRational *tb)
>> +{
>> +if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
>> +else {
>> +double time = av_q2d(*tb) * ts;
> If this could be done without float/double that would be preferred as it
> avoids inaccuracies / slight differences between platforms

I too thought on that, but the existing functions too rely on
float/double. Should I anyway provide a solution with integer arithmetic?

>> +const char *format = (time >= 0 ? "%3d:%09.6f" : "-%3d:%09.6f");
>> +time = (fabs(time) > INT_MAX * 60.0 ? INT_MAX * 60.0 : fabs(time));
>> +int len = snprintf(buf, AV_TS_MAX_STRING_SIZE, format, (int)(time / 
>> 60), fmod(time, 60));

Correct. I didn't bother on that for sake of readability and saving code
lines. This can be changed, if you want.

What's about "inline"? I think it's not helpful here as I argued in my
last post.

-Ulf


___
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/4] avcodec/hevcdec: Fix memleak of a53_caption

2019-07-01 Thread James Almer
On 7/1/2019 11:24 AM, Michael Niedermayer wrote:
> On Sun, Jun 30, 2019 at 11:18:55PM -0300, James Almer wrote:
>> On 6/30/2019 10:43 PM, James Almer wrote:
>>> On 6/30/2019 7:16 PM, Michael Niedermayer wrote:
 Fixes: 
 15295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5675655187922944

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

 diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
 index 515b346535..b5d918d07d 100644
 --- a/libavcodec/hevcdec.c
 +++ b/libavcodec/hevcdec.c
 @@ -3331,6 +3331,8 @@ static av_cold int hevc_decode_free(AVCodecContext 
 *avctx)
  
  ff_h2645_packet_uninit(>pkt);
  
 +ff_hevc_reset_sei(>sei);
 +
  return 0;
  }
>>>
>>> LGTM.
>>
>> You could also add it to hevc_decode_flush() while at it.
> 
> will post a patch once i (lightly) tested it

Do you have hevc samples with closed captions? I'm not sure if there's a
case where one such caption would not be attached to the frame (And thus
removed from the decoder context) before a call to
avcodec_flush_buffers() takes place. Maybe some sample where slices are
in different packets.

For that matter, h264 seems to handle closed captions a lot better than
hevc. It uses AVBufferRefs to keep them in sync between frame thread
contexts, and it also makes sure to reset frame-specific SEI state on
all frames and on flushing, all things hevc currently doesn't.
Implementing the former should be trivial, but the latter isn't as slice
handling is different.

> 
> 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".
> 

___
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] ffmpeg: Integrate two checks

2019-07-01 Thread Andreas Rheinhardt
For audio packets with dts != AV_NOPTS_VALUE the dts the dts was
converted twice to the muxer's timebase during streamcopy, once as a
normal packet and once specifically as an audio packet. This has been
changed.

Signed-off-by: Andreas Rheinhardt 
---
You are right. Seems that this is not covered by fate.

 fftools/ffmpeg.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..f81b1b3983 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2044,20 +2044,19 @@ static void do_streamcopy(InputStream *ist, 
OutputStream *ost, const AVPacket *p
 else
 opkt.pts = AV_NOPTS_VALUE;
 
-if (pkt->dts == AV_NOPTS_VALUE)
+if (pkt->dts == AV_NOPTS_VALUE) {
 opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase);
-else
-opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, 
ost->mux_timebase);
-opkt.dts -= ost_tb_start_time;
-
-if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != 
AV_NOPTS_VALUE) {
+} else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 int duration = av_get_audio_frame_duration(ist->dec_ctx, pkt->size);
 if(!duration)
 duration = ist->dec_ctx->frame_size;
-opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts,
-   (AVRational){1, 
ist->dec_ctx->sample_rate}, duration, >filter_in_rescale_delta_last,
-   ost->mux_timebase) - 
ost_tb_start_time;
-}
+opkt.dts = av_rescale_delta(ist->st->time_base, pkt->dts,
+(AVRational){1, 
ist->dec_ctx->sample_rate}, duration,
+>filter_in_rescale_delta_last, 
ost->mux_timebase);
+opkt.pts = opkt.dts - ost_tb_start_time;
+} else
+opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, 
ost->mux_timebase);
+opkt.dts -= ost_tb_start_time;
 
 opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, 
ost->mux_timebase);
 
-- 
2.21.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".

Re: [FFmpeg-devel] [PATCH]lavc/zmbvenc: Do not left-shift negative values

2019-07-01 Thread Tomas Härdin
mån 2019-07-01 klockan 01:47 +0200 skrev Carl Eugen Hoyos:
> Hi!
> 
> Attached patch fixes the only (remaining) issue I see with the sample
> of ticket #7980.
> 
> Please comment, Carl Eugen

Looks OK to me

/Tomas
___
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]lavc/zmbvenc: Do not left-shift negative values

2019-07-01 Thread Michael Niedermayer
On Mon, Jul 01, 2019 at 01:47:46AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes the only (remaining) issue I see with the sample
> of ticket #7980.
> 
> Please comment, Carl Eugen

>  zmbvenc.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 39d38ac46b445460b0f27aec16e70ed176fa7cfe  
> 0001-lavc-zmbvenc-Do-not-left-shift-negative-values.patch
> From e6ff8f43c0d9275b52290e18231438ce7770 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 1 Jul 2019 01:45:36 +0200
> Subject: [PATCH] lavc/zmbvenc: Do not left-shift negative values.
> 
> Fixes the following ubsan errors with the sample from ticket #7980:
> libavcodec/zmbvenc.c:243:29: runtime error: left shift of negative value -4
> libavcodec/zmbvenc.c:244:28: runtime error: left shift of negative value -2
> ---
>  libavcodec/zmbvenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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]lavc/r210enc: Fix undefined behaviour encoding r10k

2019-07-01 Thread Michael Niedermayer
On Mon, Jul 01, 2019 at 01:08:34PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes an invalid left shift reported in ticket #7982.
> 
> Please comment, Carl Eugen

>  r210enc.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 9db2195a8e6d3c90726c2bf92119ff6043d4dd99  
> 0001-lavc-r210enc-Fix-undefined-behaviour-encoding-r10k.patch
> From cfe1ae9a1e95dee72ff0e0a45ce8caab98a1bd0b Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 1 Jul 2019 13:06:02 +0200
> Subject: [PATCH] lavc/r210enc: Fix undefined behaviour encoding r10k.
> 
> Fixes the following ubsan error:
> libavcodec/r210enc.c:69:28: runtime error: left shift of 522 by 22 places 
> cannot be represented in type 'int'
> 
> Fixes ticket #7982.
> ---
>  libavcodec/r210enc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c
> index 02412f3684..95049089bc 100644
> --- a/libavcodec/r210enc.c
> +++ b/libavcodec/r210enc.c
> @@ -60,9 +60,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
> *pkt,
>  uint16_t *srcb = (uint16_t *)srcb_line;
>  for (j = 0; j < avctx->width; j++) {
>  uint32_t pixel;
> -uint16_t r = *srcr++;
> -uint16_t g = *srcg++;
> -uint16_t b = *srcb++;
> +uint32_t r = *srcr++;
> +uint32_t g = *srcg++;
> +uint32_t b = *srcb++;
>  if (avctx->codec_id == AV_CODEC_ID_R210)
>  pixel = (r << 20) | (g << 10) | b;

I think plain unsigned is a less confusing choice here, but either is
ok
(uint32_t can make the reader confuse the source with 32bit pointers)

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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] ffmpeg: Integrate two checks

2019-07-01 Thread Michael Niedermayer
On Sun, Jun 30, 2019 at 12:34:06AM +0200, Andreas Rheinhardt wrote:
> For audio packets with dts != AV_NOPTS_VALUE the dts the dts was
> converted twice to the muxer's timebase during streamcopy, once as a
> normal packet and once specifically as an audio packet. This has been
> changed.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  fftools/ffmpeg.c | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 01f04103cf..755bc05bc1 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -2044,20 +2044,18 @@ static void do_streamcopy(InputStream *ist, 
> OutputStream *ost, const AVPacket *p
>  else
>  opkt.pts = AV_NOPTS_VALUE;
>  
> -if (pkt->dts == AV_NOPTS_VALUE)
> +if (pkt->dts == AV_NOPTS_VALUE) {
>  opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase);
> -else
> -opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, 
> ost->mux_timebase);
> -opkt.dts -= ost_tb_start_time;
> -
> -if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != 
> AV_NOPTS_VALUE) {
> +} else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
>  int duration = av_get_audio_frame_duration(ist->dec_ctx, pkt->size);
>  if(!duration)
>  duration = ist->dec_ctx->frame_size;
>  opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts,
> -   (AVRational){1, 
> ist->dec_ctx->sample_rate}, duration, >filter_in_rescale_delta_last,
> -   ost->mux_timebase) - 
> ost_tb_start_time;
> -}
> +   (AVRational){1, 
> ist->dec_ctx->sample_rate}, duration,
> +   
> >filter_in_rescale_delta_last, ost->mux_timebase);
> +} else
> +opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, 
> ost->mux_timebase);
> +opkt.dts -= ost_tb_start_time;

Is this intended to have no effect on the output ?
it does have an effect, opkt.pts differs by ost_tb_start_time

thanks

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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 v2] Add 2 timestamp print formats

2019-07-01 Thread Michael Niedermayer
On Mon, Jul 01, 2019 at 11:51:30AM +0200, Ulf Zibis wrote:
> 
> Am 29.06.19 um 18:12 schrieb Ulf Zibis:
> > Hi,
> >
> > for my developement of another filter I need additional timestamp print
> > formats.
> >
> > So I like to share my efforts. Are you interested to include them to the
> > project?
> >
> > For libavutil/timestamp.h I'm also wondering, why these format functions
> > are designated for "inline". As printing is always a little heavy job,
> > an explicit function call would not change much for performance IMHO,
> > but would save project footprint.
> Because of a rounding issue I had to make a new version.
> 
> Please review patch v2.
> 
> -Ulf
> 

>  timestamp.h |   78 
> 
>  1 file changed, 73 insertions(+), 5 deletions(-)
> 3d1275421b1b8d4952815151158c7af954d38ca6  timestamp_2.patch
> From 709cb4662132deff2d17a8700f58fa91b118c56d Mon Sep 17 00:00:00 2001
> From: Ulf Zibis 
> Date: 29.06.2019, 17:52:06
> 
> avutil/timestamp: added 2 new print formats
> 
> diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
> index e082f01..b94e5ce 100644
> --- a/libavutil/timestamp.h
> +++ b/libavutil/timestamp.h
> @@ -48,14 +48,14 @@
>  }
>  
>  /**
> - * Convenience macro, the return value should be used only directly in
> + * Convenience macro. The return value should be used only directly in
>   * function arguments but never stand-alone.
>   */
> -#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
> +#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, 
> ts)
>  
>  /**
>   * Fill the provided buffer with a string containing a timestamp time
> - * representation.
> + * representation in seconds.
>   *
>   * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
>   * @param ts the timestamp to represent

> @@ -70,9 +70,77 @@
>  }
>  
>  /**
> - * Convenience macro, the return value should be used only directly in
> + * Convenience macro. The return value should be used only directly in
>   * function arguments but never stand-alone.
>   */

Unrelated change, belongs in a seperate patch


> -#define av_ts2timestr(ts, tb) 
> av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
> +#define av_ts2timestr(ts, tb) 
> av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
> +
> +/**
> + * Fill the provided buffer with a string containing a timestamp time
> + * representation in minutes and seconds.
> + *
> + * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
> + * @param ts the timestamp to represent
> + * @param tb the timebase of the timestamp
> + * @return the buffer in input
> + */
> +static inline char *av_ts_make_minute_string(char *buf, int64_t ts, 
> AVRational *tb)
> +{
> +if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
> +else {
> +double time = av_q2d(*tb) * ts;

If this could be done without float/double that would be preferred as it
avoids inaccuracies / slight differences between platforms


> +const char *format = (time >= 0 ? "%3d:%09.6f" : "-%3d:%09.6f");
> +time = (fabs(time) > INT_MAX * 60.0 ? INT_MAX * 60.0 : fabs(time));
> +int len = snprintf(buf, AV_TS_MAX_STRING_SIZE, format, (int)(time / 
> 60), fmod(time, 60));

mixed declarations and code

[...]

thx


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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 1/4] avcodec/hevcdec: Fix memleak of a53_caption

2019-07-01 Thread Michael Niedermayer
On Sun, Jun 30, 2019 at 11:18:55PM -0300, James Almer wrote:
> On 6/30/2019 10:43 PM, James Almer wrote:
> > On 6/30/2019 7:16 PM, Michael Niedermayer wrote:
> >> Fixes: 
> >> 15295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5675655187922944
> >>
> >> Found-by: continuous fuzzing process 
> >> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> Signed-off-by: Michael Niedermayer 
> >> ---
> >>  libavcodec/hevcdec.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> >> index 515b346535..b5d918d07d 100644
> >> --- a/libavcodec/hevcdec.c
> >> +++ b/libavcodec/hevcdec.c
> >> @@ -3331,6 +3331,8 @@ static av_cold int hevc_decode_free(AVCodecContext 
> >> *avctx)
> >>  
> >>  ff_h2645_packet_uninit(>pkt);
> >>  
> >> +ff_hevc_reset_sei(>sei);
> >> +
> >>  return 0;
> >>  }
> > 
> > LGTM.
> 
> You could also add it to hevc_decode_flush() while at it.

will post a patch once i (lightly) tested it

thx

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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 1/4] avcodec/hevcdec: Fix memleak of a53_caption

2019-07-01 Thread Michael Niedermayer
On Sun, Jun 30, 2019 at 10:43:33PM -0300, James Almer wrote:
> On 6/30/2019 7:16 PM, Michael Niedermayer wrote:
> > Fixes: 
> > 15295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5675655187922944
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/hevcdec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> > index 515b346535..b5d918d07d 100644
> > --- a/libavcodec/hevcdec.c
> > +++ b/libavcodec/hevcdec.c
> > @@ -3331,6 +3331,8 @@ static av_cold int hevc_decode_free(AVCodecContext 
> > *avctx)
> >  
> >  ff_h2645_packet_uninit(>pkt);
> >  
> > +ff_hevc_reset_sei(>sei);
> > +
> >  return 0;
> >  }
> 
> LGTM.

will apply

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

It is what and why we do it that matters, not just one of them.


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] JPEG2000 multiple SOC and SIZ

2019-07-01 Thread Michael Niedermayer
On Sun, Jun 30, 2019 at 05:04:38PM +0500, Anton Novikov wrote:
> When I truncate the packet at next SOC, I get:
> [jpeg2000 @ 0x55ce0298aa40] SIZ
> [jpeg2000 @ 0x55ce0298aa40] SIZ width=2056 height=2168 tile_width=2056
> tile_height=2168 tile_offset_x=0 tile_offset_y=0 xtiles=1 ytiles=1
> [jpeg2000 @ 0x55ce0298aa40] SIZ Rsiz=0x8040 2056 2168
> [jpeg2000 @ 0x55ce0298aa40] POC
> [jpeg2000 @ 0x55ce0298aa40] unsupported marker 0xFF79 at pos 0x70
> [jpeg2000 @ 0x55ce0298aa40] COD
> [jpeg2000 @ 0x55ce0298aa40] extra cblk styles E
> [jpeg2000 @ 0x55ce0298aa40] QCD
> [jpeg2000 @ 0x55ce0298aa40] SOT
> Last message repeated 3 times
> [jpeg2000 @ 0x55ce0298aa40] Psot 1451180 too big
> [jpeg2000 @ 0x55ce0298aa40] error during processing marker segment ff90
> 
> Moreover, in both SIZes, tile offsets are 0, I can't get the idea how the
> file should be handled correctly.
> file: https://www.file-up.org/niuxrl31dyij
> fmpeg commits are attached
> 
> вс, 30 июн. 2019 г. в 15:17, Paul B Mahol :
> 
> > On 6/30/19, Anton Novikov  wrote:
> > > Hi everyone,
> > > I'm reversing the recent version of r3d file format, and have
> > encountered a
> > > JPEG2000-related thing.
> > > I've got a memory dump of something that seems to be JPEG2000, and
> > modified
> > > ffmpeg to consume it. The log follows:
> > > [r3d @ 0x558d304077c0] test
> > > [r3d @ 0x558d304077c0] error reading end atom
> > > Input #0, r3d, from '/home/anek/src/red/frame2.without0.r3d':
> > >   Duration: N/A, bitrate: N/A
> > > Stream #0:0: Video: jpeg2000, bayer_rggb16le, 8192x4320, 24 fps, 24
> > > tbr, 134286336 tbn, 134286336 tbc
> > > Metadata:
> > >   filename: ?
> > > File 'frame.jpg' already exists. Overwrite ? [y/N] y
> > > Stream mapping:
> > >   Stream #0:0 -> #0:0 (jpeg2000 (native) -> mjpeg (native))
> > > Press [q] to stop, [?] for help
> > > Truncating packet of size 9496960 to 7595371
> > > /home/anek/src/red/frame2.without0.r3d: corrupt input packet in stream 0
> > > /home/anek/src/red/frame2.without0.r3d: Operation not permitted
> > > [jpeg2000 @ 0x558d3041c280] SIZ
> > > [jpeg2000 @ 0x558d3041c280] SIZ Rsiz=0x8040 2056 2168
> > > [jpeg2000 @ 0x558d3041c280] POC
> > > [jpeg2000 @ 0x558d3041c280] unsupported marker 0xFF79 at pos 0x70
> > > [jpeg2000 @ 0x558d3041c280] COD
> > > [jpeg2000 @ 0x558d3041c280] extra cblk styles E
> > > [jpeg2000 @ 0x558d3041c280] QCD
> > > [jpeg2000 @ 0x558d3041c280] SOT
> > > Last message repeated 3 times
> > > [jpeg2000 @ 0x558d3041c280] Duplicate SOC at 3821997=0x3A51AD
> > > [jpeg2000 @ 0x558d3041c280] SIZ
> > > [jpeg2000 @ 0x558d3041c280] SIZ Rsiz=0x8040 2056 2168
> > > [jpeg2000 @ 0x558d3041c280] POC
> > > [jpeg2000 @ 0x558d3041c280] unsupported marker 0xFF79 at pos 0x3A5203
> > > [jpeg2000 @ 0x558d3041c280] COD
> > > [jpeg2000 @ 0x558d3041c280] extra cblk styles E
> > > [jpeg2000 @ 0x558d3041c280] QCD
> > > [jpeg2000 @ 0x558d3041c280] SOT
> > > Last message repeated 3 times
> > > [jpeg2000 @ 0x558d3041c280] Progression order RPCL
> > > Last message repeated 3 times
> > > [swscaler @ 0x558d30425900] deprecated pixel format used, make sure you
> > did
> > > set range correctly
> > > [mjpeg @ 0x558d3040e780] removing common factors from framerate
> > > Output #0, image2, to 'frame.jpg':
> > >   Metadata:
> > > encoder : Lavf58.27.103
> > > Stream #0:0: Video: mjpeg, yuvj444p(pc), 2056x2168, q=2-31, 200 kb/s,
> > > 24 fps, 24 tbn, 24 tbc
> > > Metadata:
> > >   filename: ?
> > >   encoder : Lavc58.52.102 mjpeg
> > > Side data:
> > >   cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1
> > > [image2 @ 0x558d3040abc0] Application provided invalid, non monotonically
> > > increasing dts to muxer in stream 0: 101000 >= 0
> > > /home/anek/src/red/frame2.without0.r3d: Operation not permitted
> > > frame=1 fps=0.4 q=2.9 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=
> > > 0x
> > > video:96kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> > > muxing overhead: unknown
> > >
> > > picture dimensions are 8192x4320, but in JPEG2000 bytestream there are 2
> > > SOC and SIZ markers with SIZ mentioning 2056x2168. The image is decoded,
> > > but colors and area are wrong. What can I do?
> >
> > Make sure it uses tiles (each jpeg2000 is special tile) and that your
> > packet is trimmed.
> > ___
> > 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".

>  jpeg2000dec.c |   43 ++-
>  1 file changed, 34 insertions(+), 9 deletions(-)
> d9726772b07866243dd21c966649459bb8cbcfed  0002-jpeg2000-decoding-dbginfo.patch
> From ce21789b0da6e7f16c21ea33dcf67586b32630bd Mon Sep 17 00:00:00 2001

> From: Anek 

Make sure the author is containing your full name unless you want to

Re: [FFmpeg-devel] [PATCH 1/2] avformat/rpl: Replace strcpy with av_strlcpy

2019-07-01 Thread Michael Niedermayer
On Sun, Jun 30, 2019 at 12:00:43AM +0100, Cameron Cawley wrote:
> ---
>  libavformat/rpl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

this doesnt apply, against which branch is that patch ?

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.


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] libavformat/mpegtsenc: new interlaced mux mode

2019-07-01 Thread Andreas Håkon
Hi Paul,

> > I disagree. Based on your code the 4 modes do this:
> > < -1 = 0
> > -1 = WRITE_HEADER
> > 0 = WRITE_HEADER | ONE_PACKET_ONLY
> >
> > > 0 = ONE_PACKET_ONLY
> >
> > You documented the meaning of the "modes" in two places and created two
> > helper functions to make sure you pass the correct modes to the underlying
> > function. Why is that if not because you can't seem to remember yourself
> > the meaning of modes? Please reconsider using defines or enums.
>
> Hardcoded values are unacceptable. Every such patch will not be applied
> and if someone applies it by accident it will be reverted ASAP.

The code doesn't use any hardcoded value! What Marton is commenting here it's a
mistake of him. The variable "write_mode" inside the function 
"write_side_streams()"
of the patch is a COUNTER. He thought it had something to do with a comment on 
the
parameter "mode" in the function "mpegts_write_pes()". But is false.

In any case, I'll change the value of the parameter "mode" in 
"mpegts_write_pes()".

Please, note that a new version of the patch is ready published:
https://patchwork.ffmpeg.org/patch/13745/

Regards.
A.H.

---

___
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 1/3] tools/python: add script to convert TensorFlow model (.pb) to native model (.model)

2019-07-01 Thread Pedro Arthur
Em seg, 1 de jul de 2019 às 05:21, Guo, Yejun  escreveu:
>
>
>
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> > Pedro Arthur
> > Sent: Monday, June 24, 2019 11:13 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH V3 1/3] tools/python: add script to 
> > convert
> > TensorFlow model (.pb) to native model (.model)
> >
> > LGTM.
>
> this patch set asks for more comments or push, thanks.
>
Pushed.
___
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] libavformat/mpegtsenc: new interlaced mux mode

2019-07-01 Thread Andreas Håkon
Hi Marton,

> > > > > > -  ts_st->payload = av_mallocz(ts->pes_payload_size);
> > > > > > +  ts_st->payload = av_mallocz(ts->parallel_mux ? 
> > > > > > MAX_PES_PAYLOAD : ts->pes_payload_size);
> > > > > >
> > > > >
> > > > > Could you clarify why this needs to be changed?
> > > >
> > > > Sure! Because when you write in parallel you're delaying the writing of 
> > > > the PES packet.
> > > > So you need to save the entire PES packet. And the ts->pes_payload_size 
> > > > it's defined to
> > > > a very small value (2734 Bytes only)... See at the top of the 
> > > > mpegtsenc.c file:
> > > > #define DEFAULT_PES_HEADER_FREQ 16
> > > > #define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 
> > > > 170)
> > >
> > > OK, but you shold override ts->pes_payload_size, and not the malloc, no?
> > > There is code in mpegts_init which sets pes_payload_size, you should force
> > > it to MAX_PES_PAYLOAD there before doing the round up.
> >
> > No, no! If I override the ts->pes_payload_size then when not using the
> > interleaved some unused memory will be allocated.
> > Please note that when using the sequential mode the payload is writed
> > "directly" to the output stream. And this is true with PES packets with
> > a size greater than pes_payload_size (i.e. video). So the
> > ts->pes_payload_size is used only to store small writes until a PES
> > packet is complete. However, when using the interleaved mode the entire
> > PES packet requires to be saved until the last part is writed in the
> > output stream. For this reason the malloc has different values.
>
> I don't understand your reasoning. Sequential mode is not affected if you
> only increase pes_payload_size if parallel mode is used. Is parallel
> mode affected?

Don't worry!

First of all three points:
1. For the Sequential mode we CAN'T change the value of pes_payload_size.
2. For the Sequential mode we CAN increase the size of the malloc for the 
ts_st->payload.
   But this is useless (a wasted allocated space).
3. If we increase the size of ts->pes_payload_size this will affect to both 
modes.

Why? Perhaps your problem is this: the value of ts->pes_payload_size in the 
current code
doesn't represents the MAX payload size of a PES message, but the MINIMUM size 
for a
PES message. However, for the new Parallel mode, we need to save the total PES 
message
until the last part of it is writed. And for this objective we save it in the
ts_ts->payload; and the size in this case requires to be the MAX_PES_PAYLOAD.

Futhermore, if we increase the size of ts->pes_payload_size this will affect to
both modes.

Just in one line: "ts->pes_payload_size" IS NOT the size of the PES packet !!!

More clear now?



> > > > > > -   for (i = 0; i < ts->nb_services; i++) {
> > > > > > -  service = ts->services[i];
> > > > > >
> > > > > >
> > > > > > ...
> > > > > > }
> > > > > >
> > > > >
> > > > > Why do you need the loop over the services here? It seems unrelated 
> > > > > unless
> > > > > I missed something.
> > > >
> > > > I explained it in my original message...
> > > > The current code has a bug and it doesn't set correctly the value of the
> > > > service->pcr_pid. And this patch requires correct values of pcr_pid for 
> > > > each
> > > > program. Please note that this patch makes complete sense when mixing 
> > > > multiple
> > > > video streams, such as when using multiple programs.
> > >
> > > This should be a separate patch then. I suggest implementing this before
> > > adding interleaving support.
> >
> > Yes and not...
> >
> > 1.  This interleaved mode requires correct value of the service->pcr_pid, 
> > as it have
> > sense with multiple programs. So the "patch" here is mandatory. We can 
> > assume that
> > it's part of the new mux mode.
> >
> > 2.  With the sequential mode, the service->pcr_pid bug is hidden, because 
> > no one uses
> > multiple programs. So a lot of work for me for an irrelevant fix.
> >
> >
> > So I'd prefer to just comment here, and make it all one single change.
>
> We generally split features to different patches to make patch review
> easier. Or to put it in a different way, your patch has bigger chance to
> be reviewed and merged if it touches a single feature.

I understand it. However, my personal objective is to make this patch fit the 
criteria
for acceptance. I published here other patches, but several of them are not 
accepted.
I don't want to discuss your criteria, and I prefer to accept it. However, I 
don't have
the time to fix something that I don't need it. So, I pointed it here as the 
bug exists
and this patch fixes it.

> I see no reason why one couldn't use multiple programs in sequential mode
> so it totally makes sense to implement it, and then implement parallel
> mode on top of that as a separete patch.

Sure, but if this patch is accepted the bug is resolved too.



> > > > > > -   -   NOTE: 'payload' contains a complete PES payload.
> > > > > > 

Re: [FFmpeg-devel] [PATCH] ifv: populate creation_time

2019-07-01 Thread Carl Eugen Hoyos
Am Mo., 1. Juli 2019 um 14:26 Uhr schrieb Peter Ross :
>
> ---
> Small patch, to extract timestamp from IFV file header.

lgtm if tested.

Thank you, Carl Eugen
___
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] ifv: populate creation_time

2019-07-01 Thread Peter Ross
---
Small patch, to extract timestamp from IFV file header.

 libavformat/ifv.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/ifv.c b/libavformat/ifv.c
index 03c682bb9d..6acbb29a75 100644
--- a/libavformat/ifv.c
+++ b/libavformat/ifv.c
@@ -90,7 +90,10 @@ static int parse_header(AVFormatContext *s)
 uint32_t aud_magic;
 uint32_t vid_magic;
 
-avio_skip(s->pb, 0x5c);
+avio_skip(s->pb, 0x34);
+avpriv_dict_set_timestamp(>metadata, "creation_time", avio_rl32(s->pb) 
* 100LL);
+avio_skip(s->pb, 0x24);
+
 ifv->width = avio_rl16(s->pb);
 ifv->height = avio_rl16(s->pb);
 
-- 
2.20.1

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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/http: change error message from numeric code to string

2019-07-01 Thread Liu Steven


> 在 2019年7月1日,下午7:03,Moritz Barsnick  写道:
> 
> On Mon, Jul 01, 2019 at 17:43:59 +0800, Steven Liu wrote:
>> -av_log(h, AV_LOG_ERROR, "URL read error:  %d\n", read_ret);
>> +av_log(h, AV_LOG_ERROR, "URL read error:  %s\n", 
>> av_err2str(read_ret));
>   ^^
> 
> You could also drop one of the two spaces. I don't think they are meant
> to align anything.
patch update: https://patchwork.ffmpeg.org/patch/13790/

Thanks Moritz

Steven

___
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] avformat/http: change error message from numeric code to string

2019-07-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 5a937994cf..579debcd35 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1638,7 +1638,7 @@ static int http_shutdown(URLContext *h, int flags)
 read_ret = ffurl_read(s->hd, buf, sizeof(buf));
 s->hd->flags &= ~AVIO_FLAG_NONBLOCK;
 if (read_ret < 0 && read_ret != AVERROR(EAGAIN)) {
-av_log(h, AV_LOG_ERROR, "URL read error:  %d\n", read_ret);
+av_log(h, AV_LOG_ERROR, "URL read error: %s\n", 
av_err2str(read_ret));
 ret = read_ret;
 }
 }
-- 
2.17.2 (Apple Git-113)



___
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]lavc/r210enc: Fix undefined behaviour encoding r10k

2019-07-01 Thread myp...@gmail.com
On Mon, Jul 1, 2019 at 7:08 PM Carl Eugen Hoyos  wrote:
>
> Hi!
>
> Attached patch fixes an invalid left shift reported in ticket #7982.
>
> Please comment, Carl Eugen
Ha, great catch:), LGTM
___
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/r210enc: Fix undefined behaviour encoding r10k

2019-07-01 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes an invalid left shift reported in ticket #7982.

Please comment, Carl Eugen
From cfe1ae9a1e95dee72ff0e0a45ce8caab98a1bd0b Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 1 Jul 2019 13:06:02 +0200
Subject: [PATCH] lavc/r210enc: Fix undefined behaviour encoding r10k.

Fixes the following ubsan error:
libavcodec/r210enc.c:69:28: runtime error: left shift of 522 by 22 places cannot be represented in type 'int'

Fixes ticket #7982.
---
 libavcodec/r210enc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c
index 02412f3684..95049089bc 100644
--- a/libavcodec/r210enc.c
+++ b/libavcodec/r210enc.c
@@ -60,9 +60,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 uint16_t *srcb = (uint16_t *)srcb_line;
 for (j = 0; j < avctx->width; j++) {
 uint32_t pixel;
-uint16_t r = *srcr++;
-uint16_t g = *srcg++;
-uint16_t b = *srcb++;
+uint32_t r = *srcr++;
+uint32_t g = *srcg++;
+uint32_t b = *srcb++;
 if (avctx->codec_id == AV_CODEC_ID_R210)
 pixel = (r << 20) | (g << 10) | b;
 else
-- 
2.22.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".

Re: [FFmpeg-devel] [PATCH] avformat/http: change error message from numeric code to string

2019-07-01 Thread Moritz Barsnick
On Mon, Jul 01, 2019 at 17:43:59 +0800, Steven Liu wrote:
> -av_log(h, AV_LOG_ERROR, "URL read error:  %d\n", read_ret);
> +av_log(h, AV_LOG_ERROR, "URL read error:  %s\n", 
> av_err2str(read_ret));
   ^^

You could also drop one of the two spaces. I don't think they are meant
to align anything.

Moritz
___
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] libavformat/subfile: Improve AVSEEK_SIZE/SEEK_END seeking

2019-07-01 Thread Nicolas George
Andreas Rheinhardt (12019-06-20):
> The subfile protocol treats an end of 0 as meaning "until EOF"; this got
> implemented by simply setting the end to INT64_MAX. But seeking relative
> to EOF or AVSEEK_SIZE seeking hasn't been adapted; the result is that
> e.g. the duration of transport streams isn't correctly determined when
> this option is used. This is fixed in this patch.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/subfile.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Sorry, I forgot about this patch. Applied, thanks.

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".

Re: [FFmpeg-devel] [PATCH v2] Add 2 timestamp print formats

2019-07-01 Thread Ulf Zibis

Am 29.06.19 um 18:12 schrieb Ulf Zibis:
> Hi,
>
> for my developement of another filter I need additional timestamp print
> formats.
>
> So I like to share my efforts. Are you interested to include them to the
> project?
>
> For libavutil/timestamp.h I'm also wondering, why these format functions
> are designated for "inline". As printing is always a little heavy job,
> an explicit function call would not change much for performance IMHO,
> but would save project footprint.
Because of a rounding issue I had to make a new version.

Please review patch v2.

-Ulf

>From 709cb4662132deff2d17a8700f58fa91b118c56d Mon Sep 17 00:00:00 2001
From: Ulf Zibis 
Date: 29.06.2019, 17:52:06

avutil/timestamp: added 2 new print formats

diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index e082f01..b94e5ce 100644
--- a/libavutil/timestamp.h
+++ b/libavutil/timestamp.h
@@ -48,14 +48,14 @@
 }
 
 /**
- * Convenience macro, the return value should be used only directly in
+ * Convenience macro. The return value should be used only directly in
  * function arguments but never stand-alone.
  */
-#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
+#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts)
 
 /**
  * Fill the provided buffer with a string containing a timestamp time
- * representation.
+ * representation in seconds.
  *
  * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
  * @param ts the timestamp to represent
@@ -70,9 +70,77 @@
 }
 
 /**
- * Convenience macro, the return value should be used only directly in
+ * Convenience macro. The return value should be used only directly in
  * function arguments but never stand-alone.
  */
-#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
+#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
+
+/**
+ * Fill the provided buffer with a string containing a timestamp time
+ * representation in minutes and seconds.
+ *
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
+ * @param ts the timestamp to represent
+ * @param tb the timebase of the timestamp
+ * @return the buffer in input
+ */
+static inline char *av_ts_make_minute_string(char *buf, int64_t ts, AVRational *tb)
+{
+if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
+else {
+double time = av_q2d(*tb) * ts;
+const char *format = (time >= 0 ? "%3d:%09.6f" : "-%3d:%09.6f");
+time = (fabs(time) > INT_MAX * 60.0 ? INT_MAX * 60.0 : fabs(time));
+int len = snprintf(buf, AV_TS_MAX_STRING_SIZE, format, (int)(time / 60), fmod(time, 60));
+if (len - 9 >= 0 && buf[len - 9] > '5') // correct rare rounding issue
+len = snprintf(buf, AV_TS_MAX_STRING_SIZE, format, (int)(time / 60) + 1, .0);
+while (buf[--len] == '0'); // search trailing zeros or ...
+buf[len + (buf[len] != '.')] = '\0'; // dot and strip them
+}
+return buf;
+}
+
+/**
+ * Convenience macro. The return value should be used only directly in
+ * function arguments but never stand-alone.
+ */
+#define av_ts2minutestr(ts, tb) av_ts_make_minute_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
+
+/**
+ * Fill the provided buffer with a string containing a timestamp time
+ * representation in hours, minutes and seconds.
+ *
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
+ * @param ts the timestamp to represent
+ * @param tb the timebase of the timestamp
+ * @return the buffer in input
+ */
+static inline char *av_ts_make_hour_string(char *buf, int64_t ts, AVRational *tb)
+{
+if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
+else {
+double time = av_q2d(*tb) * ts;
+const char *format = (time >= 0 ? "%d:%02d:%09.6f" : "-%d:%02d:%09.6f");
+time = (fabs(time) > INT_MAX * 60.0 * 60.0 ? INT_MAX * 60.0 * 60.0 : fabs(time));
+int hours = time / 60 / 60, minutes = fmod(time / 60, 60);
+int len = snprintf(buf, AV_TS_MAX_STRING_SIZE, format, hours, minutes, fmod(time, 60));
+if (len - 9 >= 0 && buf[len - 9] > '5') { // correct rare rounding issue
+if (++minutes > 59) {
+minutes = 0;
+hours++;
+}
+len = snprintf(buf, AV_TS_MAX_STRING_SIZE, format, hours, minutes, .0);
+}
+while (buf[--len] == '0'); // search trailing zeros or ...
+buf[len + (buf[len] != '.')] = '\0'; // dot and strip them
+}
+return buf;
+}
+
+/**
+ * Convenience macro. The return value should be used only directly in
+ * function arguments but never stand-alone.
+ */
+#define av_ts2hourstr(ts, tb) av_ts_make_hour_string((char[AV_TS_MAX_STRING_SIZE]){'\0'}, ts, tb)
 
 #endif /* AVUTIL_TIMESTAMP_H */
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org

Re: [FFmpeg-devel] [PATCH] avformat/http: add string of the error when only return error number

2019-07-01 Thread Liu Steven


> 在 2019年7月1日,下午4:49,Nicolas George  写道:
> 
> Liu Steven (12019-07-01):
>> Just leave the old numeric code to some people like it. I think the
>> better to remove it, but i cannot sure if that is useful to other
>> people :D.
> 
> Many places only print the error message. I see no difference specific
> to this specific place.

Patch update: https://patchwork.ffmpeg.org/patch/13787/
> 
> 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".

Re: [FFmpeg-devel] [PATCH] avformat/http: add string of the error when only return error number

2019-07-01 Thread Nicolas George
Liu Steven (12019-07-01):
> For example:
> When i debug the code: it give me message:
> 
> [http @ 0x7ff64540c200] URL read error:  -541478725
> after patch:
> [http @ 0x7ff64540c200] URL read error:  End of file
> 
> I think the message after patch is easier to understand :D

I do not understand what you are saying now. With your patch, I think
the message would appear:

[http @ 0x7ff64540c200] URL read error:  (-541478725)End of file

And I do not think the -541478725 brings any good.

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] avformat/http: change error message from numeric code to string

2019-07-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 5a937994cf..f687dc3ae2 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1638,7 +1638,7 @@ static int http_shutdown(URLContext *h, int flags)
 read_ret = ffurl_read(s->hd, buf, sizeof(buf));
 s->hd->flags &= ~AVIO_FLAG_NONBLOCK;
 if (read_ret < 0 && read_ret != AVERROR(EAGAIN)) {
-av_log(h, AV_LOG_ERROR, "URL read error:  %d\n", read_ret);
+av_log(h, AV_LOG_ERROR, "URL read error:  %s\n", 
av_err2str(read_ret));
 ret = read_ret;
 }
 }
-- 
2.17.2 (Apple Git-113)



___
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/http: add string of the error when only return error number

2019-07-01 Thread Liu Steven


> 在 2019年7月1日,下午4:49,Nicolas George  写道:
> 
> Liu Steven (12019-07-01):
>> Just leave the old numeric code to some people like it. I think the
>> better to remove it, but i cannot sure if that is useful to other
>> people :D.
> 
> Many places only print the error message. I see no difference specific
> to this specific place.
Agreed, but string is looks easier to understand than numeric code.

For example:
When i debug the code: it give me message:

[http @ 0x7ff64540c200] URL read error:  -541478725
after patch:
[http @ 0x7ff64540c200] URL read error:  End of file

I think the message after patch is easier to understand :D
Thanks
Steven.

___
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/http: add string of the error when only return error number

2019-07-01 Thread Nicolas George
Liu Steven (12019-07-01):
> Just leave the old numeric code to some people like it. I think the
> better to remove it, but i cannot sure if that is useful to other
> people :D.

Many places only print the error message. I see no difference specific
to this specific place.

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".

Re: [FFmpeg-devel] [PATCH] avformat/http: add string of the error when only return error number

2019-07-01 Thread Liu Steven


> 在 2019年7月1日,下午3:47,Nicolas George  写道:
> 
> Steven Liu (12019-07-01):
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/http.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Any reason to leave the nummeric code at all?
Just leave the old numeric code to some people like it. I think the better to 
remove it, but i cannot sure if that is useful to other people :D.

Thanks

Steven

___
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] libavcodec/vp8dec: fix the multi-thread HWAccel decode error

2019-07-01 Thread Wang, Shaofei
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> myp...@gmail.com
> Sent: Monday, July 1, 2019 3:28 PM
> To: FFmpeg development discussions and patches 
> Cc: Xiang, Haihao 
> Subject: Re: [FFmpeg-devel] [PATCH v3] libavcodec/vp8dec: fix the
> multi-thread HWAccel decode error
> 
> On Mon, Jul 1, 2019 at 2:38 PM Wang, Shaofei 
> wrote:
> Is it this patch https://patchwork.ffmpeg.org/patch/13723/ fix the same
> issue?
It won't fix this issue in vp8.
___
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 1/3] tools/python: add script to convert TensorFlow model (.pb) to native model (.model)

2019-07-01 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Pedro Arthur
> Sent: Monday, June 24, 2019 11:13 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V3 1/3] tools/python: add script to convert
> TensorFlow model (.pb) to native model (.model)
> 
> LGTM.

this patch set asks for more comments or push, thanks.

> 
> BTW I think we should have an ffmpeg controlled repo hosting the
> scripts to train the network and also some pretrained files to easy
> testing.

it is in my todo list.

> 
> Em qua, 19 de jun de 2019 às 21:29, Guo, Yejun 
> escreveu:
> >
> >
> >
___
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] dnn: add layer pad which is equivalent to tf.pad

2019-07-01 Thread Guo, Yejun


> -Original Message-
> From: Guo, Yejun
> Sent: Monday, July 01, 2019 4:08 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Guo, Yejun 
> Subject: [PATCH 1/2] dnn: add layer pad which is equivalent to tf.pad
> 
> the reason to add this layer first is that vf_sr uses it in its
> tensorflow model, and the next plan is to update the python script
> to convert tf.pad into native model.
> 
> Signed-off-by: Guo, Yejun 

this patch set is based on a previous patch at 
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245481.html 
(libavfilter/dnn: move dnn files from   libavfilter to libavfilter/dnn)

> ---
>  libavfilter/dnn/Makefile   |   1 +
>  libavfilter/dnn/dnn_backend_native_layer_pad.c | 211
> +
>  libavfilter/dnn/dnn_backend_native_layer_pad.h |  40 +
>  3 files changed, 252 insertions(+)
>  create mode 100644 libavfilter/dnn/dnn_backend_native_layer_pad.c
>  create mode 100644 libavfilter/dnn/dnn_backend_native_layer_pad.h
> 

___
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] fate: add unit test for dnn-layer-pad

2019-07-01 Thread Guo, Yejun
Signed-off-by: Guo, Yejun 
---
 tests/Makefile |   5 +-
 tests/dnn/Makefile |  11 +++
 tests/dnn/dnn-layer-pad-test.c | 201 +
 tests/fate/dnn.mak |   8 ++
 4 files changed, 224 insertions(+), 1 deletion(-)
 create mode 100644 tests/dnn/Makefile
 create mode 100644 tests/dnn/dnn-layer-pad-test.c
 create mode 100644 tests/fate/dnn.mak

diff --git a/tests/Makefile b/tests/Makefile
index 624292d..0ef571b 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -10,7 +10,8 @@ FFMPEG=ffmpeg$(PROGSSUF)$(EXESUF)
 $(AREF): CMP=
 
 APITESTSDIR := tests/api
-FATE_OUTDIRS = tests/data tests/data/fate tests/data/filtergraphs 
tests/data/lavf tests/data/lavf-fate tests/data/pixfmt tests/vsynth1 
$(APITESTSDIR)
+DNNTESTSDIR := tests/dnn
+FATE_OUTDIRS = tests/data tests/data/fate tests/data/filtergraphs 
tests/data/lavf tests/data/lavf-fate tests/data/pixfmt tests/vsynth1 
$(APITESTSDIR) $(DNNTESTSDIR)
 OUTDIRS += $(FATE_OUTDIRS)
 
 $(VREF): tests/videogen$(HOSTEXESUF) | tests/vsynth1
@@ -85,6 +86,7 @@ FILTERDEMDECENCMUX = $(call ALLYES, $(1:%=%_FILTER) 
$(2)_DEMUXER $(3)_DECODER $(
 PARSERDEMDEC   = $(call ALLYES, $(1)_PARSER $(2)_DEMUXER $(3)_DECODER)
 
 include $(SRC_PATH)/$(APITESTSDIR)/Makefile
+include $(SRC_PATH)/$(DNNTESTSDIR)/Makefile
 
 include $(SRC_PATH)/tests/fate/acodec.mak
 include $(SRC_PATH)/tests/fate/vcodec.mak
@@ -118,6 +120,7 @@ include $(SRC_PATH)/tests/fate/cover-art.mak
 include $(SRC_PATH)/tests/fate/dca.mak
 include $(SRC_PATH)/tests/fate/demux.mak
 include $(SRC_PATH)/tests/fate/dfa.mak
+include $(SRC_PATH)/tests/fate/dnn.mak
 include $(SRC_PATH)/tests/fate/dnxhd.mak
 include $(SRC_PATH)/tests/fate/dpcm.mak
 include $(SRC_PATH)/tests/fate/ea.mak
diff --git a/tests/dnn/Makefile b/tests/dnn/Makefile
new file mode 100644
index 000..b2e6680
--- /dev/null
+++ b/tests/dnn/Makefile
@@ -0,0 +1,11 @@
+DNNTESTPROGS += dnn-layer-pad
+
+DNNTESTOBJS  := $(DNNTESTOBJS:%=$(DNNTESTSDIR)%) 
$(DNNTESTPROGS:%=$(DNNTESTSDIR)/%-test.o)
+DNNTESTPROGS := $(DNNTESTPROGS:%=$(DNNTESTSDIR)/%-test$(EXESUF))
+-include $(wildcard $(DNNTESTOBJS:.o=.d))
+
+$(DNNTESTPROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
+   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter %.o,$^) $(FF_EXTRALIBS) 
$(ELIBS)
+
+testclean::
+   $(RM) $(addprefix $(DNNTESTSDIR)/,$(CLEANSUFFIXES) *-test$(EXESUF))
diff --git a/tests/dnn/dnn-layer-pad-test.c b/tests/dnn/dnn-layer-pad-test.c
new file mode 100644
index 000..fe8eaca
--- /dev/null
+++ b/tests/dnn/dnn-layer-pad-test.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2019 Guo Yejun
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+#include 
+#include "libavfilter/dnn/dnn_backend_native_layer_pad.h"
+
+#define EPSON 0.1
+
+static int test_with_mode_symmetric(void)
+{
+// the input data and expected data are generated with below python code.
+/*
+x = tf.placeholder(tf.float32, shape=[1, None, None, 3])
+y = tf.pad(x, [[0, 0], [2, 3], [3, 2], [0, 0]], 'SYMMETRIC')
+data = np.arange(48).reshape(1, 4, 4, 3);
+
+sess=tf.Session()
+sess.run(tf.global_variables_initializer())
+output = sess.run(y, feed_dict={x: data})
+
+print(list(data.flatten()))
+print(list(output.flatten()))
+print(data.shape)
+print(output.shape)
+*/
+
+LayerPadParams params;
+float input[1*4*4*3] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 
40, 41, 42, 43, 44, 45, 46, 47
+};
+float expected_output[1*9*9*3] = {
+18.0, 19.0, 20.0, 15.0, 16.0, 17.0, 12.0, 13.0, 14.0, 12.0, 13.0, 
14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 21.0, 22.0, 23.0, 
18.0, 19.0, 20.0, 6.0, 7.0, 8.0, 3.0,
+4.0, 5.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 
9.0, 10.0, 11.0, 9.0, 10.0, 11.0, 6.0, 7.0, 8.0, 6.0, 7.0, 8.0, 3.0, 4.0, 5.0, 
0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 3.0,
+4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 9.0, 10.0, 11.0, 6.0, 7.0, 
8.0, 18.0, 19.0, 20.0, 15.0, 16.0, 17.0, 12.0, 13.0, 14.0, 12.0, 13.0, 14.0, 
15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
+21.0, 22.0, 23.0, 21.0, 22.0, 23.0, 18.0, 

[FFmpeg-devel] [PATCH 1/2] dnn: add layer pad which is equivalent to tf.pad

2019-07-01 Thread Guo, Yejun
the reason to add this layer first is that vf_sr uses it in its
tensorflow model, and the next plan is to update the python script
to convert tf.pad into native model.

Signed-off-by: Guo, Yejun 
---
 libavfilter/dnn/Makefile   |   1 +
 libavfilter/dnn/dnn_backend_native_layer_pad.c | 211 +
 libavfilter/dnn/dnn_backend_native_layer_pad.h |  40 +
 3 files changed, 252 insertions(+)
 create mode 100644 libavfilter/dnn/dnn_backend_native_layer_pad.c
 create mode 100644 libavfilter/dnn/dnn_backend_native_layer_pad.h

diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index 1d12ade..83938e5 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -1,5 +1,6 @@
 OBJS-$(CONFIG_DNN)   += dnn/dnn_interface.o
 OBJS-$(CONFIG_DNN)   += dnn/dnn_backend_native.o
+OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_pad.o
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
 
diff --git a/libavfilter/dnn/dnn_backend_native_layer_pad.c 
b/libavfilter/dnn/dnn_backend_native_layer_pad.c
new file mode 100644
index 000..aa12f7f
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_native_layer_pad.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2019 Guo Yejun
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avassert.h"
+#include "dnn_backend_native_layer_pad.h"
+
+static int before_get_buddy(int given, int paddings, LayerPadModeParam mode)
+{
+if (mode == LPMP_SYMMETRIC) {
+return (2 * paddings - 1 - given);
+} else if (mode == LPMP_REFLECT) {
+return (2 * paddings - given);
+} else {
+av_assert0(!"should not reach here");
+return 0;
+}
+}
+
+static int after_get_buddy(int given, int border, LayerPadModeParam mode)
+{
+if (mode == LPMP_SYMMETRIC) {
+int offset = given - border;
+return (border - 1 - offset);
+} else if (mode == LPMP_REFLECT) {
+int offset = given - border;
+return (border - 2 - offset);
+} else {
+av_assert0(!"should not reach here");
+return 0;
+}
+}
+
+void dnn_execute_layer_pad(const float *input, float *output, const 
LayerPadParams *params, int number, int height, int width, int channel)
+{
+int32_t before_paddings;
+int32_t after_paddings;
+
+// suppose format is 
+int new_number = number + params->paddings[0][0] + params->paddings[0][1];
+int new_height = height + params->paddings[1][0] + params->paddings[1][1];
+int new_width = width + params->paddings[2][0] + params->paddings[2][1];
+int new_channel = channel + params->paddings[3][0] + 
params->paddings[3][1];
+
+int c_stride = channel;
+int wc_stride = c_stride * width;
+int hwc_stride = wc_stride * height;
+
+int new_c_stride = new_channel;
+int new_wc_stride = new_c_stride * new_width;
+int new_hwc_stride = new_wc_stride * new_height;
+
+// copy the original data
+for (int n = 0; n < number; n++) {
+for (int h = 0; h < height; h++) {
+for (int w = 0; w < width; w++) {
+const float *src = input + n * hwc_stride + h * wc_stride + w 
* c_stride;
+float *dst = output + (n + params->paddings[0][0]) * 
new_hwc_stride
++ (h + params->paddings[1][0]) * 
new_wc_stride
++ (w + params->paddings[2][0]) * 
new_c_stride
++ params->paddings[3][0];
+memcpy(dst, src, channel * sizeof(float));
+}
+}
+}
+
+// handle the first dimension
+before_paddings = params->paddings[0][0];
+after_paddings = params->paddings[0][1];
+for (int n = 0; n < before_paddings; n++) {
+float *dst = output + n * new_hwc_stride;
+if (params->mode == LPMP_CONSTANT) {
+for (int i = 0; i < new_hwc_stride; i++) {
+*dst = params->constant_values;
+}
+}
+else {
+int buddy = before_get_buddy(n, before_paddings, params->mode);
+float *src = output + buddy * new_hwc_stride;
+memcpy(dst, src, 

Re: [FFmpeg-devel] [PATCH] avformat/http: add string of the error when only return error number

2019-07-01 Thread Nicolas George
Steven Liu (12019-07-01):
> Signed-off-by: Steven Liu 
> ---
>  libavformat/http.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Any reason to leave the nummeric code at all?

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".

Re: [FFmpeg-devel] [PATCH v3] libavcodec/vp8dec: fix the multi-thread HWAccel decode error

2019-07-01 Thread myp...@gmail.com
On Mon, Jul 1, 2019 at 2:38 PM Wang, Shaofei  wrote:
>
> Hello here,
> A simple ping about this patch
> Please feel free to ask if you have any question
Is it this patch https://patchwork.ffmpeg.org/patch/13723/ fix the same issue?
___
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/http: add string of the error when only return error number

2019-07-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 5a937994cf..1ee4d5189c 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1638,7 +1638,7 @@ static int http_shutdown(URLContext *h, int flags)
 read_ret = ffurl_read(s->hd, buf, sizeof(buf));
 s->hd->flags &= ~AVIO_FLAG_NONBLOCK;
 if (read_ret < 0 && read_ret != AVERROR(EAGAIN)) {
-av_log(h, AV_LOG_ERROR, "URL read error:  %d\n", read_ret);
+av_log(h, AV_LOG_ERROR, "URL read error:  %d(%s)\n", read_ret, 
av_err2str(read_ret));
 ret = read_ret;
 }
 }
-- 
2.17.2 (Apple Git-113)



___
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] dashdec: Fix reading values from SegmentTimeline inside, Period

2019-07-01 Thread Liu Steven


> 在 2019年6月29日,上午7:03,Stefan _  写道:
> 
> Hi,
> 
> attached patch fixes a small oversight in dashdec.
> 
> YouTube uses DASH manifests structured like this for live recordings, 
> seeking is currently broken in those cases.
> 
> <0001-dashdec-Fix-reading-values-from-SegmentTimeline-insi.patch>___
> 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".

Pushed

Thanks
Steven

___
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] libavcodec/vp8dec: fix the multi-thread HWAccel decode error

2019-07-01 Thread Wang, Shaofei
Hello here,
A simple ping about this patch
Please feel free to ask if you have any question 
___
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".