[FFmpeg-devel] [PATCH] avcodec/mips: Fix a warnning of indentation not reflect the block structure.

2019-09-08 Thread Shiyou Yin
The indentation of code dose not reflect the if block structure in
'apply_ltp_mips', and this will generate a warnning when build with
'-Wall' or '-Wmisleading-indentation'.
---
 libavcodec/mips/aacdec_mips.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c
index 253cdeb..01a2b30 100644
--- a/libavcodec/mips/aacdec_mips.c
+++ b/libavcodec/mips/aacdec_mips.c
@@ -237,9 +237,9 @@ static void apply_ltp_mips(AACContext *ac, 
SingleChannelElement *sce)
 
 if (ltp->lag < 1024)
 num_samples = ltp->lag + 1024;
-j = (2048 - num_samples) >> 2;
-k = (2048 - num_samples) & 3;
-p_predTime = [num_samples];
+j = (2048 - num_samples) >> 2;
+k = (2048 - num_samples) & 3;
+p_predTime = [num_samples];
 
 for (i = 0; i < num_samples; i++)
 predTime[i] = sce->ltp_state[i + 2048 - ltp->lag] * ltp->coef;
-- 
2.1.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 v2] avformat/movenc: split empty text sample when duration overflow

2019-09-08 Thread Jun Li
On Sun, Sep 8, 2019 at 5:59 PM Jun Li  wrote:

