[FFmpeg-devel] How to parse the audio payload in AudioMuxElement of LATM to multiple avstreams?

2020-10-26 Thread shiguang...@outlook.com
Hello, I'm a newer ffmepg. I recently wanted to try to implement a latm 
demuxer. Now I have a problem. Because a latm's  AudioMuxElement() contains 
multiple aac streams of payload() and AudioSpecificConfig(). How can I  store 
these payloads with the correct stream_index when reading an AudioMuxElement in 
function av_read_frame calling .read_packet?

nigh.t
___
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] avcodec/hevcdec: constrained intra predict, do not check top left IS_INTRA if it's not available

2020-10-26 Thread Linjie Fu
On Mon, Oct 26, 2020 at 10:29 PM Guangxin Xu  wrote:

> The bug reporter confirmed the fix.
> https://trac.ffmpeg.org/ticket/8932
>
> ping for review and merge.
> thanks
>
> On Fri, Oct 16, 2020 at 9:57 PM Xu Guangxin  wrote:
>
> > fix ticket: 8932
> >
> > For poc 2, we have tile boundary at x = 640.
> > When we predict cu(640,912),the top left pixel is not avaliable to the
> cu.
> > So, we can not check it's intra or not. We need set top[-1] = top[0]
> > directly.
> > see 8.4.4.2.1 for details
> > ---
> >  libavcodec/hevcpred_template.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/hevcpred_template.c
> > b/libavcodec/hevcpred_template.c
> > index 6fe33546b1..e550707874 100644
> > --- a/libavcodec/hevcpred_template.c
> > +++ b/libavcodec/hevcpred_template.c
> > @@ -213,7 +213,7 @@ do {  \
> >  while (j < size_max_x && !IS_INTRA(j, -1))
> >  j++;
> >  if (j > 0)
> > -if (x0 > 0) {
> > +if (cand_up_left) {
> >  EXTEND_LEFT_CIP(top, j, j + 1);
> >  } else {
> >  EXTEND_LEFT_CIP(top, j, j);
> > --
> > 2.17.1
> >
> >


Looks reasonable, also verified there is no garbage anymore.
Prefer to apply soon if no objections.

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

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

Re: [FFmpeg-devel] [PATCH v3 2/3] avformat/mpegtsenc: make first_pcr sync with the first valid dts

2020-10-26 Thread lance . lmwang
On Mon, Oct 26, 2020 at 09:13:08PM +0100, Marton Balint wrote:
> 
> 
> On Mon, 26 Oct 2020, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > now first_pts assume dts will start from zero, if it's not true(copyts is 
> > enable),
> > too many null packet will be inserted for cbr output.
> > 
> > Please test with below command, you'll get huge test.ts without the patch:
> > ./ffmpeg -y -copyts -i ../fate-suite/mpegts/loewe.ts  -c:v libx264 
> > -x264opts \
> >   nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 
> > \
> >   1000k  -c:a mp2 -muxrate 4500k  -vframes 1000 test.ts
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > libavformat/mpegtsenc.c | 6 ++
> > 1 file changed, 6 insertions(+)
> > 
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index 5c97d63..29dcaf6 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -81,6 +81,7 @@ typedef struct MpegTSWrite {
> > int64_t pat_period; /* PAT/PMT period in PCR time base */
> > int nb_services;
> > int64_t first_pcr;
> > +int first_dts_checked;
> > int64_t next_pcr;
> > int mux_rate; ///< set to 1 when VBR
> > int pes_payload_size;
> > @@ -1688,6 +1689,11 @@ static int 
> > mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
> > stream_id = side_data[0];
> > 
> > if (ts->copyts < 1) {
> > +if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) {
> > +ts->first_pcr += dts * 300;
> > +ts->first_dts_checked = 1;
> > +}
> > +
> 
> LGTM, thanks.

thanks, will apply the patch#2, patch#3.

> 
> Regards,
> Marton
> 
> > if (pts != AV_NOPTS_VALUE)
> > pts += delay;
> > if (dts != AV_NOPTS_VALUE)
> > -- 
> > 1.8.3.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".

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

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

Re: [FFmpeg-devel] [PATCH 6/6] lavc: un-avpriv avpriv_bprint_to_extradata()

2020-10-26 Thread James Almer
On 10/26/2020 10:41 AM, Anton Khirnov wrote:
> It has not been used outside of lavc since 6f69f7a8bf6.
> 
> Also, move it to the only place where it is used.

Shouldn't you keep the symbol around until the bump? Even though it was
not used by other libraries, it was nonetheless still exported by lavc.
A simple version define preprocessor check like Andreas mentioned is
enough, no need to add a new FF_API define for avpriv functions.

Alternatively, just postpone applying this until after the bump.

LGTM either way.

> ---
>  libavcodec/dvdsubenc.c | 25 -
>  libavcodec/internal.h  |  5 -
>  libavcodec/utils.c | 23 ---
>  3 files changed, 24 insertions(+), 29 deletions(-)
> 
> diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
> index e54b5f0d7b..9fa9d5b6d7 100644
> --- a/libavcodec/dvdsubenc.c
> +++ b/libavcodec/dvdsubenc.c
> @@ -424,6 +424,29 @@ fail:
>  return ret;
>  }
>  
> +static int bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
> +{
> +int ret;
> +char *str;
> +
> +ret = av_bprint_finalize(buf, &str);
> +if (ret < 0)
> +return ret;
> +if (!av_bprint_is_complete(buf)) {
> +av_free(str);
> +return AVERROR(ENOMEM);
> +}
> +
> +avctx->extradata = str;
> +/* Note: the string is NUL terminated (so extradata can be read as a
> + * string), but the ending character is not accounted in the size (in
> + * binary formats you are likely not supposed to mux that character). 
> When
> + * extradata is copied, it is also padded with 
> AV_INPUT_BUFFER_PADDING_SIZE
> + * zeros. */
> +avctx->extradata_size = buf->len;
> +return 0;
> +}
> +
>  static int dvdsub_init(AVCodecContext *avctx)
>  {
>  DVDSubtitleContext *dvdc = avctx->priv_data;
> @@ -451,7 +474,7 @@ static int dvdsub_init(AVCodecContext *avctx)
>  av_bprintf(&extradata, " %06"PRIx32"%c",
> dvdc->global_palette[i] & 0xFF, i < 15 ? ',' : '\n');
>  
> -ret = avpriv_bprint_to_extradata(avctx, &extradata);
> +ret = bprint_to_extradata(avctx, &extradata);
>  if (ret < 0)
>  return ret;
>  
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index ce4dbbc2b9..17defb9b50 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -313,11 +313,6 @@ int avpriv_h264_has_num_reorder_frames(AVCodecContext 
> *avctx);
>   */
>  int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, 
> AVDictionary **options);
>  
> -/**
> - * Finalize buf into extradata and set its size appropriately.
> - */
> -int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf);
> -
>  const uint8_t *avpriv_find_start_code(const uint8_t *p,
>const uint8_t *end,
>uint32_t *state);
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 93ac1cd9f0..fb40962c47 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1946,29 +1946,6 @@ int avcodec_is_open(AVCodecContext *s)
>  return !!s->internal;
>  }
>  
> -int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
> -{
> -int ret;
> -char *str;
> -
> -ret = av_bprint_finalize(buf, &str);
> -if (ret < 0)
> -return ret;
> -if (!av_bprint_is_complete(buf)) {
> -av_free(str);
> -return AVERROR(ENOMEM);
> -}
> -
> -avctx->extradata = str;
> -/* Note: the string is NUL terminated (so extradata can be read as a
> - * string), but the ending character is not accounted in the size (in
> - * binary formats you are likely not supposed to mux that character). 
> When
> - * extradata is copied, it is also padded with 
> AV_INPUT_BUFFER_PADDING_SIZE
> - * zeros. */
> -avctx->extradata_size = buf->len;
> -return 0;
> -}
> -
>  const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
>const uint8_t *end,
>uint32_t *av_restrict state)
> 

___
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] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread Bohan Li
Thanks a lot for the explanation! I'll add the documentation accordingly.

Best,
Bohan

On Mon, Oct 26, 2020 at 2:46 PM James Almer  wrote:

