Re: [FFmpeg-devel] [PATCH] avcodec/dnxhddec: Use VLC symbol table to avoid lookup

2023-09-16 Thread Paul B Mahol
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".


Re: [FFmpeg-devel] [PATCH] avformat: add CRI USM demuxer

2023-09-16 Thread Paul B Mahol
Will push soon.
___
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/lagarith: use VLC for probe code length

2023-09-16 Thread Paul B Mahol
Will apply soon.
___
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/x86/af_afir: add FMA3 SIMD

2023-09-16 Thread Paul B Mahol
Will apply soon.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation

2023-09-16 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/thread.h | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/libavcodec/thread.h b/libavcodec/thread.h
> index 2c8c0cdb16..180e1137ae 100644
> --- a/libavcodec/thread.h
> +++ b/libavcodec/thread.h
> @@ -73,12 +73,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx);
>  int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);
>  
>  /**
> - * Wrapper around release_buffer() frame-for multithreaded codecs.
> - * Call this function instead of avctx->release_buffer(f).
> - * The AVFrame will be copied and the actual release_buffer() call
> - * will be performed later. The contents of data pointed to by the
> - * AVFrame should not be changed until ff_thread_get_buffer() is called
> - * on it.
> + * Wrapper around av_frame_unref() for frame-threaded codecs.
>   *
>   * @param avctx The current context.
>   * @param f The picture being released.

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/utvideodec: add vlc multi support

2023-09-16 Thread Michael Niedermayer
On Fri, Sep 15, 2023 at 01:24:39AM +0200, Paul B Mahol wrote:
> On Fri, Sep 15, 2023 at 12:19 AM Michael Niedermayer 
> wrote:
> 
> > On Wed, Sep 06, 2023 at 10:19:29PM +, Christophe Gisquet wrote:
> > > ffmpeg | branch: master | Christophe Gisquet <
> > christophe.gisq...@gmail.com> | Sun Jul  9 12:56:35 2017 +|
> > [da888b790af779a7489068c25f9e7ab8ac653d41] | committer: Paul B Mahol
> > >
> > > avcodec/utvideodec: add vlc multi support
> > >
> > > Faster decoding, by average 50% faster overall.
> > >
> > > >
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da888b790af779a7489068c25f9e7ab8ac653d41
> > > ---
> > >
> > >  libavcodec/utvideo.h|  1 +
> > >  libavcodec/utvideodec.c | 92
> > -
> > >  2 files changed, 46 insertions(+), 47 deletions(-)
> > >
> > > diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h
> > > index 9da9329ff3..e5160aa394 100644
> > > --- a/libavcodec/utvideo.h
> > > +++ b/libavcodec/utvideo.h
> > > @@ -81,6 +81,7 @@ typedef struct UtvideoContext {
> > >  ptrdiff_t slice_stride;
> > >  uint8_t *slice_bits, *slice_buffer[4];
> > >  int  slice_bits_size;
> > > +void*buffer;
> > >
> > >  const uint8_t *packed_stream[4][256];
> > >  size_t packed_stream_size[4][256];
> > > diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
> > > index 1f00c58950..ab390be0fa 100644
> > > --- a/libavcodec/utvideodec.c
> > > +++ b/libavcodec/utvideodec.c
> > > @@ -46,7 +46,7 @@ typedef struct HuffEntry {
> > >  } HuffEntry;
> > >
> > >  static int build_huff(UtvideoContext *c, const uint8_t *src, VLC *vlc,
> > > -  int *fsym, unsigned nb_elems)
> > > +  VLC_MULTI *multi, int *fsym, unsigned nb_elems)
> > >  {
> >
> > before this patch the whole application finishes within 130ms
> > after this patch with teh short table
> >
> >
> > 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,24,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,24,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
> >
> 
> This is of no use to me.
> If you have file then provide it.

I dont have one but I made one for you
its attached


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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


ut.avi.gz
Description: application/gzip


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

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/format: Stop reading data at EOF during probing

2023-09-16 Thread Michael Niedermayer
On Wed, May 10, 2023 at 11:58:31PM +0200, Michael Niedermayer wrote:
> Issue found by: Сергей Колесников
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/format.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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

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


Re: [FFmpeg-devel] [PATCH 1/3] avformat/hls: reduce default max reload to 3

2023-09-16 Thread Michael Niedermayer
On Mon, May 15, 2023 at 02:05:45AM +0200, Michael Niedermayer wrote:
> The 1000 did result in the appearance of a never ending reload loop
> 
> The RFC mandates that "If the client reloads a Playlist file and finds that 
> it has not
> changed, then it MUST wait for a period of one-half the target
> duration before retrying." and if it has changed
> "the client MUST wait for at least the target duration before attempting to 
> reload the
> Playlist file again"
> 
> Trying to reload 3 times seems a better default than 1000 given these
> durations
> 
> Issue found by: Сергей Колесников
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/hls.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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

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


Re: [FFmpeg-devel] [PATCH] avformat/libssh: avoid deprecated functions

2023-09-16 Thread Leo Izen

On 9/13/23 06:40, Leo Izen wrote:

Avoid using the deprecated functions ssh_try_publickey_from_file among
others in favor of symbols introduced in libssh 0.6.0 (Jan 2014) and
update configure to require this version.

Signed-off-by: Leo Izen 
---
  configure|  2 +-
  libavformat/libssh.c | 11 ---
  2 files changed, 5 insertions(+), 8 deletions(-)



Will apply soon.

- Leo Izen (Traneptora)

___
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] lavc/aarch64: new optimization for 8-bit hevc_epel_uni_v

2023-09-16 Thread Martin Storsjö

On Thu, 14 Sep 2023, Logan.Lyu wrote:


Hi Martin,

You can try the attached patchset. If that doesn't work, My code branch 
address is https://github.com/myais2023/FFmpeg/tree/hevc-aarch64


Thanks for the patches. Functionally, they seem to work, and the issues i 
saw in the code are relatively minor. Unfortunately, some of the issues 
are issues that we've been through in many earlier patches, so I would 
hope that you would pay attention to them in the future before posting 
more patches.



In patch 1, you've got a bunch of sxtw instructions for src/dst stride 
parameters that have the type ptrdiff_t - that shouldn't be necessary?


In patch 2, you're moving the macros calc_epelh, calc_epelh2, 
load_epel_filterh - can you split out the move into a separate commit? 
(This isn't strictly necessary but would make things even clearer.)


In patch 2, you're storing below the stack, then decrementing it 
afterwards - e.g. like this:



+stp x0, x30, [sp, #-16]
+stp x1, x2, [sp, #-32]
+stp x3, x4, [sp, #-48]
+stp x5, x6, [sp, #-64]!


Please change that so that you're first predecrementing the whole area, 
then storing the other elements above that stack pointer, e.g. like this:


stp x0, x30, [sp, #-64]!
stp x1, x2, [sp, #16]
stp x3, x4, [sp, #32]

etc.

The same issue also appears in variouos places within functions like this:


+stp x0, x1, [sp, #-16]
+stp x4, x6, [sp, #-32]
+stp xzr, x30, [sp, #-48]!


Please fix all of these cases - you can search through your patches for 
anything related to storing on the stack. Also, storing xzr here seems 
superfluous - if you've got an odd number of registers to store, just make 
one instruction str instead of stp (but keep the stack aligned).


Then in patch 4, you've got yet another pattern for doing these stores, 
where you have superfluous consecutive stack decrements like this:



+stp x6, x30, [sp, #-16]!
+mov x7, #16
+stp x0, x1, [sp, #-16]!
+stp x2, x3, [sp, #-16]!
+stp x4, x5, [sp, #-16]!


Please just do one stack decrement covering all the stack space you need.

I believe these issues have been raised in earlier reviews as well.

// Martin

___
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 4/6] avcodec/vp3: Fix undefined pointer arithmetic

2023-09-16 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> When decoding a keyframe, last_frame and golden_frame are
> not used at all and (at least when starting decoding)
> are not set at all. But due to code sharing pointer arithmetic
> on the NULL data-pointers of these frames has nevertheless
> been performed. This is undefined behaviour and causes e.g.
> "runtime error: applying non-zero offset 173440 to null pointer"
> from UBSan in the vp31, vp4, theora-coeff-level64 and theora-offset
> FATE-tests.
> 
> Fix this by reusing the current frame for unavailable frames.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/vp3.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> index 33c120a58e..5ce1ecfce7 100644
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -2056,6 +2056,14 @@ static void render_slice(Vp3DecodeContext *s, int 
> slice)
>  {
>  int16_t *block = s->block;
>  int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;
> +/* When decoding keyframes, the earlier frames may not be available,
> + * so to avoid using undefined pointer arithmetic on them we just
> + * use the current frame instead. Nothing is ever read from these
> + * frames in case of a keyframe. */
> +const AVFrame *last_frame   = s->last_frame.f->data[0]   ?
> +  s->last_frame.f   : s->current_frame.f;
> +const AVFrame *golden_frame = s->golden_frame.f->data[0] ?
> +  s->golden_frame.f : s->current_frame.f;
>  int motion_halfpel_index;
>  int first_pixel;
>  
> @@ -2065,9 +2073,9 @@ static void render_slice(Vp3DecodeContext *s, int slice)
>  for (int plane = 0; plane < 3; plane++) {
>  uint8_t *output_plane = s->current_frame.f->data[plane] +
>  s->data_offset[plane];
> -const uint8_t *last_plane = s->last_frame.f->data[plane] +
> +const uint8_t *last_plane = last_frame->data[plane] +
>s->data_offset[plane];
> -const uint8_t *golden_plane = s->golden_frame.f->data[plane] +
> +const uint8_t *golden_plane = golden_frame->data[plane] +
>  s->data_offset[plane];
>  ptrdiff_t stride = s->current_frame.f->linesize[plane];
>  int plane_width  = s->width  >> (plane && s->chroma_x_shift);

Will apply the remaining patches 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".


[FFmpeg-devel] [PATCH 1/2] avcodec/hevcdec: Check early whether film grain is supported, fix race

2023-09-16 Thread Andreas Rheinhardt
Applying film grain happens after ff_thread_finish_setup(),
so the parameters synced in hevc_update_thread_context() must not
be modified. But this is exactly what happens in case applying
film grain fails. (The likely result is that in case of frame threading
an uninitialized frame is output.)

Given that it is actually very easy to know in advance whether
ff_h274_apply_film_grain() supports a given set of parameters,
one can check for this before ff_thread_finish_setup()
and avoid allocating an unused buffer lateron.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h274.h| 15 +++
 libavcodec/hevcdec.c | 19 ---
 libavcodec/hevcdec.h |  2 ++
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h274.h b/libavcodec/h274.h
index 920f6991fb..27a07e4a91 100644
--- a/libavcodec/h274.h
+++ b/libavcodec/h274.h
@@ -40,11 +40,26 @@ typedef struct H274FilmGrainDatabase {
 int16_t slice_tmp[64][64];
 } H274FilmGrainDatabase;
 
+/**
+ * Check whether ff_h274_apply_film_grain() supports the given parameter 
combination.
+ *
+ * @param model_id model_id from AVFilmGrainParams to be supplied
+ * @param pix_fmt  pixel format of the frames to be supplied
+ */
+static inline int ff_h274_film_grain_params_supported(int model_id, enum 
AVPixelFormat pix_fmt)
+{
+return model_id == 1 && pix_fmt == AV_PIX_FMT_YUV420P;
+}
+
 // Synthesizes film grain on top of `in` and stores the result to `out`. `out`
 // must already have been allocated and set to the same size and format as
 // `in`.
 //
 // Returns a negative error code on error, such as invalid params.
+// If ff_h274_film_grain_params_supported() indicated that the parameters
+// are supported, no error will be returned if the arguments given to
+// ff_h274_film_grain_params_supported() coincide with actual values
+// from the frames and params.
 int ff_h274_apply_film_grain(AVFrame *out, const AVFrame *in,
  H274FilmGrainDatabase *db,
  const AVFilmGrainParams *params);
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 81b9c5e089..2be62ddfb2 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2884,6 +2884,14 @@ static int hevc_frame_start(HEVCContext *s)
 !(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
 !s->avctx->hwaccel;
 
+if (s->ref->needs_fg &&
+
!ff_h274_film_grain_params_supported(s->sei.common.film_grain_characteristics.model_id,
+ s->ref->frame->format)) {
+av_log_once(s->avctx, AV_LOG_WARNING, AV_LOG_DEBUG, 
&s->film_grain_warning_shown,
+"Unsupported film grain parameters. Ignoring film 
grain.\n");
+s->ref->needs_fg = 0;
+}
+
 if (s->ref->needs_fg) {
 s->ref->frame_grain->format = s->ref->frame->format;
 s->ref->frame_grain->width = s->ref->frame->width;
@@ -2922,19 +2930,14 @@ static int hevc_frame_end(HEVCContext *s)
 {
 HEVCFrame *out = s->ref;
 const AVFrameSideData *sd;
-int ret;
+av_unused int ret;
 
 if (out->needs_fg) {
 sd = av_frame_get_side_data(out->frame, 
AV_FRAME_DATA_FILM_GRAIN_PARAMS);
 av_assert0(out->frame_grain->buf[0] && sd);
 ret = ff_h274_apply_film_grain(out->frame_grain, out->frame, 
&s->h274db,
(AVFilmGrainParams *) sd->data);
-
-if (ret < 0) {
-av_log(s->avctx, AV_LOG_WARNING, "Failed synthesizing film "
-   "grain, ignoring: %s\n", av_err2str(ret));
-out->needs_fg = 0;
-}
+av_assert1(ret >= 0);
 }
 
 return 0;
@@ -3574,6 +3577,8 @@ static int hevc_update_thread_context(AVCodecContext *dst,
 s->threads_number  = s0->threads_number;
 s->threads_type= s0->threads_type;
 
+s->film_grain_warning_shown = s0->film_grain_warning_shown;
+
 if (s0->eos) {
 s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK;
 s->max_ra = INT_MAX;
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 94609e4699..9b232df68c 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -596,6 +596,8 @@ typedef struct HEVCContext {
 int nal_length_size;///< Number of bytes used for nal length (1, 2 or 
4)
 int nuh_layer_id;
 
+int film_grain_warning_shown;
+
 AVBufferRef *rpu_buf;   ///< 0 or 1 Dolby Vision RPUs.
 DOVIContext dovi_ctx;   ///< Dolby Vision decoding context
 } HEVCContext;
-- 
2.34.1

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

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


[FFmpeg-devel] [PATCH 2/2] avcodec/h264dec: Check early whether film grain is supported, fix race

2023-09-16 Thread Andreas Rheinhardt
Applying film grain happens after ff_thread_finish_setup(),
so the parameters synced in ff_h264_update_thread_context()
must not be modified. But this is exactly what happens if
applying film grain fails. (The likely result is that in
case of frame threading an uninitialized frame is output.)

Failure of applying film grain can have several reasons:
The first is that it is just not supported (we only support
a specific model_id and only YUV420p). The second is that
no film grain side data is added to the AVFrame. This seems
possible even with legal input, namely if the second field
overrides (i.e. present equal to zero) an earlier film grain SEI.

Given that it is actually very easy to know in advance whether
ff_h274_apply_film_grain() supports a given set of parameters,
one can check for this before ff_thread_finish_setup()
and avoid allocating an unused buffer lateron.

The second failure condition has been addressed by keeping
track of the film grain state in a more granular fashion,
namely by distinguishing the cases of an allocated film
grain frame buffer and the existence of the side data.

Signed-off-by: Andreas Rheinhardt 
---
Honestly, I have no sample to test this (contrary to the preceding
HEVC patch). The only thing I could test is that it does not
break samples without film grain.
Of course, testing this on the sample that led to
762e18da3fe64dbe7d3091fddf99aeee164017cc is appropriate.

 libavcodec/h2645_sei.c|  5 -
 libavcodec/h2645_sei.h|  2 +-
 libavcodec/h264_picture.c | 23 +--
 libavcodec/h264_slice.c   | 28 
 libavcodec/h264dec.c  |  9 ++---
 libavcodec/h264dec.h  | 11 ++-
 libavcodec/hevcdec.c  |  2 +-
 7 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index cb6be0594b..3074c1eb73 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -512,7 +512,7 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
   enum AVCodecID codec_id,
   AVCodecContext *avctx, const H2645VUI *vui,
   unsigned bit_depth_luma, unsigned bit_depth_chroma,
-  int seed)
+  int seed, int *added_film_grain_sei)
 {
 H2645SEIFramePacking *fp = &sei->frame_packing;
 
@@ -686,6 +686,9 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
 else
 fgc->present = fgc->persistence_flag;
 
+if (added_film_grain_sei)
+*added_film_grain_sei = 1;
+
 if (avctx)
 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
 }
diff --git a/libavcodec/h2645_sei.h b/libavcodec/h2645_sei.h
index 0ebf48011a..409b2028f8 100644
--- a/libavcodec/h2645_sei.h
+++ b/libavcodec/h2645_sei.h
@@ -163,6 +163,6 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
   enum AVCodecID codec_id,
   AVCodecContext *avctx, const H2645VUI *vui,
   unsigned bit_depth_luma, unsigned bit_depth_chroma,
-  int seed);
+  int seed, int *added_film_grain_sei);
 
 #endif /* AVCODEC_H2645_SEI_H */
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index 31b5e231c2..b27bcdf3d8 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -89,7 +89,7 @@ static void h264_copy_picture_params(H264Picture *dst, const 
H264Picture *src)
 dst->mb_width  = src->mb_width;
 dst->mb_height = src->mb_height;
 dst->mb_stride = src->mb_stride;
-dst->needs_fg  = src->needs_fg;
+dst->fg_status = src->fg_status;
 }
 
 int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src)