>
>
> On Sun, Sep 8, 2019 at 5:51 PM Jun Li  wrote:
>
>> Fix #7637
>> One empty/end sample is created and inserted between two caption lines
>> when there is a gap.
>> This patch is to split the sample into multiple ones when its duration is
>> too long (>= INT_MAX).
>> ---
>>  libavformat/movenc.c  | 24 ++-
>>  tests/fate/subtitles.mak  |  6 +
>>  tests/ref/fate/binsub-movtextenc-long-dur |  1 +
>>  .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
>>  4 files changed, 26 insertions(+), 6 deletions(-)
>>  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
>>  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase
>>
>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>> index edddfeeb00..aeb7de351f 100644
>> --- a/libavformat/movenc.c
>> +++ b/libavformat/movenc.c
>> @@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s,
>> AVPacket *pkt)
>>   *
>>   * 2) For each subtitle track, check if the current packet's
>>   * dts is past the duration of the last subtitle sample. If
>> - * so, we now need to write an end sample for that subtitle.
>> + * so, we now need to write one or multiple end samples for
>> + * that subtitle.
>>   *
>>   * This must be done conditionally to allow for subtitles that
>>   * immediately replace each other, in which case an end sample
>> @@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s,
>> AVPacket *pkt)
>>  int ret;
>>
>>  if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
>> -trk->track_duration < pkt->dts &&
>> -(trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
>> -ret = mov_write_subtitle_end_packet(s, i,
>> trk->track_duration);
>> -if (ret < 0) return ret;
>> -trk->last_sample_is_subtitle_end = 1;
>> +trk->track_duration < pkt->dts) {
>> +int max_duration = INT_MAX - 1;
>> +if (trk->entry == 0 ||
>> !trk->last_sample_is_subtitle_end) {
>> +ret = mov_write_subtitle_end_packet(s, i,
>> trk->track_duration);
>> +if (ret < 0) return ret;
>> +trk->last_sample_is_subtitle_end = 1;
>> +}
>> +if (trk->last_sample_is_subtitle_end &&
>> +pkt->dts - trk->track_duration > max_duration) {
>> +int64_t dts = trk->track_duration;
>> +while(pkt->dts - dts > max_duration) {
>> +dts += max_duration;
>> +ret = mov_write_subtitle_end_packet(s, i, dts);
>> +if (ret < 0) return ret;
>> +}
>> +}
>>  }
>>  }
>>
>> diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
>> index 0042902161..59055e975c 100644
>> --- a/tests/fate/subtitles.mak
>> +++ b/tests/fate/subtitles.mak
>> @@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i
>> $(TARGET_SAMPLES)/sub/MovText_capabilit
>>  FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc
>>  fate-binsub-movtextenc: CMD = md5 -i
>> $(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text
>> -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
>>
>> +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
>> fate-binsub-movtextenc-long-dur
>> +fate-binsub-movtextenc-long-dur: CMD = md5 -i
>> $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
>> -f mp4 -flags +bitexact -fflags +bitexact -movflags empty_moov
>> +
>> +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
>> fate-binsub-movtextenc-long-dur-timebase
>> +fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i
>> $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
>> -time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags
>> empty_moov
>> +
>>  FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2
>>  fate-sub-mpl2: CMD = fmtstdout ass -i
>> $(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt
>>
>> diff --git a/tests/ref/fate/binsub-movtextenc-long-dur
>> b/tests/ref/fate/binsub-movtextenc-long-dur
>> new file mode 100644
>> index 00..4db0be514b
>> --- /dev/null
>> +++ b/tests/ref/fate/binsub-movtextenc-long-dur
>> @@ -0,0 +1 @@
>> +043848a72c3ae75744115fe8d06c8bf1
>>
>
The md5 is not correct here, wil update in next version.
Meanwhile, sometimes the md5 value changes, not consistent. I have no idea
how that happens, I thought the MP4 output's binary should be always the
same. Does anyone know why ? I would really appreciate that.

-Jun


> diff --git a/tests/ref/fate/binsub-movtextenc-long-dur-timebase
>> b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
>> new file mode 100644
>> 

Re: [FFmpeg-devel] [PATCH v3] hevc_mp4toannexb: Insert correct parameter sets before IRAP

2019-09-08 Thread Andriy Gelman
On Sun, 08. Sep 14:18, Andreas Rheinhardt wrote:
> Andriy Gelman:
> > Changes in v3:
> > Patch 1/2
> > - Fixed a bug where rbsp payload (without 0x03) was
> >   written into packet instead of the raw data (with
> >   0x03).  
> > - Segment packets using ff_h2645_packet_split directly
> >   from mp4-style format without converting to annexb first.
> > - Corrected fate test hash for hevc-bsf-mp4toannexb .
> > 
> > Patch 2/2
> > - Modified fate test so that the output file is
> >   always overwritten.  
> > 
> > 
> > I'm looking for some test data (hevc muxed in mp4) with several temporal 
> > layers
> > where the sub_layer_profile_present_flag[s] is set. Let me know if anyone 
> > can
> > help.
> > 
> > Thanks,
> > Andriy
> > 
> Hello,
> 
> > diff --git a/libavcodec/hevc_mp4toannexb_bsf.c
> b/libavcodec/hevc_mp4toannexb_bsf.c
> > index 09bce5b34c..11ff262a92 100644
> > --- a/libavcodec/hevc_mp4toannexb_bsf.c
> > +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> > @@ -28,14 +28,185 @@
> >  #include "bsf.h"
> >  #include "bytestream.h"
> >  #include "hevc.h"
> > -
> > -#define MIN_HEVCC_LENGTH 23
> > +#include "h2645_parse.h"
> > +#include "hevc_ps.h"
> > +#include "golomb.h"
> > +
> > +#define MIN_HEVCC_LENGTH23
> > +#define PROFILE_WITHOUT_IDC_BITS88
> > +#define IS_IRAP(s)  ((s)->type >= 16 && (s)->type
> <= 23)
> > +#define IS_PARAMSET(s)  ((s)->type >= 32 && (s)->type
> <= 34)
> > +
> > +#define WRITE_NAL(pkt, prev_size, in_buffer) do {
>  \
> > +AV_WB32((pkt)->data + (prev_size), 1);
>  \
> > +prev_size += 4;
>  \
> > +memcpy((pkt)->data + (prev_size), (in_buffer)->data,
> (in_buffer)->size); \
> > +prev_size += (in_buffer)->size;
>  \
> > +} while (0)
> > +
> > +typedef struct Param {
> > +AVBufferRef *raw_data; /*store a copy of the raw data to
> construct extradata*/
> > +int ref;  /*stores the ref of the higher level parameter set*/
> > +} Param;
> > +
> > +/*modified version of HEVCParamSets to store bytestream and
> reference to previous level*/
> > +typedef struct ParamSets {
> > +Param vps_list[HEVC_MAX_VPS_COUNT];
> > +Param sps_list[HEVC_MAX_SPS_COUNT];
> > +Param pps_list[HEVC_MAX_PPS_COUNT];
> > +
> > +AVBufferRef *sei_prefix;
> > +} ParamSets;
> >
> >  typedef struct HEVCBSFContext {
> > -uint8_t  length_size;
> > -int  extradata_parsed;
> > +uint8_t  length_size;
> > +int  extradata_parsed;
> > +ParamSetsps; /*make own of version of HEVCParamSets store
> copy of the bytestream*/
> >  } HEVCBSFContext;
> >
> > +
> > +static int parse_vps(AVBSFContext* ctx, H2645NAL *nal)
> 
> Inconsistent placement of *.
> 
> > +{
> > +int vps_id = 0;
> 
> Unnecessary initialization.
> 
> > +Param *param_ptr;
> > +
> > +HEVCBSFContext *s = ctx->priv_data;
> > +ParamSets *ps = >ps;
> > +
> > +GetBitContext *gb = >gb;
> > +int nal_size  = nal->raw_size;
> > +
> > +vps_id = get_bits(gb, 4);
> > +if (vps_id >= HEVC_MAX_VPS_COUNT) {
> > +av_log(ctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
> > +return AVERROR_INVALIDDATA;
> > +}
> > +
> > +param_ptr = >vps_list[vps_id];
> > +if (param_ptr->raw_data && param_ptr->raw_data->size == nal_size &&
> > +!memcmp(param_ptr->raw_data->data, nal->raw_data, nal_size)) {
> > +av_log(ctx, AV_LOG_DEBUG, "Parsed VPS id: %d. Copy already
> exists in parameter set\n", vps_id);
> > +} else {
> > +AVBufferRef *vps_buf = av_buffer_allocz(nal_size);
> 
> There is no need to zero it as you overwrite the whole buffer a few
> lines below. This goes for SPS and PPS as well.
> Moreover, the very same code for updating the extradata basically
> exists three times. How about factoring it out?
> 
> > +if (!vps_buf)
> > +return AVERROR(ENOMEM);
> > +
> > +/*copy raw data into vps_buf buffer and replace existing
> copy in ps*/
> > +memcpy(vps_buf->data, nal->raw_data, nal_size);
> > +av_buffer_unref(_ptr->raw_data);
> > +param_ptr->raw_data = vps_buf;
> > +}
> > +return 0;
> > +}
> > +
> > +static int parse_sps(AVBSFContext *ctx, H2645NAL *nal)
> > +{
> > +int sps_id, vps_ref, max_sub_layers_minus1;
> > +int i;
> > +Param *param_ptr;
> > +
> > +HEVCBSFContext *s = ctx->priv_data;
> > +ParamSets *ps = >ps;
> > +
> > +GetBitContext *gb = >gb;
> > +int nal_size  = nal->raw_size;
> > +
> > +uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
> > +uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS];
> > +
> > +vps_ref = get_bits(gb, 4);
> > +if (vps_ref >= HEVC_MAX_VPS_COUNT) {
> > +av_log(ctx, AV_LOG_ERROR, "VPS id out of range: %d\n",
> vps_ref);
> > +return AVERROR_INVALIDDATA;
> > +}
> > +
> > +max_sub_layers_minus1 = get_bits(gb, 3);
> > +

Re: [FFmpeg-devel] [PATCH] configure: check for a sufficiently recent enough AMF version

2019-09-08 Thread James Almer
On 9/8/2019 7:51 PM, Hendrik Leppkes wrote:
> Due to the recent addition of Vulkan support to AMF, we require more
> recent headers that include the new structures, which have been
> available since AMF 1.4.9 released in September 2018.
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 4141c1e8f4..8413826f9e 100755
> --- a/configure
> +++ b/configure
> @@ -6617,7 +6617,7 @@ EOF
>  
>  enabled amf &&
>  check_cpp_condition amf "AMF/core/Version.h" \
> -"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
> AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
> +"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
> AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x000100040009"
>  
>  # Funny iconv installations are not unusual, so check it after all flags 
> have been set
>  if enabled libc_iconv; then

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 V1] lavfi/concat: fix logic error in framerate check

2019-09-08 Thread Jun Zhao
From: Jun Zhao 

fix logic error in framerate check, it's introduced by commit
3ad5d4df9ce794d3eeb0f526c5f3e446bf97c616

Signed-off-by: Jun Zhao 
---
 libavfilter/avf_concat.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index 2791859..28bd540 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -136,7 +136,7 @@ static int config_output(AVFilterLink *outlink)
 for (seg = 1; seg < cat->nb_segments; seg++) {
 inlink = ctx->inputs[in_no + seg * ctx->nb_outputs];
 if (outlink->frame_rate.num != inlink->frame_rate.num ||
-outlink->frame_rate.den != outlink->frame_rate.den) {
+outlink->frame_rate.den != inlink->frame_rate.den) {
 av_log(ctx, AV_LOG_VERBOSE,
 "Video inputs have different frame rates, output will be 
VFR\n");
 outlink->frame_rate = av_make_q(1, 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] avformat/movenc: split empty text sample when duration overflow

2019-09-08 Thread Jun Li
On Sun, Sep 8, 2019 at 5:51 PM Jun Li  wrote:

> Fix #7637
> One empty/end sample is created and inserted between two caption lines
> when there is a gap.
> This patch is to split the sample into multiple ones when its duration is
> too long (>= INT_MAX).
> ---
>  libavformat/movenc.c  | 24 ++-
>  tests/fate/subtitles.mak  |  6 +
>  tests/ref/fate/binsub-movtextenc-long-dur |  1 +
>  .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
>  4 files changed, 26 insertions(+), 6 deletions(-)
>  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
>  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index edddfeeb00..aeb7de351f 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>   *
>   * 2) For each subtitle track, check if the current packet's
>   * dts is past the duration of the last subtitle sample. If
> - * so, we now need to write an end sample for that subtitle.
> + * so, we now need to write one or multiple end samples for
> + * that subtitle.
>   *
>   * This must be done conditionally to allow for subtitles that
>   * immediately replace each other, in which case an end sample
> @@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>  int ret;
>
>  if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
> -trk->track_duration < pkt->dts &&
> -(trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
> -ret = mov_write_subtitle_end_packet(s, i,
> trk->track_duration);
> -if (ret < 0) return ret;
> -trk->last_sample_is_subtitle_end = 1;
> +trk->track_duration < pkt->dts) {
> +int max_duration = INT_MAX - 1;
> +if (trk->entry == 0 || !trk->last_sample_is_subtitle_end)
> {
> +ret = mov_write_subtitle_end_packet(s, i,
> trk->track_duration);
> +if (ret < 0) return ret;
> +trk->last_sample_is_subtitle_end = 1;
> +}
> +if (trk->last_sample_is_subtitle_end &&
> +pkt->dts - trk->track_duration > max_duration) {
> +int64_t dts = trk->track_duration;
> +while(pkt->dts - dts > max_duration) {
> +dts += max_duration;
> +ret = mov_write_subtitle_end_packet(s, i, dts);
> +if (ret < 0) return ret;
> +}
> +}
>  }
>  }
>
> diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
> index 0042902161..59055e975c 100644
> --- a/tests/fate/subtitles.mak
> +++ b/tests/fate/subtitles.mak
> @@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i
> $(TARGET_SAMPLES)/sub/MovText_capabilit
>  FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc
>  fate-binsub-movtextenc: CMD = md5 -i
> $(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text
> -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
>
> +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
> fate-binsub-movtextenc-long-dur
> +fate-binsub-movtextenc-long-dur: CMD = md5 -i
> $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
> -f mp4 -flags +bitexact -fflags +bitexact -movflags empty_moov
> +
> +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
> fate-binsub-movtextenc-long-dur-timebase
> +fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i
> $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
> -time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags
> empty_moov
> +
>  FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2
>  fate-sub-mpl2: CMD = fmtstdout ass -i
> $(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt
>
> diff --git a/tests/ref/fate/binsub-movtextenc-long-dur
> b/tests/ref/fate/binsub-movtextenc-long-dur
> new file mode 100644
> index 00..4db0be514b
> --- /dev/null
> +++ b/tests/ref/fate/binsub-movtextenc-long-dur
> @@ -0,0 +1 @@
> +043848a72c3ae75744115fe8d06c8bf1
> diff --git a/tests/ref/fate/binsub-movtextenc-long-dur-timebase
> b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
> new file mode 100644
> index 00..14b2f0167b
> --- /dev/null
> +++ b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
> @@ -0,0 +1 @@
> +043848a72c3ae75744115fe8d06c8bf1
> \ No newline at end of file
> --
> 2.17.1
>
>
Version 2 addressed the feedback from Jan, adding fate test.
The attachment is the sample file for the tests. I will send it to
samples-requ...@ffmpeg.org if this patch is approved.

-Jun
WEBVTT

00:35:47.484 --> 00:35:50.000

[FFmpeg-devel] [PATCH v2] avformat/movenc: split empty text sample when duration overflow

2019-09-08 Thread Jun Li
Fix #7637
One empty/end sample is created and inserted between two caption lines when 
there is a gap.
This patch is to split the sample into multiple ones when its duration is too 
long (>= INT_MAX).
---
 libavformat/movenc.c  | 24 ++-
 tests/fate/subtitles.mak  |  6 +
 tests/ref/fate/binsub-movtextenc-long-dur |  1 +
 .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
 4 files changed, 26 insertions(+), 6 deletions(-)
 create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
 create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index edddfeeb00..aeb7de351f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s, AVPacket 
*pkt)
  *
  * 2) For each subtitle track, check if the current packet's
  * dts is past the duration of the last subtitle sample. If
- * so, we now need to write an end sample for that subtitle.
+ * so, we now need to write one or multiple end samples for
+ * that subtitle.
  *
  * This must be done conditionally to allow for subtitles that
  * immediately replace each other, in which case an end sample
@@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 int ret;
 
 if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
-trk->track_duration < pkt->dts &&
-(trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
-ret = mov_write_subtitle_end_packet(s, i, trk->track_duration);
-if (ret < 0) return ret;
-trk->last_sample_is_subtitle_end = 1;
+trk->track_duration < pkt->dts) {
+int max_duration = INT_MAX - 1;
+if (trk->entry == 0 || !trk->last_sample_is_subtitle_end) {
+ret = mov_write_subtitle_end_packet(s, i, 
trk->track_duration);
+if (ret < 0) return ret;
+trk->last_sample_is_subtitle_end = 1;
+}
+if (trk->last_sample_is_subtitle_end &&
+pkt->dts - trk->track_duration > max_duration) {
+int64_t dts = trk->track_duration;
+while(pkt->dts - dts > max_duration) {
+dts += max_duration;
+ret = mov_write_subtitle_end_packet(s, i, dts);
+if (ret < 0) return ret;
+}
+}
 }
 }
 
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 0042902161..59055e975c 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/MovText_capabilit
 FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc
 fate-binsub-movtextenc: CMD = md5 -i 
$(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f 
mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
 
+FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc-long-dur
+fate-binsub-movtextenc-long-dur: CMD = md5 -i 
$(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text -f 
mp4 -flags +bitexact -fflags +bitexact -movflags empty_moov
+
+FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += 
fate-binsub-movtextenc-long-dur-timebase
+fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i 
$(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text 
-time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags empty_moov
+
 FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2
 fate-sub-mpl2: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt
 
diff --git a/tests/ref/fate/binsub-movtextenc-long-dur 
b/tests/ref/fate/binsub-movtextenc-long-dur
new file mode 100644
index 00..4db0be514b
--- /dev/null
+++ b/tests/ref/fate/binsub-movtextenc-long-dur
@@ -0,0 +1 @@
+043848a72c3ae75744115fe8d06c8bf1
diff --git a/tests/ref/fate/binsub-movtextenc-long-dur-timebase 
b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
new file mode 100644
index 00..14b2f0167b
--- /dev/null
+++ b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
@@ -0,0 +1 @@
+043848a72c3ae75744115fe8d06c8bf1
\ No newline at end of file
-- 
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] rtsp: fix wrong codec setup for some sdp

2019-09-08 Thread Hyun Yoo
From: EaseTheWorld 

rtsp_st->sdp_payload_type is the first codec in 'm=' tag
st->codecpar->id is the first supported codec in 'a=' tag
the two is not guaranteed to be same for example when
1) the order between attributes is random(rfc4566 doesn't force it)
2) the first codec is same for 'm=' and 'a=' but it is unsupported codec
   then st->codecpar->id will be the next one in 'a='(if it's supported)

Signed-off-by: EaseTheWorld 
---
 libavformat/rtsp.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c153cac88b..be3002690e 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -569,6 +569,9 @@ static void sdp_parse_line(AVFormatContext *s, 
SDPParseState *s1,
 get_word(buf1, sizeof(buf1), );
 payload_type = atoi(buf1);
 rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
+// parse only sdp_payload_type specified in 'm=' tag
+if (rtsp_st->sdp_payload_type != payload_type)
+return;
 if (rtsp_st->stream_index >= 0) {
 st = s->streams[rtsp_st->stream_index];
 sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p);
@@ -582,6 +585,10 @@ static void sdp_parse_line(AVFormatContext *s, 
SDPParseState *s1,
 // let dynamic protocol handlers have a stab at the line.
 get_word(buf1, sizeof(buf1), );
 payload_type = atoi(buf1);
+rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
+// parse only sdp_payload_type specified in 'm=' tag
+if (rtsp_st->sdp_payload_type != payload_type)
+return;
 if (s1->seen_rtpmap) {
 parse_fmtp(s, rt, payload_type, buf);
 } else {
-- 
2.23.0.windows.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] configure: check for a sufficiently recent enough AMF version

2019-09-08 Thread Hendrik Leppkes
Due to the recent addition of Vulkan support to AMF, we require more
recent headers that include the new structures, which have been
available since AMF 1.4.9 released in September 2018.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 4141c1e8f4..8413826f9e 100755
--- a/configure
+++ b/configure
@@ -6617,7 +6617,7 @@ EOF
 
 enabled amf &&
 check_cpp_condition amf "AMF/core/Version.h" \
-"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
+"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x000100040009"
 
 # Funny iconv installations are not unusual, so check it after all flags have 
been set
 if enabled libc_iconv; then
-- 
2.23.0.windows.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] avformat/avformat: Introduced `AVInputFormat.read_timestamp2` to fix keyframe seeking for formats that rely on `read_timestamp` for seeking

2019-09-08 Thread Michael Niedermayer
On Sat, Sep 07, 2019 at 03:52:01PM -0700, Darren Mo wrote:
> I think I understand some of what you are saying. You are saying that after 
> the bisection, continuously step backwards + read forward while doubling the 
> step size until the keyframe is found?

yes


> 
> Some questions:
> - What is the difference between the lowercase k and the uppercase K in your 
> diagram? 

the K is the keyframe with largest timestamp before our target
k is another keyframe which we encounter in the example, i added that
to show that we cannot stop when finding a keyframe


> And to make sure I didn’t misunderstand, v is the result of the bisection and 
> A/B/C indicate the steps?

yes

> - Why after finding the keyframe in step C, is there an extra -->?

because we do not know if there are more keyframes in that area before
looking and if there are they would be closer to our target timestamp


> - Re: “there is code somewhere in git to do something similar already”, do 
> you have an idea of what I should search for to find this code?

ff_find_last_ts()

thanks


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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] avfilter/vf_fps: Avoid inlink fifo build up.

2019-09-08 Thread Thierry Foucu
ping?

On Wed, Aug 28, 2019 at 7:14 PM Nikolas Bowe 
wrote:

> When duplicating frames we need to schedule for activation again,
> otherwise frames can build up in the inlink fifo.
> ---
>  libavfilter/vf_fps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
> index 6b99f20d2b..cf1e36726a 100644
> --- a/libavfilter/vf_fps.c
> +++ b/libavfilter/vf_fps.c
> @@ -256,7 +256,7 @@ static int write_frame(AVFilterContext *ctx,
> FPSContext *s, AVFilterLink *outlin
>  av_log(ctx, AV_LOG_DEBUG, "Writing frame with pts %"PRId64" to
> pts %"PRId64"\n",
> s->frames[0]->pts, frame->pts);
>  s->cur_frame_out++;
> -
> +*again = 1;
>  return ff_filter_frame(outlink, frame);
>  }
>  }
> --
> 2.23.0.187.g17f5b7556c-goog
>
> ___
> 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] rtsp: fix wrong codec setup for some sdp

2019-09-08 Thread Michael Niedermayer
On Sun, Sep 08, 2019 at 10:28:49AM +0900, Hyun Yoo wrote:
> Sorry about this.
> At first I commit with git format-patch & send-email on my desktop
> but it was discarded because I didn't subcribe to devel mailing list.
> After join the ml I forwarded the mail on mobile gmail which might cause
> the extra newline mess.
> What should I do now?
> git send-email commit the same patch again?

yes but try to send it to yourself first, if it is ok then
resubmit to ML

thanks

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

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


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 2/4] avcodec/h264_slice: clear frame only on gaps when it is not otherwise initilaized