> On 10/26/2020 6:21 PM, Bohan Li wrote:
>
> > Regarding the last comment, the enable-keyframe-filtering parameter was a
> > boolean, but recently there is one more option added to libaom
> > (--enable-keyframe-filtering=2), so I thought it would be better to use
> >  AV_OPT_TYPE_INT here so people who build libaom from source could use
> that
> > option.
> >
> > Please let me know if there are any concerns with it.
>
> No, if it was extended then it's correct as INT.
>
> > Add the option to use -enable-keyframe-filtering with libaom-av1
> > codec.  The option controls the encoder behavior on performing
> > temporal filtering on keyframes.
>
> By missing documentation i meant an entry in doc/encoder.texi
> Look for the libaom-av1 section and add the new option at the end.
>
> This blurb in the commit message is ok and can stay, too.
>
> >
> > Signed-off-by: Bohan Li 
> > ---
> >  libavcodec/libaomenc.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> > index 2b0581b15a..77c25770a4 100644
> > --- a/libavcodec/libaomenc.c
> > +++ b/libavcodec/libaomenc.c
> > @@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
> >  int enable_diff_wtd_comp;
> >  int enable_dist_wtd_comp;
> >  int enable_dual_filter;
> > +int enable_keyframe_filtering;
> >  } AOMContext;
> >
> >  static const char *const ctlidstr[] = {
> > @@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
> >  [AV1E_SET_REDUCED_REFERENCE_SET]=
> "AV1E_SET_REDUCED_REFERENCE_SET",
> >  [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] =
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
> >  [AV1E_SET_ENABLE_REF_FRAME_MVS] =
> "AV1E_SET_ENABLE_REF_FRAME_MVS",
> > +[AV1E_SET_ENABLE_KEYFRAME_FILTERING] =
> "AV1E_SET_ENABLE_KEYFRAME_FILTERING"
> >  #endif
> >  };
> >
> > @@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
> >  codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP,
> ctx->enable_onesided_comp);
> >  if (ctx->enable_smooth_interintra >= 0)
> >  codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA,
> ctx->enable_smooth_interintra);
> > +if (ctx->enable_keyframe_filtering >= 0)
> > +codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING,
> ctx->enable_keyframe_filtering);
> >  #endif
> >
> >  codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
> > @@ -1261,6 +1265,7 @@ static const AVOption options[] = {
> >  { "enable-masked-comp",   "Enable masked compound",
> OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> >  { "enable-interintra-comp",   "Enable interintra compound",
> OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> >  { "enable-smooth-interintra", "Enable smooth interintra mode",
>OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> > +{ "enable-keyframe-filtering","Keyframe filtering type",
>OFFSET(enable_keyframe_filtering),AV_OPT_TYPE_INT,
> {.i64 = -1}, -1, 3, VE},
> >  { NULL },
> >  };
> >
> >
>
> ___
> 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] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread Bohan Li
Add the option to use -enable-keyframe-filtering with libaom-av1
codec.  The option controls the encoder behavior on performing
temporal filtering on keyframes.

Signed-off-by: Bohan Li 
---
 doc/encoders.texi  | 13 +
 libavcodec/libaomenc.c |  5 +
 2 files changed, 18 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 0b1c69e982..8914546694 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1685,6 +1685,19 @@ Enable interintra compound. Default is true.
 @item enable-smooth-interintra (@emph{boolean}) (Requires libaom >= v2.0.0)
 Enable smooth interintra mode. Default is true.
 
+@item enable-keyframe-filtering (Requires libaom >= v2.0.0)
+Filtering type for key frames. Possible values:
+@table @samp
+@item @emph{-1}
+Use the default in libaom (default).
+@item @emph{0}
+Do not filter key frames. 
+@item @emph{1}
+Filter key frames but do not apply overlays. 
+@item @emph{2}
+Filter key frames and apply overlays to them (experimental).
+@end table
+
 @end table
 
 @section libsvtav1
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 2b0581b15a..77c25770a4 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
 int enable_diff_wtd_comp;
 int enable_dist_wtd_comp;
 int enable_dual_filter;
+int enable_keyframe_filtering;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
 [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
 [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
+[AV1E_SET_ENABLE_KEYFRAME_FILTERING] = "AV1E_SET_ENABLE_KEYFRAME_FILTERING"
 #endif
 };
 
@@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP, 
ctx->enable_onesided_comp);
 if (ctx->enable_smooth_interintra >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA, 
ctx->enable_smooth_interintra);
+if (ctx->enable_keyframe_filtering >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING, 
ctx->enable_keyframe_filtering);
 #endif
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
@@ -1261,6 +1265,7 @@ static const AVOption options[] = {
 { "enable-masked-comp",   "Enable masked compound",
OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
 { "enable-interintra-comp",   "Enable interintra compound",
OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
 { "enable-smooth-interintra", "Enable smooth interintra mode", 
OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
+{ "enable-keyframe-filtering","Keyframe filtering type",   
OFFSET(enable_keyframe_filtering),AV_OPT_TYPE_INT,  {.i64 = 
-1}, -1, 3, VE},
 { NULL },
 };
 
-- 
2.29.0.rc1.297.gfa9743e501-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".

Re: [FFmpeg-devel] [PATCH] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread James Almer
On 10/26/2020 6:21 PM, Bohan Li wrote:

> Regarding the last comment, the enable-keyframe-filtering parameter was a
> boolean, but recently there is one more option added to libaom
> (--enable-keyframe-filtering=2), so I thought it would be better to use
>  AV_OPT_TYPE_INT here so people who build libaom from source could use that
> option.
> 
> Please let me know if there are any concerns with it.

No, if it was extended then it's correct as INT.

> Add the option to use -enable-keyframe-filtering with libaom-av1
> codec.  The option controls the encoder behavior on performing
> temporal filtering on keyframes.

By missing documentation i meant an entry in doc/encoder.texi
Look for the libaom-av1 section and add the new option at the end.

This blurb in the commit message is ok and can stay, too.

> 
> Signed-off-by: Bohan Li 
> ---
>  libavcodec/libaomenc.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 2b0581b15a..77c25770a4 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
>  int enable_diff_wtd_comp;
>  int enable_dist_wtd_comp;
>  int enable_dual_filter;
> +int enable_keyframe_filtering;
>  } AOMContext;
>  
>  static const char *const ctlidstr[] = {
> @@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
>  [AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
>  [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = 
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
>  [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
> +[AV1E_SET_ENABLE_KEYFRAME_FILTERING] = 
> "AV1E_SET_ENABLE_KEYFRAME_FILTERING"
>  #endif
>  };
>  
> @@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP, 
> ctx->enable_onesided_comp);
>  if (ctx->enable_smooth_interintra >= 0)
>  codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA, 
> ctx->enable_smooth_interintra);
> +if (ctx->enable_keyframe_filtering >= 0)
> +codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING, 
> ctx->enable_keyframe_filtering);
>  #endif
>  
>  codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
> @@ -1261,6 +1265,7 @@ static const AVOption options[] = {
>  { "enable-masked-comp",   "Enable masked compound",  
>   OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
> -1}, -1, 1, VE},
>  { "enable-interintra-comp",   "Enable interintra compound",  
>   OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
> -1}, -1, 1, VE},
>  { "enable-smooth-interintra", "Enable smooth interintra mode",   
>   OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL, {.i64 = 
> -1}, -1, 1, VE},
> +{ "enable-keyframe-filtering","Keyframe filtering type", 
>   OFFSET(enable_keyframe_filtering),AV_OPT_TYPE_INT,  {.i64 = 
> -1}, -1, 3, VE},
>  { NULL },
>  };
>  
> 

___
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] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread Bohan Li
Thank you for the prompt response! I'll fix the typo, add documentation and
re-submit.

Regarding the last comment, the enable-keyframe-filtering parameter was a
boolean, but recently there is one more option added to libaom
(--enable-keyframe-filtering=2), so I thought it would be better to use
 AV_OPT_TYPE_INT here so people who build libaom from source could use that
option.

Please let me know if there are any concerns with it.

Thanks and best regards,
Bohan


On Mon, Oct 26, 2020 at 2:07 PM James Almer  wrote:

> On 10/26/2020 6:01 PM, Bohan Li wrote:
> > Signed-off-by: Bohan Li 
> > ---
> >  libavcodec/libaomenc.c | 5 +
> >  1 file changed, 5 insertions(+)
>
> Missing documentation.
>
> >
> > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> > index 2b0581b15a..a5d9843ae2 100644
> > --- a/libavcodec/libaomenc.c
> > +++ b/libavcodec/libaomenc.c
> > @@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
> >  int enable_diff_wtd_comp;
> >  int enable_dist_wtd_comp;
> >  int enable_dual_filter;
> > +int enable_keyframe_filtering;
> >  } AOMContext;
> >
> >  static const char *const ctlidstr[] = {
> > @@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
> >  [AV1E_SET_REDUCED_REFERENCE_SET]=
> "AV1E_SET_REDUCED_REFERENCE_SET",
> >  [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] =
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
> >  [AV1E_SET_ENABLE_REF_FRAME_MVS] =
> "AV1E_SET_ENABLE_REF_FRAME_MVS",
> > +[AV1E_SET_ENABLE_KEYFRAME_FILTERING] =
> "AV1E_SET_ENABLE_KEYFRAME_FILTRING"
>
> FILTRING typo.
>
> >  #endif
> >  };
> >
> > @@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
> >  codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP,
> ctx->enable_onesided_comp);
> >  if (ctx->enable_smooth_interintra >= 0)
> >  codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA,
> ctx->enable_smooth_interintra);
> > +if (ctx->enable_keyframe_filtering >= 0)
> > +codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING,
> ctx->enable_keyframe_filtering);
> >  #endif
> >
> >  codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
> > @@ -1261,6 +1265,7 @@ static const AVOption options[] = {
> >  { "enable-masked-comp",   "Enable masked compound",
> OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> >  { "enable-interintra-comp",   "Enable interintra compound",
> OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> >  { "enable-smooth-interintra", "Enable smooth interintra mode",
>OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, VE},
> > +{ "enable-keyframe-filtering","Enable keyframe filtering
> type",OFFSET(enable_keyframe_filtering),
> AV_OPT_TYPE_INT,  {.i64 = -1}, -1, 3, VE},
>
> It's a boolean, so use AV_OPT_TYPE_BOOL.
>
> >  { NULL },
> >  };
> >
> >
>
> ___
> 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] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread Bohan Li
Add the option to use -enable-keyframe-filtering with libaom-av1
codec.  The option controls the encoder behavior on performing
temporal filtering on keyframes.

Signed-off-by: Bohan Li 
---
 libavcodec/libaomenc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 2b0581b15a..77c25770a4 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
 int enable_diff_wtd_comp;
 int enable_dist_wtd_comp;
 int enable_dual_filter;
+int enable_keyframe_filtering;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
 [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
 [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
+[AV1E_SET_ENABLE_KEYFRAME_FILTERING] = "AV1E_SET_ENABLE_KEYFRAME_FILTERING"
 #endif
 };
 
@@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP, 
ctx->enable_onesided_comp);
 if (ctx->enable_smooth_interintra >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA, 
ctx->enable_smooth_interintra);
+if (ctx->enable_keyframe_filtering >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING, 
ctx->enable_keyframe_filtering);
 #endif
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
@@ -1261,6 +1265,7 @@ static const AVOption options[] = {
 { "enable-masked-comp",   "Enable masked compound",
OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
 { "enable-interintra-comp",   "Enable interintra compound",
OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
 { "enable-smooth-interintra", "Enable smooth interintra mode", 
OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
+{ "enable-keyframe-filtering","Keyframe filtering type",   
OFFSET(enable_keyframe_filtering),AV_OPT_TYPE_INT,  {.i64 = 
-1}, -1, 3, VE},
 { NULL },
 };
 
-- 
2.29.0.rc1.297.gfa9743e501-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".

Re: [FFmpeg-devel] [PATCH] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread James Almer
On 10/26/2020 6:01 PM, Bohan Li wrote:
> Signed-off-by: Bohan Li 
> ---
>  libavcodec/libaomenc.c | 5 +
>  1 file changed, 5 insertions(+)

Missing documentation.

> 
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 2b0581b15a..a5d9843ae2 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
>  int enable_diff_wtd_comp;
>  int enable_dist_wtd_comp;
>  int enable_dual_filter;
> +int enable_keyframe_filtering;
>  } AOMContext;
>  
>  static const char *const ctlidstr[] = {
> @@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
>  [AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
>  [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = 
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
>  [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
> +[AV1E_SET_ENABLE_KEYFRAME_FILTERING] = 
> "AV1E_SET_ENABLE_KEYFRAME_FILTRING"

FILTRING typo.

>  #endif
>  };
>  
> @@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP, 
> ctx->enable_onesided_comp);
>  if (ctx->enable_smooth_interintra >= 0)
>  codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA, 
> ctx->enable_smooth_interintra);
> +if (ctx->enable_keyframe_filtering >= 0)
> +codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING, 
> ctx->enable_keyframe_filtering);
>  #endif
>  
>  codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
> @@ -1261,6 +1265,7 @@ static const AVOption options[] = {
>  { "enable-masked-comp",   "Enable masked compound",  
>   OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
> -1}, -1, 1, VE},
>  { "enable-interintra-comp",   "Enable interintra compound",  
>   OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
> -1}, -1, 1, VE},
>  { "enable-smooth-interintra", "Enable smooth interintra mode",   
>   OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL, {.i64 = 
> -1}, -1, 1, VE},
> +{ "enable-keyframe-filtering","Enable keyframe filtering type",  
>   OFFSET(enable_keyframe_filtering),AV_OPT_TYPE_INT,  {.i64 = 
> -1}, -1, 3, VE},

It's a boolean, so use AV_OPT_TYPE_BOOL.

>  { NULL },
>  };
>  
> 

___
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] Add enable_keyframe_filtering option for libaom-av1 encoder.