@@ -105,7 +105,7 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, 
H264Picture *src)
 if (ret < 0)
 goto fail;
 
-if (src->needs_fg) {
+if (src->fg_status != NO_FILM_GRAIN) {
 ret = av_frame_ref(dst->f_grain, src->f_grain);
 if (ret < 0)
 goto fail;
@@ -165,7 +165,7 @@ int ff_h264_replace_picture(H264Context *h, H264Picture 
*dst, const H264Picture
 if (ret < 0)
 goto fail;
 
-if (src->needs_fg) {
+if (src->fg_status != NO_FILM_GRAIN) {
 ff_thread_release_buffer(h->avctx, dst->f_grain);
 ret = av_frame_ref(dst->f_grain, src->f_grain);
 if (ret < 0)
@@ -248,19 +248,14 @@ int ff_h264_field_end(H264Context *h, H264SliceContext 
*sl, int in_setup)
 if (err < 0)
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
-} else if (!in_setup && cur->needs_fg && (!FIELD_PICTURE(h) || 
!h->first_field)) {
+} else if (!in_setup && cur->fg_status == FILM_GRAIN_APPLICABLE &&
+   (!FIELD_PICTURE(h) || !h->first_field)) {
 AVFrameSideData *sd = av_frame_get_side_data(cur->f, 
AV_FRA

[FFmpeg-devel] [PATCH 1/2] avdevice/android_camera: fix missing include for usleep

2023-09-16 Thread Zhao Zhili
From: Zhao Zhili 

Signed-off-by: Zhao Zhili 
---
 libavdevice/android_camera.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavdevice/android_camera.c b/libavdevice/android_camera.c
index 1934999c18..0425b27518 100644
--- a/libavdevice/android_camera.c
+++ b/libavdevice/android_camera.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
-- 
2.34.1

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

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


[FFmpeg-devel] [PATCH 2/2] avcodec/jni: make global variables static

2023-09-16 Thread Zhao Zhili
From: Zhao Zhili 

Signed-off-by: Zhao Zhili 
---
 libavcodec/jni.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index 85dcf2abaf..ae6490de9d 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -34,8 +34,8 @@
 #include "libavutil/log.h"
 #include "ffjni.h"
 
-void *java_vm;
-pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static void *java_vm;
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 int av_jni_set_java_vm(void *vm, void *log_ctx)
 {
-- 
2.34.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".