2019-09-08 Thread Michael Niedermayer
Fixes: Timeout (53sec -> 31sec)
Fixes: 
16908/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711207859748864

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5ceee107a0..e24d41ca50 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -458,12 +458,6 @@ static int h264_frame_start(H264Context *h)
 H264Picture *pic;
 int i, ret;
 const int pixel_shift = h->pixel_shift;
-int c[4] = {
-1<<(h->ps.sps->bit_depth_luma-1),
-1<<(h->ps.sps->bit_depth_chroma-1),
-1<<(h->ps.sps->bit_depth_chroma-1),
--1
-};
 
 if (!ff_thread_can_start_frame(h->avctx)) {
 av_log(h->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP 
state\n");
@@ -504,8 +498,6 @@ static int h264_frame_start(H264Context *h)
 
 if ((ret = alloc_picture(h, pic)) < 0)
 return ret;
-if(!h->frame_recovered && !h->avctx->hwaccel)
-ff_color_frame(pic->f, c);
 
 h->cur_pic_ptr = pic;
 ff_h264_unref_picture(h, >cur_pic);
@@ -1582,6 +1574,13 @@ static int h264_field_start(H264Context *h, const 
H264SliceContext *sl,
  * vectors.  Given we are concealing a lost frame, this probably
  * is not noticeable by comparison, but it should be fixed. */
 if (h->short_ref_count) {
+int c[4] = {
+1<<(h->ps.sps->bit_depth_luma-1),
+1<<(h->ps.sps->bit_depth_chroma-1),
+1<<(h->ps.sps->bit_depth_chroma-1),
+-1
+};
+
 if (prev &&
 h->short_ref[0]->f->width == prev->f->width &&
 h->short_ref[0]->f->height == prev->f->height &&
@@ -1597,7 +1596,8 @@ static int h264_field_start(H264Context *h, const 
H264SliceContext *sl,
   prev->f->width,
   prev->f->height);
 h->short_ref[0]->poc = prev->poc + 2;
-}
+} else if (!h->frame_recovered && !h->avctx->hwaccel)
+ff_color_frame(h->short_ref[0]->f, c);
 h->short_ref[0]->frame_num = h->poc.prev_frame_num;
 }
 }
-- 
2.23.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 4/4] avcodec/utils: Optimize ff_color_frame() using memcpy()