2020-10-26 Thread Bohan Li
Signed-off-by: Bohan Li 
---
 libavcodec/libaomenc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 2b0581b15a..a5d9843ae2 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -124,6 +124,7 @@ typedef struct AOMEncoderContext {
 int enable_diff_wtd_comp;
 int enable_dist_wtd_comp;
 int enable_dual_filter;
+int enable_keyframe_filtering;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -192,6 +193,7 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
 [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
 [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
+[AV1E_SET_ENABLE_KEYFRAME_FILTERING] = "AV1E_SET_ENABLE_KEYFRAME_FILTRING"
 #endif
 };
 
@@ -812,6 +814,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP, 
ctx->enable_onesided_comp);
 if (ctx->enable_smooth_interintra >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA, 
ctx->enable_smooth_interintra);
+if (ctx->enable_keyframe_filtering >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_KEYFRAME_FILTERING, 
ctx->enable_keyframe_filtering);
 #endif
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
@@ -1261,6 +1265,7 @@ static const AVOption options[] = {
 { "enable-masked-comp",   "Enable masked compound",
OFFSET(enable_masked_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
 { "enable-interintra-comp",   "Enable interintra compound",
OFFSET(enable_interintra_comp),   AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
 { "enable-smooth-interintra", "Enable smooth interintra mode", 
OFFSET(enable_smooth_interintra), AV_OPT_TYPE_BOOL, {.i64 = 
-1}, -1, 1, VE},
+{ "enable-keyframe-filtering","Enable keyframe filtering type",
OFFSET(enable_keyframe_filtering),AV_OPT_TYPE_INT,  {.i64 = 
-1}, -1, 3, VE},
 { NULL },
 };
 
-- 
2.29.0.rc1.297.gfa9743e501-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] [PATCH] avcodec/rkmpp : reset end of stream flag on flush

2020-10-26 Thread David Sowa
Currently the flag eos_reached is set to 1 on end of stream
and there is no mechanism to reset it to 0. After a flush new
buffers should be able to be decoded but the eos_reached flag
causes all the frames to be dropped. Reset the eos_reached flag
to 0 during the flush operation to allow new frames to be
decoded.
---
 libavcodec/rkmppdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
index 248020d5d6..bf1bf0b013 100644
--- a/libavcodec/rkmppdec.c
+++ b/libavcodec/rkmppdec.c
@@ -544,6 +544,7 @@ static void rkmpp_flush(AVCodecContext *avctx)
 ret = decoder->mpi->reset(decoder->ctx);
 if (ret == MPP_OK) {
 decoder->first_packet = 1;
+decoder->eos_reached = 0;
 } else
 av_log(avctx, AV_LOG_ERROR, "Failed to reset MPI (code = %d)\n", ret);
 }
-- 
2.25.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 v3 2/3] avformat/mpegtsenc: make first_pcr sync with the first valid dts

2020-10-26 Thread Marton Balint



On Mon, 26 Oct 2020, lance.lmw...@gmail.com wrote:


From: Limin Wang 

now first_pts assume dts will start from zero, if it's not true(copyts is 
enable),
too many null packet will be inserted for cbr output.

Please test with below command, you'll get huge test.ts without the patch:
./ffmpeg -y -copyts -i ../fate-suite/mpegts/loewe.ts  -c:v libx264 -x264opts \
  nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize \
  1000k  -c:a mp2 -muxrate 4500k  -vframes 1000 test.ts

Signed-off-by: Limin Wang 
---
libavformat/mpegtsenc.c | 6 ++
1 file changed, 6 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 5c97d63..29dcaf6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -81,6 +81,7 @@ typedef struct MpegTSWrite {
int64_t pat_period; /* PAT/PMT period in PCR time base */
int nb_services;
int64_t first_pcr;
+int first_dts_checked;
int64_t next_pcr;
int mux_rate; ///< set to 1 when VBR
int pes_payload_size;
@@ -1688,6 +1689,11 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
stream_id = side_data[0];

if (ts->copyts < 1) {
+if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) {
+ts->first_pcr += dts * 300;
+ts->first_dts_checked = 1;
+}
+


LGTM, thanks.

Regards,
Marton


if (pts != AV_NOPTS_VALUE)
pts += delay;
if (dts != AV_NOPTS_VALUE)
--
1.8.3.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".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-10-26 Thread Mohammad Izadi
Thank you, Jan! I hope you feel better soon.



On Sun, Oct 25, 2020 at 5:49 PM Jan Ekström  wrote:

> On Wed, Oct 14, 2020 at 2:54 AM Mohammad Izadi
>  wrote:
> >
> > From: Mohammad Izadi 
> >
> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> to side data packet to be used or passed through.
> >
> > The fate test file can be found here:
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
> >
> > The video file needs to be copied to fate-suite/mov/
> > ---
>
> Thanks for posting the latest version of this patch, unfortunately it
> also coincided with me first trying to get the colorspace ffmpeg.c
> patch forwards, and then getting a flu/cold which is still ongoing.
>
> Applied it after some tweaking as
> https://github.com/jeeb/ffmpeg/commits/hdr10plus_v2 and it does
> compile.
>
> Will attempt to review it as I get the time and feel better.
>
> Jan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 1/4] avcodec/av1dec: Check for unset obu instead of crashing

2020-10-26 Thread Michael Niedermayer
On Sun, Oct 25, 2020 at 09:00:53PM -0300, James Almer wrote:
> On 10/25/2020 8:00 PM, Michael Niedermayer wrote:
> > Fixes: NULL pointer dereference
> > Fixes: 
> > 26550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5417762807349248
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/av1dec.c | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> > index a0a279d65b..bb4295aa6f 100644
> > --- a/libavcodec/av1dec.c
> > +++ b/libavcodec/av1dec.c
> > @@ -673,7 +673,12 @@ static int av1_decode_frame(AVCodecContext *avctx, 
> > void *frame,
> >  for (int i = 0; i < s->current_obu.nb_units; i++) {
> >  CodedBitstreamUnit *unit = &s->current_obu.units[i];
> >  AV1RawOBU *obu = unit->content;
> > -const AV1RawOBUHeader *header = &obu->header;
> > +const AV1RawOBUHeader *header;
> > +
> > +if (!obu)
> 
> This looks like a "regression" since ae7686a64f, where ENOSYS (an error
> code that's not propagated to the caller) on unsupported OBU types is
> now returned before cbs_av1 even gets a chance to allocate the unit's
> content.
> 

> Should be ok.

will apply

thx

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

Republics decline into democracies and democracies degenerate into
despotisms. -- 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] [PATCHv2] Document community process

2020-10-26 Thread Michael Niedermayer
On Sun, Oct 25, 2020 at 01:55:11PM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2020-10-19 23:57:31)
> > On Mon, Oct 19, 2020 at 07:22:48PM +0200, Jean-Baptiste Kempf wrote:
> > > Yo,
> > > 
> > > On Mon, 19 Oct 2020, at 19:02, Michael Niedermayer wrote:
> > > > > +## Voting
> > > > > +
> > > > 
> > > > > +Voting is done using a ranked voting system, currently running on 
> > > > > https://vote.ffmpeg.org/ .
> > > > 
> > > > I think Voting should be defined more precissely
> > > 
> > > That's a good point. What would like to see here? The algo used? The 
> > > software used?
> > 
> > I dont know what is best.
> > 
> > What is the goal having this information there serves ?
> > I think there are 3 or 4 levels/classes of information that could be 
> > provided
> > at highest level, listing the properties of the vote system
> 
> In my view, this documented is intended to serve mainly as a statement
> of intent rather than a strict legalistic definition of everything, so
> it would be sufficient to mention that we are using a ranked Condorcet
> method. I would think very few developers know or care what the exact
> differences between the methods are, as long as they are in some sense
> "reasonable".

The problem is elections with multiple winners, That is elections of seats
in a committee or other group.
Consider a 5 seat comittee
and lets consider that there are blue and pink candidates
if you have 100 people voting and 51 of them vote only for pink candidates and
49 only for blue candidates.
repeated application of a Condorcet method will give you 5 pink candidates

OTOH something like schulze STV, also a Condorcet method should in this case
give you 3 pink candidates and 2 blue ones.

The above is a bit oversimplified but basically there are 2 classes of voting
systems. The first class is applying single winner election methods repeatedly
to fill all seats. 
The other is trying to fill seats so they are representing the set of voters.

The first class can skip over minorities even when they are quite large,
but the people choosen should have "strong and maximal support"

The second class would favor creating a representative set over one of
maximal support by voters. It could lead to a more "colorfull" result
with seats filled by people representing minortes and lacking broad support.

The results likely will differ in reallity as well.

We dont have to write this down in "this" document but we should
write it down in some document if what is considered "reasonable"
is "Proportional representation" or not.

What i can say is that if we want a 
* "Proportional representation" system
 then schulze STV is a "beatifull" system free of ugly discrete choices like 
STV 
 and its also condorcet
* non "Proportional representation".
 then normal repeatly applying the normal schulze method is the obvious choice

IIUC CIVS supports repeatly applying the normal schulze method and thilo added
support for schulze STV

thx

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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] avcodec/hevcdec: constrained intra predict, do not check top left IS_INTRA if it's not available

2020-10-26 Thread Guangxin Xu
The bug reporter confirmed the fix.
https://trac.ffmpeg.org/ticket/8932

ping for review and merge.
thanks

On Fri, Oct 16, 2020 at 9:57 PM Xu Guangxin  wrote:

> fix ticket: 8932
>
> For poc 2, we have tile boundary at x = 640.
> When we predict cu(640,912),the top left pixel is not avaliable to the cu.
> So, we can not check it's intra or not. We need set top[-1] = top[0]
> directly.
> see 8.4.4.2.1 for details
> ---
>  libavcodec/hevcpred_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/hevcpred_template.c
> b/libavcodec/hevcpred_template.c
> index 6fe33546b1..e550707874 100644
> --- a/libavcodec/hevcpred_template.c
> +++ b/libavcodec/hevcpred_template.c
> @@ -213,7 +213,7 @@ do {  \
>  while (j < size_max_x && !IS_INTRA(j, -1))
>  j++;
>  if (j > 0)
> -if (x0 > 0) {
> +if (cand_up_left) {
>  EXTEND_LEFT_CIP(top, j, j + 1);
>  } else {
>  EXTEND_LEFT_CIP(top, j, j);
> --
> 2.17.1
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 3/6] put_bits: make avpriv_align_put_bits() inline

2020-10-26 Thread Andreas Rheinhardt
Anton Khirnov:
> This function is so extremely simple that it is preferable to make it
> inline rather than deal with all the complications arising from it being
> an exported symbol.
> 
> Keep avpriv_align_put_bits() around until the next major bump to
> preserve ABI compatibility.
> ---
>  libavcodec/aacenc.c |  4 ++--
>  libavcodec/bitstream.c  |  4 +++-
>  libavcodec/flvenc.c |  2 +-
>  libavcodec/h261enc.c|  2 +-
>  libavcodec/ituh263enc.c |  2 +-
>  libavcodec/jpeglsenc.c  |  2 +-
>  libavcodec/mpeg12enc.c  |  2 +-
>  libavcodec/mpeg4audio.h |  2 +-
>  libavcodec/msmpeg4enc.c |  2 +-
>  libavcodec/put_bits.h   | 23 ++-
>  libavcodec/rv10enc.c|  2 +-
>  libavcodec/svq1enc.c|  2 +-
>  libavcodec/vc2enc.c | 14 +++---
>  libavcodec/version.h|  4 +++-
>  libavcodec/wmaenc.c |  4 ++--
>  libavcodec/xsubenc.c|  2 +-
>  16 files changed, 45 insertions(+), 28 deletions(-)
> 
> diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> index e65b76cd74..e477089f5c 100644
> --- a/libavcodec/aacenc.c
> +++ b/libavcodec/aacenc.c
> @@ -83,7 +83,7 @@ static void put_pce(PutBitContext *pb, AVCodecContext 
> *avctx)
>  }
>  }
>  
> -avpriv_align_put_bits(pb);
> +align_put_bits(pb);
>  put_bits(pb, 8, strlen(aux_data));
>  avpriv_put_string(pb, aux_data, 0);
>  }
> @@ -522,7 +522,7 @@ static void put_bitstream_info(AACEncContext *s, const 
> char *name)
>  put_bits(&s->pb, 8, namelen - 14);
>  put_bits(&s->pb, 4, 0); //extension type - filler
>  padbits = -put_bits_count(&s->pb) & 7;
> -avpriv_align_put_bits(&s->pb);
> +align_put_bits(&s->pb);
>  for (i = 0; i < namelen - 2; i++)
>  put_bits(&s->pb, 8, name[i]);
>  put_bits(&s->pb, 12 - padbits, 0);
> diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
> index 77c2b9ce05..ea0299047f 100644
> --- a/libavcodec/bitstream.c
> +++ b/libavcodec/bitstream.c
> @@ -45,10 +45,12 @@ const uint8_t ff_log2_run[41]={
>  24,
>  };
>  
> +#if FF_API_AVPRIV_PUT_BITS
>  void avpriv_align_put_bits(PutBitContext *s)
>  {
> -put_bits(s, s->bit_left & 7, 0);
> +align_put_bits(s);
>  }
> +#endif
>  
>  void avpriv_put_string(PutBitContext *pb, const char *string,
> int terminate_string)
> diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
> index c1227277b3..b85e4667c4 100644
> --- a/libavcodec/flvenc.c
> +++ b/libavcodec/flvenc.c
> @@ -28,7 +28,7 @@ void ff_flv_encode_picture_header(MpegEncContext *s, int 
> picture_number)
>  {
>  int format;
>  
> -avpriv_align_put_bits(&s->pb);
> +align_put_bits(&s->pb);
>  
>  put_bits(&s->pb, 17, 1);
>  /* 0: H.263 escape codes 1: 11-bit escape codes */
> diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
> index 196c37b543..909bc23bb4 100644
> --- a/libavcodec/h261enc.c
> +++ b/libavcodec/h261enc.c
> @@ -55,7 +55,7 @@ void ff_h261_encode_picture_header(MpegEncContext *s, int 
> picture_number)
>  H261Context *h = (H261Context *)s;
>  int format, temp_ref;
>  
> -avpriv_align_put_bits(&s->pb);
> +align_put_bits(&s->pb);
>  
>  /* Update the pointer to last GOB */
>  s->ptr_lastgob = put_bits_ptr(&s->pb);
> diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
> index ee09f2974c..b1b78218a5 100644
> --- a/libavcodec/ituh263enc.c
> +++ b/libavcodec/ituh263enc.c
> @@ -124,7 +124,7 @@ void ff_h263_encode_picture_header(MpegEncContext * s, 
> int picture_number)
>  coded_frame_rate= 180;
>  coded_frame_rate_base= (1000+best_clock_code)*best_divisor;
>  
> -avpriv_align_put_bits(&s->pb);
> +align_put_bits(&s->pb);
>  
>  /* Update the pointer to last GOB */
>  s->ptr_lastgob = put_bits_ptr(&s->pb);
> diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
> index 0725457a94..10a3bd0f61 100644
> --- a/libavcodec/jpeglsenc.c
> +++ b/libavcodec/jpeglsenc.c
> @@ -403,7 +403,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  put_bits(&pb, 8, v);
>  }
>  }
> -avpriv_align_put_bits(&pb);
> +align_put_bits(&pb);
>  av_freep(&buf2);
>  
>  /* End of image */
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index f246427eeb..46c3424de9 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -233,7 +233,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  
>  static void put_header(MpegEncContext *s, int header)
>  {
> -avpriv_align_put_bits(&s->pb);
> +align_put_bits(&s->pb);
>  put_bits(&s->pb, 16, header >> 16);
>  put_sbits(&s->pb, 16, header);
>  }
> diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
> index c4cdc1508c..b274e92b62 100644
> --- a/libavcodec/mpeg4audio.h
> +++ b/libavcodec/mpeg4audio.h
> @@ -165,7 +165,7 @@ static inline int ff_copy_pce_data(PutBitContext *pb, 
> GetBitContext *gb)
>  ff_pce_copy_bits(pb, gb, 16);
>  if (bits)
>  ff_pce_copy_bits(pb, gb, bits);
> -avpriv_align_put_bits(pb

[FFmpeg-devel] [PATCH 2/6] lavf/latmenc: use a local simplified copy of avpriv_copy_bits()

2020-10-26 Thread Anton Khirnov
This is the only place in lavf where avpriv_copy_bits() is used, so this
allows us to make avpriv_copy_bits() lavc-local.
---
 libavformat/latmenc.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 684483bc71..701c3932c4 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -101,6 +101,17 @@ static int latm_write_header(AVFormatContext *s)
 return 0;
 }
 