2019-09-08 Thread Michael Niedermayer
4650975 -> 4493240 dezicycles

This optimizes lines 2 and later. Line 1 still uses av_memcpy_backptr()
This change originally fixed ossfuzz 10790 but this is now fixed by other
optimizations already

Signed-off-by: Michael Niedermayer 
---
 libavcodec/utils.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 132f887343..1ac13f6bc3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -421,13 +421,19 @@ void ff_color_frame(AVFrame *frame, const int c[4])
 int is_chroma = p == 1 || p == 2;
 int bytes  = is_chroma ? AV_CEIL_RSHIFT(frame->width,  
desc->log2_chroma_w) : frame->width;
 int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, 
desc->log2_chroma_h) : frame->height;
-for (y = 0; y < height; y++) {
-if (desc->comp[0].depth >= 9) {
-((uint16_t*)dst)[0] = c[p];
-av_memcpy_backptr(dst + 2, 2, bytes - 2);
-}else
-memset(dst, c[p], bytes);
+if (desc->comp[0].depth >= 9) {
+((uint16_t*)dst)[0] = c[p];
+av_memcpy_backptr(dst + 2, 2, bytes - 2);
 dst += frame->linesize[p];
+for (y = 1; y < height; y++) {
+memcpy(dst, frame->data[p], 2*bytes);
+dst += frame->linesize[p];
+}
+} else {
+for (y = 0; y < height; y++) {
+memset(dst, c[p], bytes);
+dst += frame->linesize[p];
+}
 }
 }
 }
-- 
2.23.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 1/4] avcodec/utils: Use av_memcpy_backptr() in ff_color_frame()

2019-09-08 Thread Michael Niedermayer
Fixes: Timeout (191sec -> 53sec)
Fixes: 
16908/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711207859748864
Fixes: 
10709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5630617975259136

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

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a6a646636d..132f887343 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -412,7 +412,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int 
nb_channels,
 void ff_color_frame(AVFrame *frame, const int c[4])
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
-int p, y, x;
+int p, y;
 
 av_assert0(desc->flags & AV_PIX_FMT_FLAG_PLANAR);
 
@@ -423,8 +423,8 @@ void ff_color_frame(AVFrame *frame, const int c[4])
 int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, 
desc->log2_chroma_h) : frame->height;
 for (y = 0; y < height; y++) {
 if (desc->comp[0].depth >= 9) {
-for (x = 0; xlinesize[p];
-- 
2.23.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 3/4] avcodec/aacdec: Check if we run out of input in read_stream_mux_config()

2019-09-08 Thread Michael Niedermayer
Fixes: Infinite loop
Fixes: 
16920/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5653421289373696

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

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 98b6e58be3..d17852d8ba 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -409,6 +409,8 @@ static int read_stream_mux_config(struct LATMContext 
*latmctx,
 } else {
 int esc;
 do {
+if (get_bits_left(gb) < 9)
+return AVERROR_INVALIDDATA;
 esc = get_bits(gb, 1);
 skip_bits(gb, 8);
 } while (esc);
-- 
2.23.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 v3] hevc_mp4toannexb: Insert correct parameter sets before IRAP

2019-09-08 Thread Andriy Gelman
Hey Andreas, 

Thanks for reviewing. 
I've actually just finished the updated version that removes emulation 0x03 
bytes 
from the relevant nal units only (as you suggested in the previous review). The
other nal units are just copied over.

I'll add your changes to that version

On Sun, 08. Sep 14:18, Andreas Rheinhardt wrote:
> Andriy Gelman:
> > Changes in v3:
> > Patch 1/2
> > - Fixed a bug where rbsp payload (without 0x03) was
> >   written into packet instead of the raw data (with
> >   0x03).  
> > - Segment packets using ff_h2645_packet_split directly
> >   from mp4-style format without converting to annexb first.
> > - Corrected fate test hash for hevc-bsf-mp4toannexb .
> > 
> > Patch 2/2
> > - Modified fate test so that the output file is
> >   always overwritten.  
> > 
> > 
> > I'm looking for some test data (hevc muxed in mp4) with several temporal 
> > layers
> > where the sub_layer_profile_present_flag[s] is set. Let me know if anyone 
> > can
> > help.
> > 
> > Thanks,
> > Andriy
> > 
> Hello,
> 
> > diff --git a/libavcodec/hevc_mp4toannexb_bsf.c
> b/libavcodec/hevc_mp4toannexb_bsf.c
> > index 09bce5b34c..11ff262a92 100644
> > --- a/libavcodec/hevc_mp4toannexb_bsf.c
> > +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> > @@ -28,14 +28,185 @@
> >  #include "bsf.h"
> >  #include "bytestream.h"
> >  #include "hevc.h"
> > -
> > -#define MIN_HEVCC_LENGTH 23
> > +#include "h2645_parse.h"
> > +#include "hevc_ps.h"
> > +#include "golomb.h"
> > +
> > +#define MIN_HEVCC_LENGTH23
> > +#define PROFILE_WITHOUT_IDC_BITS88
> > +#define IS_IRAP(s)  ((s)->type >= 16 && (s)->type
> <= 23)
> > +#define IS_PARAMSET(s)  ((s)->type >= 32 && (s)->type
> <= 34)
> > +
> > +#define WRITE_NAL(pkt, prev_size, in_buffer) do {
>  \
> > +AV_WB32((pkt)->data + (prev_size), 1);
>  \
> > +prev_size += 4;
>  \
> > +memcpy((pkt)->data + (prev_size), (in_buffer)->data,
> (in_buffer)->size); \
> > +prev_size += (in_buffer)->size;
>  \
> > +} while (0)
> > +
> > +typedef struct Param {
> > +AVBufferRef *raw_data; /*store a copy of the raw data to
> construct extradata*/
> > +int ref;  /*stores the ref of the higher level parameter set*/
> > +} Param;
> > +
> > +/*modified version of HEVCParamSets to store bytestream and
> reference to previous level*/
> > +typedef struct ParamSets {
> > +Param vps_list[HEVC_MAX_VPS_COUNT];
> > +Param sps_list[HEVC_MAX_SPS_COUNT];
> > +Param pps_list[HEVC_MAX_PPS_COUNT];
> > +
> > +AVBufferRef *sei_prefix;
> > +} ParamSets;
> >
> >  typedef struct HEVCBSFContext {
> > -uint8_t  length_size;
> > -int  extradata_parsed;
> > +uint8_t  length_size;
> > +int  extradata_parsed;
> > +ParamSetsps; /*make own of version of HEVCParamSets store
> copy of the bytestream*/
> >  } HEVCBSFContext;
> >
> > +
> > +static int parse_vps(AVBSFContext* ctx, H2645NAL *nal)
> 