+static void copy_bits(PutBitContext *pb, const uint8_t *src, int length)
+{
+int words = length >> 4;
+int bits  = length & 15;
+int i;
+for (i = 0; i < words; i++)
+put_bits(pb, 16, AV_RB16(src + 2 * i));
+if (bits)
+put_bits(pb, bits, AV_RB16(src + 2 * words) >> (16 - bits));
+}
+
 static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
 {
 LATMContext *ctx = s->priv_data;
@@ -121,11 +132,11 @@ static void latm_write_frame_header(AVFormatContext *s, 
PutBitContext *bs)
 /* AudioSpecificConfig */
 if (ctx->object_type == AOT_ALS) {
 header_size = (par->extradata_size - (ctx->off >> 3)) * 8;
-avpriv_copy_bits(bs, &par->extradata[ctx->off >> 3], header_size);
+copy_bits(bs, &par->extradata[ctx->off >> 3], header_size);
 } else {
 // + 3 assumes not scalable and dependsOnCoreCoder == 0,
 // see decode_ga_specific_config in libavcodec/aacdec.c
-avpriv_copy_bits(bs, par->extradata, ctx->off + 3);
+copy_bits(bs, par->extradata, ctx->off + 3);
 
 if (!ctx->channel_conf) {
 GetBitContext gb;
@@ -207,9 +218,9 @@ static int latm_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 // This allows us to remux our FATE AAC samples into latm
 // files that are still playable with minimal effort.
 put_bits(&bs, 8, pkt->data[0] & 0xfe);
-avpriv_copy_bits(&bs, pkt->data + 1, 8*pkt->size - 8);
+copy_bits(&bs, pkt->data + 1, 8*pkt->size - 8);
 } else
-avpriv_copy_bits(&bs, pkt->data, 8*pkt->size);
+copy_bits(&bs, pkt->data, 8*pkt->size);
 
 flush_put_bits(&bs);
 
-- 
2.28.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 6/6] lavc: un-avpriv avpriv_bprint_to_extradata()

2020-10-26 Thread Anton Khirnov
It has not been used outside of lavc since 6f69f7a8bf6.

Also, move it to the only place where it is used.
---
 libavcodec/dvdsubenc.c | 25 -
 libavcodec/internal.h  |  5 -
 libavcodec/utils.c | 23 ---
 3 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index e54b5f0d7b..9fa9d5b6d7 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -424,6 +424,29 @@ fail:
 return ret;
 }
 
+static int bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
+{
+int ret;
+char *str;
+
+ret = av_bprint_finalize(buf, &str);
+if (ret < 0)
+return ret;
+if (!av_bprint_is_complete(buf)) {
+av_free(str);
+return AVERROR(ENOMEM);
+}
+
+avctx->extradata = str;
+/* Note: the string is NUL terminated (so extradata can be read as a
+ * string), but the ending character is not accounted in the size (in
+ * binary formats you are likely not supposed to mux that character). When
+ * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
+ * zeros. */
+avctx->extradata_size = buf->len;
+return 0;
+}
+
 static int dvdsub_init(AVCodecContext *avctx)
 {
 DVDSubtitleContext *dvdc = avctx->priv_data;
@@ -451,7 +474,7 @@ static int dvdsub_init(AVCodecContext *avctx)
 av_bprintf(&extradata, " %06"PRIx32"%c",
dvdc->global_palette[i] & 0xFF, i < 15 ? ',' : '\n');
 
-ret = avpriv_bprint_to_extradata(avctx, &extradata);
+ret = bprint_to_extradata(avctx, &extradata);
 if (ret < 0)
 return ret;
 
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index ce4dbbc2b9..17defb9b50 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -313,11 +313,6 @@ int avpriv_h264_has_num_reorder_frames(AVCodecContext 
*avctx);
  */
 int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, 
AVDictionary **options);
 
-/**
- * Finalize buf into extradata and set its size appropriately.
- */
-int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf);
-
 const uint8_t *avpriv_find_start_code(const uint8_t *p,
   const uint8_t *end,
   uint32_t *state);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 93ac1cd9f0..fb40962c47 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1946,29 +1946,6 @@ int avcodec_is_open(AVCodecContext *s)
 return !!s->internal;
 }
 
-int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
-{
-int ret;
-char *str;
-
-ret = av_bprint_finalize(buf, &str);
-if (ret < 0)
-return ret;
-if (!av_bprint_is_complete(buf)) {
-av_free(str);
-return AVERROR(ENOMEM);
-}
-
-avctx->extradata = str;
-/* Note: the string is NUL terminated (so extradata can be read as a
- * string), but the ending character is not accounted in the size (in
- * binary formats you are likely not supposed to mux that character). When
- * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
- * zeros. */
-avctx->extradata_size = buf->len;
-return 0;
-}
-
 const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
   const uint8_t *end,
   uint32_t *av_restrict state)
-- 
2.28.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/6] lavf/latmenc: fix units mismatch

2020-10-26 Thread Anton Khirnov
avpriv_copy_bits() takes the size in bits, not bytes. According to
a736eb4a605f46d5ff96c7b32e55710ecd9cce89, nobody is quite sure whether
this code produces working files.
---
 libavformat/latmenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 5458ce2596..684483bc71 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -120,7 +120,7 @@ static void latm_write_frame_header(AVFormatContext *s, 
PutBitContext *bs)
 
 /* AudioSpecificConfig */
 if (ctx->object_type == AOT_ALS) {
-header_size = par->extradata_size-(ctx->off >> 3);
+header_size = (par->extradata_size - (ctx->off >> 3)) * 8;
 avpriv_copy_bits(bs, &par->extradata[ctx->off >> 3], header_size);
 } else {
 // + 3 assumes not scalable and dependsOnCoreCoder == 0,
-- 
2.28.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/6] put_bits: make avpriv_put_string() lavc-local

2020-10-26 Thread Anton Khirnov
It has not been used outside of libavcodec since
20f325f320c6e18ee88983870d2a1fee94257293
---
 libavcodec/aacenc.c  | 2 +-
 libavcodec/bitstream.c   | 3 +--
 libavcodec/mjpegenc_common.c | 6 +++---
 libavcodec/mpeg4videoenc.c   | 2 +-
 libavcodec/put_bits.h| 4 ++--
 libavcodec/vc2enc.c  | 4 ++--
 6 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index e477089f5c..bb203981b2 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -85,7 +85,7 @@ static void put_pce(PutBitContext *pb, AVCodecContext *avctx)
 
 align_put_bits(pb);
 put_bits(pb, 8, strlen(aux_data));
-avpriv_put_string(pb, aux_data, 0);
+ff_put_string(pb, aux_data, 0);
 }
 
 /**
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index ea0299047f..2eb8aac5fc 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -52,8 +52,7 @@ void avpriv_align_put_bits(PutBitContext *s)
 }
 #endif
 
-void avpriv_put_string(PutBitContext *pb, const char *string,
-   int terminate_string)
+void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
 {
 while (*string) {
 put_bits(pb, 8, *string);
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 3038ebde6e..0b82777ec9 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -181,7 +181,7 @@ static void jpeg_put_comments(AVCodecContext *avctx, 
PutBitContext *p)
 /* JFIF header */
 put_marker(p, APP0);
 put_bits(p, 16, 16);
-avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte 
too */
+ff_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
 /* The most significant byte is used for major revisions, the least
  * significant byte for minor revisions. Version 1.02 is the current
  * released revision. */
@@ -199,7 +199,7 @@ static void jpeg_put_comments(AVCodecContext *avctx, 
PutBitContext *p)
 flush_put_bits(p);
 ptr = put_bits_ptr(p);
 put_bits(p, 16, 0); /* patched later */
-avpriv_put_string(p, LIBAVCODEC_IDENT, 1);
+ff_put_string(p, LIBAVCODEC_IDENT, 1);
 size = strlen(LIBAVCODEC_IDENT)+3;
 AV_WB16(ptr, size);
 }
@@ -212,7 +212,7 @@ static void jpeg_put_comments(AVCodecContext *avctx, 
PutBitContext *p)
 flush_put_bits(p);
 ptr = put_bits_ptr(p);
 put_bits(p, 16, 0); /* patched later */
-avpriv_put_string(p, "CS=ITU601", 1);
+ff_put_string(p, "CS=ITU601", 1);
 size = strlen("CS=ITU601")+3;
 AV_WB16(ptr, size);
 }
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index a6a15e302c..72e6f99eaa 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1054,7 +1054,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
 if (!(s->avctx->flags & AV_CODEC_FLAG_BITEXACT)) {
 put_bits(&s->pb, 16, 0);
 put_bits(&s->pb, 16, 0x1B2);/* user_data */
-avpriv_put_string(&s->pb, LIBAVCODEC_IDENT, 0);
+ff_put_string(&s->pb, LIBAVCODEC_IDENT, 0);
 }
 }
 
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 7d17cba18b..f6310224ef 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -152,7 +152,7 @@ void avpriv_align_put_bits(PutBitContext *s);
 #endif
 
 #ifdef BITSTREAM_WRITER_LE
-#define avpriv_put_string ff_put_string_unsupported_here
+#define ff_put_string ff_put_string_unsupported_here
 #define avpriv_copy_bits avpriv_copy_bits_unsupported_here
 #else
 
@@ -161,7 +161,7 @@ void avpriv_align_put_bits(PutBitContext *s);
  *
  * @param terminate_string 0-terminates the written string if value is 1
  */
-void avpriv_put_string(PutBitContext *pb, const char *string,
+void ff_put_string(PutBitContext *pb, const char *string,
int terminate_string);
 
 /**
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index cd25884a63..bab9d0f3d5 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -234,7 +234,7 @@ static void encode_parse_info(VC2EncContext *s, enum 
DiracParseCodes pcode)
 cur_pos = put_bits_count(&s->pb) >> 3;
 
 /* Magic string */
-avpriv_put_string(&s->pb, "BBCD", 0);
+ff_put_string(&s->pb, "BBCD", 0);
 
 /* Parse code */
 put_bits(&s->pb, 8, pcode);
@@ -931,7 +931,7 @@ static int encode_frame(VC2EncContext *s, AVPacket *avpkt, 
const AVFrame *frame,
 /* Encoder version */
 if (aux_data) {
 encode_parse_info(s, DIRAC_PCODE_AUX);
-avpriv_put_string(&s->pb, aux_data, 1);
+ff_put_string(&s->pb, aux_data, 1);
 }
 
 /* Picture header */
-- 
2.28.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 subjec

[FFmpeg-devel] [PATCH 5/6] put_bits: make avpriv_copy_bits() lavc-local

2020-10-26 Thread Anton Khirnov
It is not used outside of lavc anymore. Keep the avpriv exported symbol
around until the next bump to preserve ABI compatibility.
---
 libavcodec/bitstream.c  | 6 +-
 libavcodec/mpeg4videoenc.c  | 4 ++--
 libavcodec/mpegvideo_enc.c  | 8 
 libavcodec/put_bits.h   | 5 +++--
 libavcodec/svq1enc.c| 2 +-
 libavcodec/wmalosslessdec.c | 4 ++--
 libavcodec/wmaprodec.c  | 4 ++--
 libavcodec/wmavoice.c   | 4 ++--
 8 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 2eb8aac5fc..21f58a91fa 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -50,6 +50,10 @@ void avpriv_align_put_bits(PutBitContext *s)
 {
 align_put_bits(s);
 }
+void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
+{
+ff_copy_bits(pb, src, length);
+}
 #endif
 
 void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
@@ -62,7 +66,7 @@ void ff_put_string(PutBitContext *pb, const char *string, int 
terminate_string)
 put_bits(pb, 8, 0);
 }
 
-void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
+void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
 {
 int words = length >> 4;
 int bits  = length & 15;
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 72e6f99eaa..b3fa910c64 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1354,8 +1354,8 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s)
 flush_put_bits(&s->tex_pb);
 
 set_put_bits_buffer_size(&s->pb, s->pb2.buf_end - s->pb.buf);
-avpriv_copy_bits(&s->pb, s->pb2.buf, pb2_len);
-avpriv_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);
+ff_copy_bits(&s->pb, s->pb2.buf, pb2_len);
+ff_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);
 s->last_bits = put_bits_count(&s->pb);
 }
 
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b16faf6b55..f16b26c9f2 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3351,18 +3351,18 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 pb_bits_count= put_bits_count(&s->pb);
 flush_put_bits(&s->pb);
-avpriv_copy_bits(&backup_s.pb, bit_buf[next_block^1], 
pb_bits_count);
+ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], 
pb_bits_count);
 s->pb= backup_s.pb;
 
 if(s->data_partitioning){
 pb2_bits_count= put_bits_count(&s->pb2);
 flush_put_bits(&s->pb2);
-avpriv_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], 
pb2_bits_count);
+ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], 
pb2_bits_count);
 s->pb2= backup_s.pb2;
 
 tex_pb_bits_count= put_bits_count(&s->tex_pb);
 flush_put_bits(&s->tex_pb);
-avpriv_copy_bits(&backup_s.tex_pb, 
bit_buf_tex[next_block^1], tex_pb_bits_count);
+ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], 
tex_pb_bits_count);
 s->tex_pb= backup_s.tex_pb;
 }
 s->last_bits= put_bits_count(&s->pb);
@@ -3589,7 +3589,7 @@ static void merge_context_after_encode(MpegEncContext 
*dst, MpegEncContext *src)
 
 av_assert1(put_bits_count(&src->pb) % 8 ==0);
 av_assert1(put_bits_count(&dst->pb) % 8 ==0);
-avpriv_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));
+ff_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));
 flush_put_bits(&dst->pb);
 }
 
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index f6310224ef..8e6f70893d 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -149,11 +149,12 @@ static inline void flush_put_bits_le(PutBitContext *s)
 
 #if FF_API_AVPRIV_PUT_BITS
 void avpriv_align_put_bits(PutBitContext *s);
+void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
 #endif
 
 #ifdef BITSTREAM_WRITER_LE
 #define ff_put_string ff_put_string_unsupported_here
-#define avpriv_copy_bits avpriv_copy_bits_unsupported_here
+#define ff_copy_bits ff_copy_bits_unsupported_here
 #else
 
 /**
@@ -169,7 +170,7 @@ void ff_put_string(PutBitContext *pb, const char *string,
  *
  * @param length the number of bits of src to copy
  */
-void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
+void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
 #endif
 
 static inline void put_bits_no_assert(PutBitContext *s, int n, BitBuf value)
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 9e249aefe4..4fac0c26e5 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -472,7 +472,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
 
 if (best != 2)
 for (i = 5; i >= 0; i--)
-avpriv_copy_bits(&s->pb, reorder_buffer[best][i],
+ff_cop

[FFmpeg-devel] [PATCH 3/6] put_bits: make avpriv_align_put_bits() inline

2020-10-26 Thread Anton Khirnov
This function is so extremely simple that it is preferable to make it
inline rather than deal with all the complications arising from it being
an exported symbol.

Keep avpriv_align_put_bits() around until the next major bump to
preserve ABI compatibility.
---
 libavcodec/aacenc.c |  4 ++--
 libavcodec/bitstream.c  |  4 +++-
 libavcodec/flvenc.c |  2 +-
 libavcodec/h261enc.c|  2 +-
 libavcodec/ituh263enc.c |  2 +-
 libavcodec/jpeglsenc.c  |  2 +-
 libavcodec/mpeg12enc.c  |  2 +-
 libavcodec/mpeg4audio.h |  2 +-
 libavcodec/msmpeg4enc.c |  2 +-
 libavcodec/put_bits.h   | 23 ++-
 libavcodec/rv10enc.c|  2 +-
 libavcodec/svq1enc.c|  2 +-
 libavcodec/vc2enc.c | 14 +++---
 libavcodec/version.h|  4 +++-
 libavcodec/wmaenc.c |  4 ++--
 libavcodec/xsubenc.c|  2 +-
 16 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index e65b76cd74..e477089f5c 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -83,7 +83,7 @@ static void put_pce(PutBitContext *pb, AVCodecContext *avctx)
 }
 }
 
-avpriv_align_put_bits(pb);
+align_put_bits(pb);
 put_bits(pb, 8, strlen(aux_data));
 avpriv_put_string(pb, aux_data, 0);
 }
@@ -522,7 +522,7 @@ static void put_bitstream_info(AACEncContext *s, const char 
*name)
 put_bits(&s->pb, 8, namelen - 14);
 put_bits(&s->pb, 4, 0); //extension type - filler
 padbits = -put_bits_count(&s->pb) & 7;
-avpriv_align_put_bits(&s->pb);
+align_put_bits(&s->pb);
 for (i = 0; i < namelen - 2; i++)
 put_bits(&s->pb, 8, name[i]);
 put_bits(&s->pb, 12 - padbits, 0);
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 77c2b9ce05..ea0299047f 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -45,10 +45,12 @@ const uint8_t ff_log2_run[41]={
 24,
 };
 
+#if FF_API_AVPRIV_PUT_BITS
 void avpriv_align_put_bits(PutBitContext *s)
 {
-put_bits(s, s->bit_left & 7, 0);
+align_put_bits(s);
 }
+#endif
 
 void avpriv_put_string(PutBitContext *pb, const char *string,
int terminate_string)
diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
index c1227277b3..b85e4667c4 100644
--- a/libavcodec/flvenc.c
+++ b/libavcodec/flvenc.c
@@ -28,7 +28,7 @@ void ff_flv_encode_picture_header(MpegEncContext *s, int 
picture_number)
 {
 int format;
 
-avpriv_align_put_bits(&s->pb);
+align_put_bits(&s->pb);
 
 put_bits(&s->pb, 17, 1);
 /* 0: H.263 escape codes 1: 11-bit escape codes */
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index 196c37b543..909bc23bb4 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -55,7 +55,7 @@ void ff_h261_encode_picture_header(MpegEncContext *s, int 
picture_number)
 H261Context *h = (H261Context *)s;
 int format, temp_ref;
 
-avpriv_align_put_bits(&s->pb);
+align_put_bits(&s->pb);
 
 /* Update the pointer to last GOB */
 s->ptr_lastgob = put_bits_ptr(&s->pb);
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index ee09f2974c..b1b78218a5 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -124,7 +124,7 @@ void ff_h263_encode_picture_header(MpegEncContext * s, int 
picture_number)
 coded_frame_rate= 180;
 coded_frame_rate_base= (1000+best_clock_code)*best_divisor;
 
-avpriv_align_put_bits(&s->pb);
+align_put_bits(&s->pb);
 
 /* Update the pointer to last GOB */
 s->ptr_lastgob = put_bits_ptr(&s->pb);
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
index 0725457a94..10a3bd0f61 100644
--- a/libavcodec/jpeglsenc.c
+++ b/libavcodec/jpeglsenc.c
@@ -403,7 +403,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 put_bits(&pb, 8, v);
 }
 }
-avpriv_align_put_bits(&pb);
+align_put_bits(&pb);
 av_freep(&buf2);
 
 /* End of image */
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index f246427eeb..46c3424de9 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -233,7 +233,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 static void put_header(MpegEncContext *s, int header)
 {
-avpriv_align_put_bits(&s->pb);
+align_put_bits(&s->pb);
 put_bits(&s->pb, 16, header >> 16);
 put_sbits(&s->pb, 16, header);
 }
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index c4cdc1508c..b274e92b62 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -165,7 +165,7 @@ static inline int ff_copy_pce_data(PutBitContext *pb, 
GetBitContext *gb)
 ff_pce_copy_bits(pb, gb, 16);
 if (bits)
 ff_pce_copy_bits(pb, gb, bits);
-avpriv_align_put_bits(pb);
+align_put_bits(pb);
 align_get_bits(gb);
 comment_size = ff_pce_copy_bits(pb, gb, 8);
 for (; comment_size > 0; comment_size--)
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 144468b24f..2c61735d9d 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c