> Inconsistent placement of *.
> 
> > +{
> > +int vps_id = 0;
> 
> Unnecessary initialization.

Will remove initialization and change * position.

> 
> > +Param *param_ptr;
> > +
> > +HEVCBSFContext *s = ctx->priv_data;
> > +ParamSets *ps = >ps;
> > +
> > +GetBitContext *gb = >gb;
> > +int nal_size  = nal->raw_size;
> > +
> > +vps_id = get_bits(gb, 4);
> > +if (vps_id >= HEVC_MAX_VPS_COUNT) {
> > +av_log(ctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
> > +return AVERROR_INVALIDDATA;
> > +}
> > +
> > +param_ptr = >vps_list[vps_id];
> > +if (param_ptr->raw_data && param_ptr->raw_data->size == nal_size &&
> > +!memcmp(param_ptr->raw_data->data, nal->raw_data, nal_size)) {
> > +av_log(ctx, AV_LOG_DEBUG, "Parsed VPS id: %d. Copy already
> exists in parameter set\n", vps_id);
> > +} else {
> > +AVBufferRef *vps_buf = av_buffer_allocz(nal_size);

> 
> There is no need to zero it as you overwrite the whole buffer a few
> lines below. This goes for SPS and PPS as well.
> Moreover, the very same code for updating the extradata basically
> exists three times. How about factoring it out?

ok, I'll refactor this part.

> 
> > +if (!vps_buf)
> > +return AVERROR(ENOMEM);
> > +
> > +/*copy raw data into vps_buf buffer and replace existing
> copy in ps*/
> > +memcpy(vps_buf->data, nal->raw_data, nal_size);
> > +av_buffer_unref(_ptr->raw_data);
> > +param_ptr->raw_data = vps_buf;
> > +}
> > +return 0;
> > +}
> > +
> > +static int parse_sps(AVBSFContext *ctx, H2645NAL *nal)
> > +{
> > +int sps_id, vps_ref, max_sub_layers_minus1;
> > +int i;
> > +Param *param_ptr;
> > +
> > +HEVCBSFContext *s = ctx->priv_data;
> > +ParamSets *ps = >ps;
> > +
> > +GetBitContext *gb = >gb;
> > +int nal_size  = nal->raw_size;
> > +
> > +uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
> 

Re: [FFmpeg-devel] [PATCH v3] Allow 'concat' filter to support inputs with different frame rates

2019-09-08 Thread Nicolas George
Calvin Walton (12019-08-30):
> Right now, the concat filter does not set the frame_rate value on any of
> the out links. As a result, the default ffmpeg behaviour kicks in - to
> copy the framerate from the first input to the outputs.
> 
> If a later input is higher framerate, this results in dropped frames; if
> a later input is lower framerate it might cause judder.
> 
> This patch checks if all of the video inputs have the same framerate, and
> if not it sets the out link to use '1/0' as the frame rate, the value
> meaning "unknown/vfr".
> 
> A test is added to verify the VFR behaviour. The existing test for CFR
> behaviour passes unchanged.
> ---
> Updated version of
> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-March/208251.html
> 
> Fixes the missing concat-vfr filtergraph for tests, and adds a newline
> to the end of the log message.
> 
>  libavfilter/avf_concat.c |  15 ++-
>  tests/fate/filter-video.mak  |   4 +-
>  tests/filtergraphs/concat-vfr|   8 ++
>  tests/ref/fate/filter-concat-vfr | 224 +++
>  4 files changed, 249 insertions(+), 2 deletions(-)
>  create mode 100644 tests/filtergraphs/concat-vfr
>  create mode 100644 tests/ref/fate/filter-concat-vfr

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 v3] hevc_mp4toannexb: Insert correct parameter sets before IRAP

2019-09-08 Thread Andreas Rheinhardt
Andriy Gelman:
> Changes in v3:
> Patch 1/2
> - Fixed a bug where rbsp payload (without 0x03) was
>   written into packet instead of the raw data (with
>   0x03).  
> - Segment packets using ff_h2645_packet_split directly
>   from mp4-style format without converting to annexb first.
> - Corrected fate test hash for hevc-bsf-mp4toannexb .
> 
> Patch 2/2
> - Modified fate test so that the output file is
>   always overwritten.  
> 
> 
> I'm looking for some test data (hevc muxed in mp4) with several temporal 
> layers
> where the sub_layer_profile_present_flag[s] is set. Let me know if anyone can
> help.
> 
> Thanks,
> Andriy
> 
Hello,

> diff --git a/libavcodec/hevc_mp4toannexb_bsf.c
b/libavcodec/hevc_mp4toannexb_bsf.c
> index 09bce5b34c..11ff262a92 100644
> --- a/libavcodec/hevc_mp4toannexb_bsf.c
> +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> @@ -28,14 +28,185 @@
>  #include "bsf.h"
>  #include "bytestream.h"
>  #include "hevc.h"
> -
> -#define MIN_HEVCC_LENGTH 23
> +#include "h2645_parse.h"
> +#include "hevc_ps.h"
> +#include "golomb.h"
> +
> +#define MIN_HEVCC_LENGTH23
> +#define PROFILE_WITHOUT_IDC_BITS88
> +#define IS_IRAP(s)  ((s)->type >= 16 && (s)->type
<= 23)
> +#define IS_PARAMSET(s)  ((s)->type >= 32 && (s)->type
<= 34)
> +
> +#define WRITE_NAL(pkt, prev_size, in_buffer) do {
 \
> +AV_WB32((pkt)->data + (prev_size), 1);
 \
> +prev_size += 4;
 \
> +memcpy((pkt)->data + (prev_size), (in_buffer)->data,
(in_buffer)->size); \
> +prev_size += (in_buffer)->size;
 \
> +} while (0)
> +
> +typedef struct Param {
> +AVBufferRef *raw_data; /*store a copy of the raw data to
construct extradata*/
> +int ref;  /*stores the ref of the higher level parameter set*/
> +} Param;
> +
> +/*modified version of HEVCParamSets to store bytestream and
reference to previous level*/
> +typedef struct ParamSets {
> +Param vps_list[HEVC_MAX_VPS_COUNT];
> +Param sps_list[HEVC_MAX_SPS_COUNT];
> +Param pps_list[HEVC_MAX_PPS_COUNT];
> +
> +AVBufferRef *sei_prefix;
> +} ParamSets;
>
>  typedef struct HEVCBSFContext {
> -uint8_t  length_size;
> -int  extradata_parsed;
> +uint8_t  length_size;
> +int  extradata_parsed;
> +ParamSetsps; /*make own of version of HEVCParamSets store
copy of the bytestream*/
>  } HEVCBSFContext;
>
> +
> +static int parse_vps(AVBSFContext* ctx, H2645NAL *nal)

Inconsistent placement of *.