[FFmpeg-devel] [PATCH v3 2/3] avformat/mpegtsenc: make first_pcr sync with the first valid dts

2020-10-26 Thread lance . lmwang
From: Limin Wang 

now first_pts assume dts will start from zero, if it's not true(copyts is 
enable),
too many null packet will be inserted for cbr output.

Please test with below command, you'll get huge test.ts without the patch:
./ffmpeg -y -copyts -i ../fate-suite/mpegts/loewe.ts  -c:v libx264 -x264opts \
   nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize \
   1000k  -c:a mp2 -muxrate 4500k  -vframes 1000 test.ts

Signed-off-by: Limin Wang 
---
 libavformat/mpegtsenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 5c97d63..29dcaf6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -81,6 +81,7 @@ typedef struct MpegTSWrite {
 int64_t pat_period; /* PAT/PMT period in PCR time base */
 int nb_services;
 int64_t first_pcr;
+int first_dts_checked;
 int64_t next_pcr;
 int mux_rate; ///< set to 1 when VBR
 int pes_payload_size;
@@ -1688,6 +1689,11 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 stream_id = side_data[0];
 
 if (ts->copyts < 1) {
+if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) {
+ts->first_pcr += dts * 300;
+ts->first_dts_checked = 1;
+}
+
 if (pts != AV_NOPTS_VALUE)
 pts += delay;
 if (dts != AV_NOPTS_VALUE)
-- 
1.8.3.1

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

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

[FFmpeg-devel] [PATCH 2/3] avcodec/vp3: Don't check for errors for complete VLC

2020-10-26 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/vp3.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 51be4ebf05..c4ad43a299 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -682,11 +682,6 @@ static int vp4_get_mb_count(Vp3DecodeContext *s, 
GetBitContext *gb)
 static int vp4_get_block_pattern(Vp3DecodeContext *s, GetBitContext *gb, int 
*next_block_pattern_table)
 {
 int v = get_vlc2(gb, 
s->block_pattern_vlc[*next_block_pattern_table].table, 3, 2);
-if (v == -1) {
-av_log(s->avctx, AV_LOG_ERROR, "Invalid block pattern\n");
-*next_block_pattern_table = 0;
-return 0;
-}
 *next_block_pattern_table = vp4_block_pattern_table_selector[v];
 return v + 1;
 }
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 1/3] avcodec/cllc: Don't unnecessarily free VLC

2020-10-26 Thread Andreas Rheinhardt
The Canopus Lossless decoder uses several VLCs and if initializing the
ith VLC fails, all the VLCs 0..i have been freed; the ith VLC's table is
initialized to NULL for this purpose. Yet it is totally unnecessary to
free the ith VLC table at all: ff_init_vlc_sparse() cleans up after
itself on error and if an error happens before ff_init_vlc_sparse(),
the ith VLC hasn't been touched yet and doesn't need freeing.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cllc.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
index 1f2c98ef73..8b1bc75faa 100644
--- a/libavcodec/cllc.c
+++ b/libavcodec/cllc.c
@@ -57,8 +57,6 @@ static int read_code_table(CLLCContext *ctx, GetBitContext 
*gb, VLC *vlc)
 num_lens = get_bits(gb, 5);
 
 if (num_lens > VLC_BITS * VLC_DEPTH) {
-vlc->table = NULL;
-
 av_log(ctx->avctx, AV_LOG_ERROR, "To long VLCs %d\n", num_lens);
 return AVERROR_INVALIDDATA;
 }
@@ -68,8 +66,6 @@ static int read_code_table(CLLCContext *ctx, GetBitContext 
*gb, VLC *vlc)
 num_codes_sum += num_codes;
 
 if (num_codes_sum > 256) {
-vlc->table = NULL;
-
 av_log(ctx->avctx, AV_LOG_ERROR,
"Too many VLCs (%d) to be read.\n", num_codes_sum);
 return AVERROR_INVALIDDATA;
@@ -83,7 +79,6 @@ static int read_code_table(CLLCContext *ctx, GetBitContext 
*gb, VLC *vlc)
 count++;
 }
 if (prefix > (65535 - 256)/2) {
-vlc->table = NULL;
 return AVERROR_INVALIDDATA;
 }
 
@@ -247,7 +242,7 @@ static int decode_argb_frame(CLLCContext *ctx, 
GetBitContext *gb, AVFrame *pic)
 for (i = 0; i < 4; i++) {
 ret = read_code_table(ctx, gb, &vlc[i]);
 if (ret < 0) {
-for (j = 0; j <= i; j++)
+for (j = 0; j < i; j++)
 ff_free_vlc(&vlc[j]);
 
 av_log(ctx->avctx, AV_LOG_ERROR,
@@ -290,7 +285,7 @@ static int decode_rgb24_frame(CLLCContext *ctx, 
GetBitContext *gb, AVFrame *pic)
 for (i = 0; i < 3; i++) {
 ret = read_code_table(ctx, gb, &vlc[i]);
 if (ret < 0) {
-for (j = 0; j <= i; j++)
+for (j = 0; j < i; j++)
 ff_free_vlc(&vlc[j]);
 
 av_log(ctx->avctx, AV_LOG_ERROR,
@@ -343,7 +338,7 @@ static int decode_yuv_frame(CLLCContext *ctx, GetBitContext 
*gb, AVFrame *pic)
 for (i = 0; i < 2; i++) {
 ret = read_code_table(ctx, gb, &vlc[i]);
 if (ret < 0) {
-for (j = 0; j <= i; j++)
+for (j = 0; j < i; j++)
 ff_free_vlc(&vlc[j]);
 
 av_log(ctx->avctx, AV_LOG_ERROR,
-- 
2.25.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 3/3] avcodec/bitstream: Consistently treat symbol as VLC_TYPE

2020-10-26 Thread Andreas Rheinhardt
If a static VLC table gets initialized a second time (or concurrently by
two threads) and if said VLC table uses symbols that have the sign bit
of VLC_TYPE (a typedef for int16_t) set, initializing the VLC fails. The
reason is that the type of the symbol in the temporary array is an
uint16_t and so comparing it to the symbol read from the VLC table will
fail, because only the lower 16bits coincide. Said failure triggers an
assert.

Signed-off-by: Andreas Rheinhardt 
---
Found when playing around a bit with making the ClearVideo VLCs static.

 libavcodec/bitstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 39749c6092..a908c10980 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -129,7 +129,7 @@ static int alloc_table(VLC *vlc, int size, int use_static)
 
 typedef struct VLCcode {
 uint8_t bits;
-uint16_t symbol;
+VLC_TYPE symbol;
 /** codeword, with the first bit-to-be-read in the msb
  * (even if intended for a little-endian bitstream reader) */
 uint32_t code;
-- 
2.25.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] How do I add the starttime and totalduration DOUBLE-type metadata to FLV files?

2020-10-26 Thread Ben Hutchinson
Google's standard for FLV (as used on older versions of YouTube player and
Google Video player) involves at least 2 additional metadata tags. These
are starttime and totalduration. The value for starttime should be 0, and
totalduration should be equal to the official Adobe Flash Video standard
"duration" metadata tag. But there's a problem. These tags are of type
DOUBLE, not STRING, and FFMPEG only allows the insertion of STRING type
metadata tags, at least from what I've seen.

If this isn't already possible in FFMPEG, please consider this a feature
request for future versions.

FFMPEG developers, please hear my reasoning for this feature. This is
important for making the FLV files work correctly in Google's old video
players. I have a copy of one of those players (the actual SWF file, as
downloaded from an archived copy of a video.google.com webpage on the
Internet Archive Wayback Machine, archive.org).

I've successfully embedded the player in a website I have hosted on my own
PC via the Mongoose web server software. And I've managed to successfully
make it play 2 FLV files. One is directly from the old Google Videos
website (again archived on the Wayback Machine), and the other I got from
converting (via FFMPEG) one of my own video files to the FLV format. The
original Google FLV file works completely without glitches in the webpage
embedded Google Video player. The one I got from converting another video
file to FLV does play but it has issues. These issues are that it says NaN
for both the start and stop times in the player's time display, and also
that I can't seek at all in the video. I can only let the video play
through all the way from beginning to end.

If I could add the DOUBLE-type metadata tags starttime and totalduration, I
would likely have a working FLV file, which would play perfectly in the
Google Video player.
___
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/3] avcodec/webp: Use uint8_t for code lengths

2020-10-26 Thread Andreas Rheinhardt
"zhilizhao(赵志立)":
> 
> 
>> On Oct 26, 2020, at 3:24 PM, Andreas Rheinhardt 
>>  wrote:
>>
>> Andreas Rheinhardt:
>>> They are always in the range 0..15, so using an int is not necessary.
>>> Furthermore, using an int would not work if sizeof(int) == 4 as
> 
> You mean if sizeof(int) != 4 ?
> 

Good catch. Fixed locally. Thanks.

- Andreas
___
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/3] avcodec/webp: Use uint8_t for code lengths

2020-10-26 Thread zhilizhao(赵志立)


> On Oct 26, 2020, at 3:24 PM, Andreas Rheinhardt 
>  wrote:
> 
> Andreas Rheinhardt:
>> They are always in the range 0..15, so using an int is not necessary.
>> Furthermore, using an int would not work if sizeof(int) == 4 as

You mean if sizeof(int) != 4 ?

>> ff_init_vlc_sparse() can only handle uint8_t, uint16_t and uint32_t
>> lengths.
>> 
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>> libavcodec/webp.c | 8 
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>> 
>> diff --git a/libavcodec/webp.c b/libavcodec/webp.c
>> index 6140c7ea4a..6b53a7f17c 100644
>> --- a/libavcodec/webp.c
>> +++ b/libavcodec/webp.c
>> @@ -243,7 +243,7 @@ static int huff_reader_get_symbol(HuffReader *r, 
>> GetBitContext *gb)
>> return get_vlc2(gb, r->vlc.table, 8, 2);
>> }
>> 
>> -static int huff_reader_build_canonical(HuffReader *r, int *code_lengths,
>> +static int huff_reader_build_canonical(HuffReader *r, const uint8_t 
>> *code_lengths,
>>int alphabet_size)
>> {
>> int len = 0, sym, code = 0, ret;
>> @@ -324,8 +324,8 @@ static int read_huffman_code_normal(WebPContext *s, 
>> HuffReader *hc,
>> int alphabet_size)
>> {
>> HuffReader code_len_hc = { { 0 }, 0, 0, { 0 } };
>> -int *code_lengths = NULL;
>> -int code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
>> +uint8_t *code_lengths = NULL;
>> +uint8_t code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
>> int i, symbol, max_symbol, prev_code_len, ret;
>> int num_codes = 4 + get_bits(&s->gb, 4);
>> 
>> @@ -340,7 +340,7 @@ static int read_huffman_code_normal(WebPContext *s, 
>> HuffReader *hc,
>> if (ret < 0)
>> goto finish;
>> 
>> -code_lengths = av_mallocz_array(alphabet_size, sizeof(*code_lengths));
>> +code_lengths = av_mallocz(alphabet_size);
>> if (!code_lengths) {
>> ret = AVERROR(ENOMEM);
>> goto finish;
>> 
> Will apply this patchset later today unless there are objections.
> 
> - Andreas
> ___
> 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 8/8] avcodec/dirac_parser: do not offset AV_NOPTS_OFFSET

2020-10-26 Thread Michael Niedermayer
On Fri, Oct 23, 2020 at 08:39:40PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -9223372036854775807 - 48000 cannot be 
> represented in type 'long long'
> Fixes: 
> 26521/clusterfuzz-testcase-minimized-ffmpeg_dem_DIRAC_fuzzer-5635536506847232
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/dirac_parser.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed by Lynne by email -> will apply

thx

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

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


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
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] Preventing Buffer Overflow for RTSP Links Increasing the buffer size of control uri, used when storing the input argument RTSP link. Following the Web URI standards, lengths

2020-10-26 Thread Anton Khirnov
Hi,
Quoting g...@yigituyan.com (2020-10-21 20:17:18)
> Hi, I've just checked the state of this patch on Patchwork. There are 
> three builds listed, two successful and one warning. I've checked the 
> logs for the warning, none seems to be about the submitted patch. I've 
> also thoroughly tested the code prior to submitting.
> 
> This is the first patch I'm submitting to ffmpeg. When would this patch 
> be included in the official builds? Is there anything I need to do?
> 
> Also is there a nightly, or a dev version of ffmpeg including this patch 
> that I can share with others to try it out?

I am not an expert on RTSP, but it could help if you:
- reformatted the commit message according to project standards
- added a more specific reference to the standards you mention
- described how did you test the fix

-- 
Anton Khirnov
___
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/3] avcodec/webp: Use uint8_t for code lengths

2020-10-26 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> They are always in the range 0..15, so using an int is not necessary.
> Furthermore, using an int would not work if sizeof(int) == 4 as
> ff_init_vlc_sparse() can only handle uint8_t, uint16_t and uint32_t
> lengths.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/webp.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> index 6140c7ea4a..6b53a7f17c 100644
> --- a/libavcodec/webp.c
> +++ b/libavcodec/webp.c
> @@ -243,7 +243,7 @@ static int huff_reader_get_symbol(HuffReader *r, 
> GetBitContext *gb)
>  return get_vlc2(gb, r->vlc.table, 8, 2);
>  }
>  
> -static int huff_reader_build_canonical(HuffReader *r, int *code_lengths,
> +static int huff_reader_build_canonical(HuffReader *r, const uint8_t 
> *code_lengths,
> int alphabet_size)
>  {
>  int len = 0, sym, code = 0, ret;
> @@ -324,8 +324,8 @@ static int read_huffman_code_normal(WebPContext *s, 
> HuffReader *hc,
>  int alphabet_size)
>  {
>  HuffReader code_len_hc = { { 0 }, 0, 0, { 0 } };
> -int *code_lengths = NULL;
> -int code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
> +uint8_t *code_lengths = NULL;
> +uint8_t code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
>  int i, symbol, max_symbol, prev_code_len, ret;
>  int num_codes = 4 + get_bits(&s->gb, 4);
>  
> @@ -340,7 +340,7 @@ static int read_huffman_code_normal(WebPContext *s, 
> HuffReader *hc,
>  if (ret < 0)
>  goto finish;
>  
> -code_lengths = av_mallocz_array(alphabet_size, sizeof(*code_lengths));
> +code_lengths = av_mallocz(alphabet_size);
>  if (!code_lengths) {
>  ret = AVERROR(ENOMEM);
>  goto finish;
> 
Will apply this patchset later today unless there are objections.

- Andreas
___
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/3] avcodec/atrac3: Don't use too big VLC tables

2020-10-26 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> The longest code of any of the VLC tables used is eight bits long, so
> using nine bits long VLC tables is wasteful. Furthermore, there are only
> seven VLC tables used, yet the code up until now made it look like there
> should be eight. This has been corrected, too.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/atrac3.c | 13 -
>  libavcodec/atrac3data.h |  4 
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
> index dc68e507aa..01b7f06bff 100644
> --- a/libavcodec/atrac3.c
> +++ b/libavcodec/atrac3.c
> @@ -58,6 +58,8 @@
>  #define SAMPLES_PER_FRAME 1024
>  #define MDCT_SIZE  512
>  
> +#define ATRAC3_VLC_BITS 8
> +
>  typedef struct GainBlock {
>  AtracGainInfo g_block[4];
>  } GainBlock;
> @@ -116,7 +118,7 @@ typedef struct ATRAC3Context {
>  } ATRAC3Context;
>  
>  static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE];
> -static VLC_TYPE atrac3_vlc_table[4096][2];
> +static VLC_TYPE atrac3_vlc_table[7 * 1 << ATRAC3_VLC_BITS][2];
>  static VLC   spectral_coeff_tab[7];
>  
>  /**
> @@ -851,6 +853,7 @@ static int atrac3al_decode_frame(AVCodecContext *avctx, 
> void *data,
>  
>  static av_cold void atrac3_init_static_data(void)
>  {
> +VLC_TYPE (*table)[2] = atrac3_vlc_table;
>  int i;
>  
>  init_imdct_window();
> @@ -858,12 +861,12 @@ static av_cold void atrac3_init_static_data(void)
>  
>  /* Initialize the VLC tables. */
>  for (i = 0; i < 7; i++) {
> -spectral_coeff_tab[i].table = &atrac3_vlc_table[atrac3_vlc_offs[i]];
> -spectral_coeff_tab[i].table_allocated = atrac3_vlc_offs[i + 1] -
> -atrac3_vlc_offs[i];
> -init_vlc(&spectral_coeff_tab[i], 9, huff_tab_sizes[i],
> +spectral_coeff_tab[i].table   = table;
> +spectral_coeff_tab[i].table_allocated = 256;
> +init_vlc(&spectral_coeff_tab[i], ATRAC3_VLC_BITS, huff_tab_sizes[i],
>   huff_bits[i],  1, 1,
>   huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
> +table += 256;
>  }
>  }
>  
> diff --git a/libavcodec/atrac3data.h b/libavcodec/atrac3data.h
> index 5d91274f48..a731fb7c4a 100644
> --- a/libavcodec/atrac3data.h
> +++ b/libavcodec/atrac3data.h
> @@ -103,10 +103,6 @@ static const uint8_t* const huff_bits[7] = {
>  huffbits1, huffbits2, huffbits3, huffbits4, huffbits5, huffbits6, 
> huffbits7,
>  };
>  
> -static const uint16_t atrac3_vlc_offs[9] = {
> -0, 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096
> -};
> -
>  /* selector tables */
>  
>  static const uint8_t clc_length_tab[8] = { 0, 4, 3, 3, 4, 4, 5, 6 };
> 
Will apply this patchset later today unless there are objections.

- Andreas
___
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/atrac3plus: Perform reusing of VLCs during init

2020-10-26 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/atrac3plus.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
> index 8d17889582..6b046a887e 100644
> --- a/libavcodec/atrac3plus.c
> +++ b/libavcodec/atrac3plus.c
> @@ -192,12 +192,12 @@ av_cold void ff_atrac3p_init_vlcs(void)
>  
>  /* build huffman tables for spectrum decoding */
>  for (i = 0; i < 112; i++) {
> -if (atrac3p_spectra_tabs[i].cb)
> +if (atrac3p_spectra_tabs[i].redirect < 0)
>  build_canonical_huff(atrac3p_spectra_tabs[i].cb,
>   atrac3p_spectra_tabs[i].xlat,
>   &tab_offset, &spec_vlc_tabs[i]);
> -else
> -spec_vlc_tabs[i].table = 0;
> +else /* Reuse already initialized VLC table */
> +spec_vlc_tabs[i] = 
> spec_vlc_tabs[atrac3p_spectra_tabs[i].redirect];
>  }
>  
>  /* build huffman tables for gain data decoding */
> @@ -880,10 +880,6 @@ static void decode_spectrum(GetBitContext *gb, 
> Atrac3pChanUnitCtx *ctx,
>  tab_index = (chan->table_type * 8 + codetab) * 7 + wordlen - 
> 1;
>  tab   = &atrac3p_spectra_tabs[tab_index];
>  
> -/* this allows reusing VLC tables */
> -if (tab->redirect >= 0)
> -tab_index = tab->redirect;
> -
>  decode_qu_spectra(gb, tab, &spec_vlc_tabs[tab_index],
>
> &chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]],
>num_specs);
> 
Will apply the rest of this patchset tomorrow unless there are objections.

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