> +{
> +int vps_id = 0;

Unnecessary initialization.

> +Param *param_ptr;
> +
> +HEVCBSFContext *s = ctx->priv_data;
> +ParamSets *ps = >ps;
> +
> +GetBitContext *gb = >gb;
> +int nal_size  = nal->raw_size;
> +
> +vps_id = get_bits(gb, 4);
> +if (vps_id >= HEVC_MAX_VPS_COUNT) {
> +av_log(ctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
> +return AVERROR_INVALIDDATA;
> +}
> +
> +param_ptr = >vps_list[vps_id];
> +if (param_ptr->raw_data && param_ptr->raw_data->size == nal_size &&
> +!memcmp(param_ptr->raw_data->data, nal->raw_data, nal_size)) {
> +av_log(ctx, AV_LOG_DEBUG, "Parsed VPS id: %d. Copy already
exists in parameter set\n", vps_id);
> +} else {
> +AVBufferRef *vps_buf = av_buffer_allocz(nal_size);

There is no need to zero it as you overwrite the whole buffer a few
lines below. This goes for SPS and PPS as well.
Moreover, the very same code for updating the extradata basically
exists three times. How about factoring it out?

> +if (!vps_buf)
> +return AVERROR(ENOMEM);
> +
> +/*copy raw data into vps_buf buffer and replace existing
copy in ps*/
> +memcpy(vps_buf->data, nal->raw_data, nal_size);
> +av_buffer_unref(_ptr->raw_data);
> +param_ptr->raw_data = vps_buf;
> +}
> +return 0;
> +}
> +
> +static int parse_sps(AVBSFContext *ctx, H2645NAL *nal)
> +{
> +int sps_id, vps_ref, max_sub_layers_minus1;
> +int i;
> +Param *param_ptr;
> +
> +HEVCBSFContext *s = ctx->priv_data;
> +ParamSets *ps = >ps;
> +
> +GetBitContext *gb = >gb;
> +int nal_size  = nal->raw_size;
> +
> +uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
> +uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS];
> +
> +vps_ref = get_bits(gb, 4);
> +if (vps_ref >= HEVC_MAX_VPS_COUNT) {
> +av_log(ctx, AV_LOG_ERROR, "VPS id out of range: %d\n",
vps_ref);
> +return AVERROR_INVALIDDATA;
> +}
> +
> +max_sub_layers_minus1 = get_bits(gb, 3);
> +skip_bits1(gb);
/*sps_temporal_id_nesting_flag*/
> +skip_bits(gb, PROFILE_WITHOUT_IDC_BITS); /*profile_tier_level*/
> +skip_bits(gb, 8);/*general_level_idc*/
> +
> +for (i = 0; i < max_sub_layers_minus1; ++i) {
> +sub_layer_profile_present_flag[i] = get_bits1(gb);
> +sub_layer_level_present_flag[i]   = get_bits1(gb);
> +}
> 

[FFmpeg-devel] [PATCH v3 2/2] swscale/swscale: various cosmetics for the code style

2019-09-08 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libswscale/swscale.c | 66 +++-
 1 file changed, 24 insertions(+), 42 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b4f958a..5212317 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -242,12 +242,10 @@ static int swscale(SwsContext *c, const uint8_t *src[],
  * and faster */
 const int dstW   = c->dstW;
 const int dstH   = c->dstH;
-
 const enum AVPixelFormat dstFormat = c->dstFormat;
 const int flags  = c->flags;
 int32_t *vLumFilterPos   = c->vLumFilterPos;
 int32_t *vChrFilterPos   = c->vChrFilterPos;
-
 const int vLumFilterSize = c->vLumFilterSize;
 const int vChrFilterSize = c->vChrFilterSize;
 
@@ -271,7 +269,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 int lastInLumBuf = c->lastInLumBuf;
 int lastInChrBuf = c->lastInChrBuf;
 
-
 int lumStart = 0;
 int lumEnd = c->descIndex[0];
 int chrStart = lumEnd;
@@ -283,20 +280,16 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 SwsSlice *vout_slice = >slice[c->numSlice-1];
 SwsFilterDescriptor *desc = c->desc;
 
-
 int needAlpha = c->needAlpha;
 
 int hasLumHoles = 1;
 int hasChrHoles = 1;
 
-
 if (isPacked(c->srcFormat)) {
-src[1] =
-src[2] =
-src[3] = src[0];
-srcStride[1] =
-srcStride[2] =
-srcStride[3] = srcStride[0];
+for (int i = 1; i < 4; i++) {
+src[i] = src[0];
+srcStride[i] = srcStride[0];
+}
 }
 srcStride[1] <<= c->vChrDrop;
 srcStride[2] <<= c->vChrDrop;
@@ -322,11 +315,10 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 }
 }
 
-if (   (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15
-|| (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || (uintptr_t)src[2]&15
-|| dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || 
dstStride[3]&15
-|| srcStride[0]&15 || srcStride[1]&15 || srcStride[2]&15 || 
srcStride[3]&15
-) {
+if ((uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15 ||
+(uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || (uintptr_t)src[2]&15 ||
+dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || 
dstStride[3]&15 ||
+srcStride[0]&15 || srcStride[1]&15 || srcStride[2]&15 || 
srcStride[3]&15) {
 static int warnedAlready=0;
 int cpu_flags = av_get_cpu_flags();
 if (HAVE_MMXEXT && (cpu_flags & AV_CPU_FLAG_SSE2) && !warnedAlready){
@@ -339,11 +331,9 @@ static int swscale(SwsContext *c, const uint8_t *src[],
  * will not get executed. This is not really intended but works
  * currently, so people might do it. */
 if (srcSliceY == 0) {
-lumBufIndex  = -1;
-chrBufIndex  = -1;
+lumBufIndex  = chrBufIndex  = -1;
 dstY = 0;
-lastInLumBuf = -1;
-lastInChrBuf = -1;
+lastInLumBuf = lastInChrBuf = -1;
 }
 
 if (!should_dither) {
@@ -366,16 +356,14 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 hout_slice->plane[2].sliceY = lastInChrBuf + 1;
 hout_slice->plane[3].sliceY = lastInLumBuf + 1;
 
-hout_slice->plane[0].sliceH =
-hout_slice->plane[1].sliceH =
-hout_slice->plane[2].sliceH =
-hout_slice->plane[3].sliceH = 0;
+for (int i = 0; i < 4; i++)
+hout_slice->plane[i].sliceH = 0;
 hout_slice->width = dstW;
 }
 
 for (; dstY < dstH; dstY++) {
 const int chrDstY = dstY >> c->chrDstVSubSample;
-int use_mmx_vfilter= c->use_mmx_vfilter;
+int use_mmx_vfilter = c->use_mmx_vfilter;
 
 // First line needed as input
 const int firstLumSrcY  = FFMAX(1 - vLumFilterSize, 
vLumFilterPos[dstY]);
@@ -394,7 +382,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
 // handle holes (FAST_BILINEAR & weird filters)
 if (firstLumSrcY > lastInLumBuf) {
-
 hasLumHoles = lastInLumBuf != firstLumSrcY - 1;
 if (hasLumHoles) {
 hout_slice->plane[0].sliceY = firstLumSrcY;
@@ -406,7 +393,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 lastInLumBuf = firstLumSrcY - 1;
 }
 if (firstChrSrcY > lastInChrBuf) {
-
 hasChrHoles = lastInChrBuf != firstChrSrcY - 1;
 if (hasChrHoles) {
 hout_slice->plane[1].sliceY = firstChrSrcY;
@@ -438,7 +424,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 av_assert0((lastLumSrcY - firstLumSrcY + 1) <= 
hout_slice->plane[0].available_lines);
 av_assert0((lastChrSrcY - firstChrSrcY + 1) <= 
hout_slice->plane[1].available_lines);
 
-
 posY = hout_slice->plane[0].sliceY + hout_slice->plane[0].sliceH;
 

[FFmpeg-devel] [PATCH v3 1/2] swscale/swscale: delete unwanted assignments

2019-09-08 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libswscale/swscale.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4069550..b4f958a 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -291,11 +291,9 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
 
 if (isPacked(c->srcFormat)) {
-src[0] =
 src[1] =
 src[2] =
 src[3] = src[0];
-srcStride[0] =
 srcStride[1] =
 srcStride[2] =
 srcStride[3] = srcStride[0];
-- 
2.6.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".

Re: [FFmpeg-devel] [PATCH v1] swscale/swscale: various cosmetics for the code style

2019-09-08 Thread Limin Wang
On Sun, Sep 08, 2019 at 01:53:12PM +0200, Moritz Barsnick wrote:
> On Sat, Sep 07, 2019 at 16:20:35 -0400, Andriy Gelman wrote:
> > >  if (isPacked(c->srcFormat)) {
> > > -src[0] =
> > > -src[1] =
> > > -src[2] =
> > > -src[3] = src[0];
> > > -srcStride[0] =
> > > -srcStride[1] =
> > > -srcStride[2] =
> > > -srcStride[3] = srcStride[0];
> >
> > > +for ( int i = 0; i < 4; i++ ) {
> >
> > extra spaces and I guess you can start i from 1
> 
> I actually wonder what the original point was of assigning src[0] to
> src[0].
it's cosmetics change, so I want to keep same logic with the old code.
Maybe we can split the patch if the code isn't reasonable.


> 
> > > -if (   (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || 
> > > (uintptr_t)dst[2]&15
> > > +if ((uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || 
> > > (uintptr_t)dst[2]&15
> > >  || (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || 
> > > (uintptr_t)src[2]&15
> 
> BTW, the original indentation was meant for alignment.
OK, if for alignment, I'll adjust it.

> 
> > > +for(int i = 0; i < 4; i++)
> 
> "for (" is the correct style.
OK, maybe I misunderstand. I'll update it.


> 
> 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".
___
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 v1] swscale/swscale: various cosmetics for the code style

2019-09-08 Thread Moritz Barsnick
On Sat, Sep 07, 2019 at 16:20:35 -0400, Andriy Gelman wrote:
> >  if (isPacked(c->srcFormat)) {
> > -src[0] =
> > -src[1] =
> > -src[2] =
> > -src[3] = src[0];
> > -srcStride[0] =
> > -srcStride[1] =
> > -srcStride[2] =
> > -srcStride[3] = srcStride[0];
>
> > +for ( int i = 0; i < 4; i++ ) {
>
> extra spaces and I guess you can start i from 1

I actually wonder what the original point was of assigning src[0] to
src[0].

> > -if (   (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || 
> > (uintptr_t)dst[2]&15
> > +if ((uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || 
> > (uintptr_t)dst[2]&15
> >  || (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || 
> > (uintptr_t)src[2]&15

BTW, the original indentation was meant for alignment.

> > +for(int i = 0; i < 4; i++)

"for (" is the correct style.

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] tests: Fix bash errors in lavf_container tests.

2019-09-08 Thread Limin Wang
On Sun, Sep 08, 2019 at 12:46:25AM +0300, Andrey Semashev wrote:
> On 2019-09-07 18:32, Limin Wang wrote:
> >On Sat, Sep 07, 2019 at 05:19:55PM +0200, Michael Niedermayer wrote:
> >>On Wed, Aug 28, 2019 at 06:32:37PM +0300, Andrey Semashev wrote:
> >>>Because lavf_container is sometimes called with only 2 arguments,
> >>>fate tests produce bash errors like this:
> >>>
> >>>   tests/fate-run.sh: 299: test: =: unexpected operator
> >>>
> >>>This commit fixes this.
> >>>---
> >>>  tests/fate-run.sh | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >>I think this change is correct but shell is not my area ...
> >If the $2 is two arguments between with space, the patch is needed.
> 
> $2 is a single argument that may contain spaces. It is interpreted
> as a single argument as long as it is enclosed in quotes in
> lavf_container invokation.
> 
> The problem is caused not by $2 but by the fact there is no $3. See
> lavf_container_attach, lavf_container_timecode_nodrop,
> lavf_container_timecode_drop and lavf_container_timecode functions,
> as well as a few tests in tests/fate/lavf-container.mak.
> 
> >Why I haven't got such errors when I'm running fate?
> 
> I noticed the errors when the tests failed (due to my local changes
> not relevant to this patch). I don't know the details about how
> tests are run, but maybe the output is suppressed when the tests
> pass?
The patch looks good to me, but I don't have push access. Please ask for
other developer to push it.


> ___
> 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 v2 1/2] avfilter/vf_scale: split the scale_frame function from filter_frame for activate function support

2019-09-08 Thread Limin Wang
On Sun, Sep 08, 2019 at 02:15:28AM +0200, Michael Niedermayer wrote:
> On Sat, Sep 07, 2019 at 11:11:25PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_scale.c | 26 ++
> >  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> will apply

Thanks, the first patch is for patch#2, please help to review the second patch: 
[PATCH v2 2/2] avfilter/vf_scale: change filter_frame interface to activate 
interface.

> 
> [...]
> -- 
> 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.



> ___
> 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 v1 1/3] avfilter/f_sidedata: try to fix warning: comparison of constant -1 with expression of type 'enum AVFrameSideDataType'

2019-09-08 Thread Limin Wang

ping, #patch 2 is pushed already.

On Sun, Aug 25, 2019 at 12:17:58AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/f_sidedata.c | 10 +-
>  libavutil/frame.h| 10 ++
>  2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c
> index 381da5a..3082aa6 100644
> --- a/libavfilter/f_sidedata.c
> +++ b/libavfilter/f_sidedata.c
> @@ -49,7 +49,7 @@ static const AVOption filt_name##_options[] = { \
>  { "mode", "set a mode of operation", OFFSET(mode),   AV_OPT_TYPE_INT,
> {.i64 = 0 }, 0, SIDEDATA_NB-1, FLAGS, "mode" }, \
>  {   "select", "select frame",0,  AV_OPT_TYPE_CONST,  
> {.i64 = SIDEDATA_SELECT }, 0, 0, FLAGS, "mode" }, \
>  {   "delete", "delete side data",0,  AV_OPT_TYPE_CONST,  
> {.i64 = SIDEDATA_DELETE }, 0, 0, FLAGS, "mode" }, \
> -{ "type",   "set side data type",OFFSET(type),   AV_OPT_TYPE_INT,
> {.i64 = -1 }, -1, INT_MAX, FLAGS, "type" }, \
> +{ "type",   "set side data type",OFFSET(type),   AV_OPT_TYPE_INT,
> {.i64 = AV_FRAME_DATA_NB }, 0, AV_FRAME_DATA_NB, FLAGS, "type" }, \
>  {   "PANSCAN","", 0, AV_OPT_TYPE_CONST,  
> {.i64 = AV_FRAME_DATA_PANSCAN}, 0, 0, FLAGS, "type" }, \
>  {   "A53_CC", "", 0, AV_OPT_TYPE_CONST,  
> {.i64 = AV_FRAME_DATA_A53_CC }, 0, 0, FLAGS, "type" }, \
>  {   "STEREO3D",   "", 0, AV_OPT_TYPE_CONST,  
> {.i64 = AV_FRAME_DATA_STEREO3D   }, 0, 0, FLAGS, "type" }, \
> @@ -79,7 +79,7 @@ static const AVOption filt_name##_options[] = { \
>  { "mode", "set a mode of operation", OFFSET(mode),   AV_OPT_TYPE_INT,
> {.i64 = 0 }, 0, SIDEDATA_NB-1, FLAGS, "mode" }, \
>  {   "select", "select frame",0,  AV_OPT_TYPE_CONST,  
> {.i64 = SIDEDATA_SELECT }, 0, 0, FLAGS, "mode" }, \
>  {   "delete", "delete side data",0,  AV_OPT_TYPE_CONST,  
> {.i64 = SIDEDATA_DELETE }, 0, 0, FLAGS, "mode" }, \
> -{ "type",   "set side data type",OFFSET(type),   AV_OPT_TYPE_INT,
> {.i64 = -1 }, -1, INT_MAX, FLAGS, "type" }, \
> +{ "type",   "set side data type",OFFSET(type),   AV_OPT_TYPE_INT,
> {.i64 = AV_FRAME_DATA_NB }, 0, AV_FRAME_DATA_NB, FLAGS, "type" }, \
>  {   "PANSCAN","", 0, AV_OPT_TYPE_CONST,  
> {.i64 = AV_FRAME_DATA_PANSCAN}, 0, 0, FLAGS, "type" }, \
>  {   "A53_CC", "", 0, AV_OPT_TYPE_CONST,  
> {.i64 = AV_FRAME_DATA_A53_CC }, 0, 0, FLAGS, "type" }, \
>  {   "STEREO3D",   "", 0, AV_OPT_TYPE_CONST,  
> {.i64 = AV_FRAME_DATA_STEREO3D   }, 0, 0, FLAGS, "type" }, \
> @@ -107,7 +107,7 @@ static av_cold int init(AVFilterContext *ctx)
>  {
>  SideDataContext *s = ctx->priv;
>  
> -if (s->type == -1 && s->mode != SIDEDATA_DELETE) {
> +if (s->type == AV_FRAME_DATA_NB && s->mode != SIDEDATA_DELETE) {
>  av_log(ctx, AV_LOG_ERROR, "Side data type must be set\n");
>  return AVERROR(EINVAL);
>  }
> @@ -122,7 +122,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  SideDataContext *s = ctx->priv;
>  AVFrameSideData *sd = NULL;
>  
> -if (s->type != -1)
> +if (s->type != AV_FRAME_DATA_NB)
> sd = av_frame_get_side_data(frame, s->type);
>  
>  switch (s->mode) {
> @@ -132,7 +132,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  }
>  break;
>  case SIDEDATA_DELETE:
> -if (s->type == -1) {
> +if (s->type == AV_FRAME_DATA_NB) {
>  while (frame->nb_side_data)
>  av_frame_remove_side_data(frame, frame->side_data[0]->type);
>  } else if (sd) {
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 5d3231e..4b83125 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -179,6 +179,16 @@ enum AVFrameSideDataType {
>   * array element is implied by AVFrameSideData.size / 
> AVRegionOfInterest.self_size.
>   */
>  AV_FRAME_DATA_REGIONS_OF_INTEREST,
> +
> +/**
> + * The number of side data types.
> + * This is not part of the public API/ABI in the sense that it may
> + * change when new side data types are added.
> + * This must stay the last enum value.
> + * If its value becomes huge, some code using it
> + * needs to be updated as it assumes it to be smaller than other limits.
> + */
> +AV_FRAME_DATA_NB
>  };
>  
>  enum AVActiveFormatDescription {
> -- 
> 2.9.5
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email

[FFmpeg-devel] [PATCH v2] swscale/swscale: various cosmetics for the code style

2019-09-08 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libswscale/swscale.c | 61 ++--
 1 file changed, 21 insertions(+), 40 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4069550..1aa23c6 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -242,12 +242,10 @@ static int swscale(SwsContext *c, const uint8_t *src[],
  * and faster */
 const int dstW   = c->dstW;
 const int dstH   = c->dstH;
-
 const enum AVPixelFormat dstFormat = c->dstFormat;
 const int flags  = c->flags;
 int32_t *vLumFilterPos   = c->vLumFilterPos;
 int32_t *vChrFilterPos   = c->vChrFilterPos;
-
 const int vLumFilterSize = c->vLumFilterSize;
 const int vChrFilterSize = c->vChrFilterSize;
 
@@ -271,7 +269,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 int lastInLumBuf = c->lastInLumBuf;
 int lastInChrBuf = c->lastInChrBuf;
 
-
 int lumStart = 0;
 int lumEnd = c->descIndex[0];
 int chrStart = lumEnd;
@@ -283,22 +280,16 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 SwsSlice *vout_slice = >slice[c->numSlice-1];
 SwsFilterDescriptor *desc = c->desc;
 
-
 int needAlpha = c->needAlpha;
 
 int hasLumHoles = 1;
 int hasChrHoles = 1;
 
-
 if (isPacked(c->srcFormat)) {
-src[0] =
-src[1] =
-src[2] =
-src[3] = src[0];
-srcStride[0] =
-srcStride[1] =
-srcStride[2] =
-srcStride[3] = srcStride[0];
+for (int i = 0; i < 4; i++) {
+src[i] = src[0];
+srcStride[i] = srcStride[0];
+}
 }
 srcStride[1] <<= c->vChrDrop;
 srcStride[2] <<= c->vChrDrop;
@@ -324,7 +315,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 }
 }
 
-if (   (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15
+if ((uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15
 || (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || (uintptr_t)src[2]&15
 || dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || 
dstStride[3]&15
 || srcStride[0]&15 || srcStride[1]&15 || srcStride[2]&15 || 
srcStride[3]&15
@@ -341,11 +332,9 @@ static int swscale(SwsContext *c, const uint8_t *src[],
  * will not get executed. This is not really intended but works
  * currently, so people might do it. */
 if (srcSliceY == 0) {
-lumBufIndex  = -1;
-chrBufIndex  = -1;
+lumBufIndex  = chrBufIndex  = -1;
 dstY = 0;
-lastInLumBuf = -1;
-lastInChrBuf = -1;
+lastInLumBuf = lastInChrBuf = -1;
 }
 
 if (!should_dither) {
@@ -368,16 +357,14 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 hout_slice->plane[2].sliceY = lastInChrBuf + 1;
 hout_slice->plane[3].sliceY = lastInLumBuf + 1;
 
-hout_slice->plane[0].sliceH =
-hout_slice->plane[1].sliceH =
-hout_slice->plane[2].sliceH =
-hout_slice->plane[3].sliceH = 0;
+for(int i = 0; i < 4; i++)
+hout_slice->plane[i].sliceH = 0;
 hout_slice->width = dstW;
 }
 
 for (; dstY < dstH; dstY++) {
 const int chrDstY = dstY >> c->chrDstVSubSample;
-int use_mmx_vfilter= c->use_mmx_vfilter;
+int use_mmx_vfilter = c->use_mmx_vfilter;
 
 // First line needed as input
 const int firstLumSrcY  = FFMAX(1 - vLumFilterSize, 
vLumFilterPos[dstY]);
@@ -396,7 +383,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
 // handle holes (FAST_BILINEAR & weird filters)
 if (firstLumSrcY > lastInLumBuf) {
-
 hasLumHoles = lastInLumBuf != firstLumSrcY - 1;
 if (hasLumHoles) {
 hout_slice->plane[0].sliceY = firstLumSrcY;
@@ -408,7 +394,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 lastInLumBuf = firstLumSrcY - 1;
 }
 if (firstChrSrcY > lastInChrBuf) {
-
 hasChrHoles = lastInChrBuf != firstChrSrcY - 1;
 if (hasChrHoles) {
 hout_slice->plane[1].sliceY = firstChrSrcY;
@@ -440,7 +425,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 av_assert0((lastLumSrcY - firstLumSrcY + 1) <= 
hout_slice->plane[0].available_lines);
 av_assert0((lastChrSrcY - firstChrSrcY + 1) <= 
hout_slice->plane[1].available_lines);
 
-
 posY = hout_slice->plane[0].sliceY + hout_slice->plane[0].sliceH;
 if (posY <= lastLumSrcY && !hasLumHoles) {
 firstPosY = FFMAX(firstLumSrcY, posY);
@@ -503,10 +487,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, 
use_mmx_vfilter);
 }
 
-{
-for (i = vStart; i < vEnd; ++i)
-desc[i].process(c, [i], 

Re: [FFmpeg-devel] [PATCH v2] configure: Update libmysofa check with a new symbol.

2019-09-08 Thread Andrey Semashev

On 2019-09-02 20:10, Paul B Mahol wrote:

On 9/2/19, Andrey Semashev  wrote:

Ping? I would like this to make it into 4.2 as well.



Applied to master.


Thanks. Could you also merge it to 4.2 branch?


On Wed, Aug 28, 2019 at 11:16 PM Andrey Semashev
 wrote:


The current code in libavfilter/af_sofalizer.c requires
mysofa_neighborhood_init_withstepdefine function, which only appeared
in libmysofa 0.7. Use this function in configure script to bail out
early if a too old libmysofa is found in the system instead of failing
at compile time.
---
  configure | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 51dc77c780..0d06ea6a02 100755
--- a/configure
+++ b/configure
@@ -6237,8 +6237,8 @@ enabled libmfx&& { check_pkg_config
libmfx libmfx "mfx/mfxvideo.h" M
 { require libmfx "mfx/mfxvideo.h" MFXInit
"-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config";
} }
  enabled libmodplug&& require_pkg_config libmodplug libmodplug
libmodplug/modplug.h ModPlug_Load
  enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h
lame_set_VBR_quality -lmp3lame $libm_extralibs
-enabled libmysofa && { check_pkg_config libmysofa libmysofa
mysofa.h mysofa_load ||
-   require libmysofa mysofa.h mysofa_load
-lmysofa $zlib_extralibs; }
+enabled libmysofa && { check_pkg_config libmysofa libmysofa
mysofa.h mysofa_neighborhood_init_withstepdefine ||
+   require libmysofa mysofa.h
mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
  enabled libnpp&& { check_lib libnpp npp.h nppGetLibVersion
-lnppig -lnppicc -lnppc -lnppidei ||
 check_lib libnpp npp.h nppGetLibVersion
-lnppi -lnppc -lnppidei ||
 die "ERROR: libnpp not found"; }
--
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 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 v4] avformat/hlsenc: merge mpegts and fmp4 workflow to one workflow

2019-09-08 Thread Andreas Rheinhardt
Liu Steven:
> 
> 
>> 在 2019年8月9日,下午5:30,Liu Steven  写道:
>>
>>
>>
>>> 在 2019年8月5日,上午10:29,Steven Liu  写道:
>>>
>>> just remove the 'i' of the v3 mail subject.
>>> write mpegts or fmp4 context into buffer, and flush the buffer into
>>> output file when split fragment. merge two format split workflow into
>>> one workflow
>>>
>>> Signed-off-by: Steven Liu 
>>
>> ping?
>>
> Pushed

This patch both created and fixed memleaks: Before this patch,
generating hls_segment_size.m3u8 (needed for fate-hls-segment-size)
leaks 792 B directly and 787122 B indirectly. With this patch,
Generating hls_segment_size.m3u8 and hls_init_time.m3u8 leaks 264 B
directly and 1056 B indirectly.
The leaks happen in hls_write_trailer: The last dynamic buffer that is
opened in flush_dynbuf is not freed. I wanted to add a call to
ffio_free_dyn_buf, but then I noticed that it seems that if something
gets written in av_write_trailer(oc) it never leaves the dynamic
buffer, although it probably should. So I leave fixing this to those
who know this code better than I do.

- Andreas

PS: For the fate test run with Valgrind this means that generating the
necessary test files fails. But the tests itself are not counted as
failing on the website [1]. Instead, the number of tests decreased.

[1]: http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrind
___
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".