* [FFmpeg-devel] [PATCH 1/3] lavc/vvcdec: remove unneeded set_output_format
@ 2025-01-26 3:10 Nuo Mi
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt Nuo Mi
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs Nuo Mi
0 siblings, 2 replies; 6+ messages in thread
From: Nuo Mi @ 2025-01-26 3:10 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Frank Plowman, Nuo Mi
Downstream can determine the format from the output frame format
Co-authored-by: Frank Plowman <post@frankplowman.com>
---
libavcodec/vvc/dec.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 1cb168de7e..daf537294f 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -961,19 +961,6 @@ fail:
return ret;
}
-static int set_output_format(const VVCContext *s, const AVFrame *output)
-{
- AVCodecContext *c = s->avctx;
- int ret;
-
- if (output->width != c->width || output->height != c->height) {
- if ((ret = ff_set_dimensions(c, output->width, output->height)) < 0)
- return ret;
- }
- c->pix_fmt = output->format;
- return 0;
-}
-
static int wait_delayed_frame(VVCContext *s, AVFrame *output, int *got_output)
{
VVCFrameContext *delayed = get_frame_context(s, s->fcs, s->nb_frames - s->nb_delayed);
@@ -981,9 +968,7 @@ static int wait_delayed_frame(VVCContext *s, AVFrame *output, int *got_output)
if (!ret && delayed->output_frame->buf[0] && output) {
av_frame_move_ref(output, delayed->output_frame);
- ret = set_output_format(s, output);
- if (!ret)
- *got_output = 1;
+ *got_output = 1;
}
s->nb_delayed--;
@@ -1034,11 +1019,7 @@ static int get_decoded_frame(VVCContext *s, AVFrame *output, int *got_output)
ret = ff_vvc_output_frame(s, last, output, 0, 1);
if (ret < 0)
return ret;
- if (ret) {
- *got_output = ret;
- if ((ret = set_output_format(s, output)) < 0)
- return ret;
- }
+ *got_output = ret;
}
return 0;
}
--
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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt
2025-01-26 3:10 [FFmpeg-devel] [PATCH 1/3] lavc/vvcdec: remove unneeded set_output_format Nuo Mi
@ 2025-01-26 3:10 ` Nuo Mi
2025-01-27 2:33 ` Wang, Fei W
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs Nuo Mi
1 sibling, 1 reply; 6+ messages in thread
From: Nuo Mi @ 2025-01-26 3:10 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Frank Plowman, Nuo Mi
AVCodecContext->sw_pix_fmt is used to hold the software pixel format.
Co-authored-by: Frank Plowman <post@frankplowman.com>
---
libavcodec/vvc/dec.c | 17 ++++++-----------
libavcodec/vvc/dec.h | 2 --
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index daf537294f..51dd60ae92 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -799,18 +799,15 @@ static int export_frame_params(VVCContext *s, const VVCFrameContext *fc)
AVCodecContext *c = s->avctx;
const VVCSPS *sps = fc->ps.sps;
const VVCPPS *pps = fc->ps.pps;
- int ret;
- // Reset HW config if pix_fmt/w/h change.
- if (s->pix_fmt != sps->pix_fmt || c->coded_width != pps->width || c->coded_height != pps->height) {
+ // Reset the format if pix_fmt/w/h change.
+ if (c->sw_pix_fmt != sps->pix_fmt || c->coded_width != pps->width || c->coded_height != pps->height) {
c->coded_width = pps->width;
c->coded_height = pps->height;
- ret = get_format(c, sps);
- if (ret < 0)
- return ret;
-
- c->pix_fmt = ret;
- s->pix_fmt = sps->pix_fmt;
+ c->sw_pix_fmt = sps->pix_fmt;
+ c->pix_fmt = get_format(c, sps);
+ if (c->pix_fmt < 0)
+ return AVERROR_INVALIDDATA;
}
c->width = pps->width - ((pps->r->pps_conf_win_left_offset + pps->r->pps_conf_win_right_offset) << sps->hshift[CHROMA]);
@@ -1138,8 +1135,6 @@ static av_cold int vvc_decode_init(AVCodecContext *avctx)
GDR_SET_RECOVERED(s);
ff_thread_once(&init_static_once, init_default_scale_m);
- s->pix_fmt = AV_PIX_FMT_NONE;
-
return 0;
}
diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
index 382311e3be..6aa3121550 100644
--- a/libavcodec/vvc/dec.h
+++ b/libavcodec/vvc/dec.h
@@ -241,8 +241,6 @@ typedef struct VVCContext {
uint64_t nb_frames; ///< processed frames
int nb_delayed; ///< delayed frames
-
- enum AVPixelFormat pix_fmt; ///< pix format of current frame
} VVCContext ;
#endif /* AVCODEC_VVC_DEC_H */
--
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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs
2025-01-26 3:10 [FFmpeg-devel] [PATCH 1/3] lavc/vvcdec: remove unneeded set_output_format Nuo Mi
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt Nuo Mi
@ 2025-01-26 3:10 ` Nuo Mi
2025-01-29 8:40 ` Frank Plowman
1 sibling, 1 reply; 6+ messages in thread
From: Nuo Mi @ 2025-01-26 3:10 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Frank Plowman, Nuo Mi
fixes https://github.com/ffvvc/tests/tree/main/fuzz/passed/000323.bit
Co-authored-by: Frank Plowman <post@frankplowman.com>
---
libavcodec/vvc/ps.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
index c9f7c5c80f..01b4615eda 100644
--- a/libavcodec/vvc/ps.c
+++ b/libavcodec/vvc/ps.c
@@ -1232,7 +1232,7 @@ static int sh_alf_aps(const VVCSH *sh, const VVCFrameParamSets *fps)
return 0;
}
-static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
+static int sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
{
const int slice_address = sh->r->sh_slice_address;
@@ -1256,6 +1256,11 @@ static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps
sh->num_ctus_in_curr_slice += pps->r->row_height_val[tile_y] * pps->r->col_width_val[tile_x];
}
}
+
+ if (!sh->num_ctus_in_curr_slice)
+ return AVERROR_INVALIDDATA;
+
+ return 0;
}
static void sh_qp_y(VVCSH *sh, const H266RawPPS *pps, const H266RawPictureHeader *ph)
@@ -1352,7 +1357,9 @@ static int sh_derive(VVCSH *sh, const VVCFrameParamSets *fps)
const H266RawPictureHeader *ph = fps->ph.r;
int ret;
- sh_slice_address(sh, sps, fps->pps);
+ ret = sh_slice_address(sh, sps, fps->pps);
+ if (ret < 0)
+ return ret;
ret = sh_alf_aps(sh, fps);
if (ret < 0)
return ret;
--
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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt Nuo Mi
@ 2025-01-27 2:33 ` Wang, Fei W
0 siblings, 0 replies; 6+ messages in thread
From: Wang, Fei W @ 2025-01-27 2:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: post, nuomi2021
On Sun, 2025-01-26 at 11:10 +0800, Nuo Mi wrote:
> AVCodecContext->sw_pix_fmt is used to hold the software pixel format.
>
> Co-authored-by: Frank Plowman <post@frankplowman.com>
> ---
> libavcodec/vvc/dec.c | 17 ++++++-----------
> libavcodec/vvc/dec.h | 2 --
> 2 files changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
> index daf537294f..51dd60ae92 100644
> --- a/libavcodec/vvc/dec.c
> +++ b/libavcodec/vvc/dec.c
> @@ -799,18 +799,15 @@ static int export_frame_params(VVCContext *s,
> const VVCFrameContext *fc)
> AVCodecContext *c = s->avctx;
> const VVCSPS *sps = fc->ps.sps;
> const VVCPPS *pps = fc->ps.pps;
> - int ret;
>
> - // Reset HW config if pix_fmt/w/h change.
> - if (s->pix_fmt != sps->pix_fmt || c->coded_width != pps->width
> || c->coded_height != pps->height) {
> + // Reset the format if pix_fmt/w/h change.
> + if (c->sw_pix_fmt != sps->pix_fmt || c->coded_width != pps-
> >width || c->coded_height != pps->height) {
> c->coded_width = pps->width;
> c->coded_height = pps->height;
> - ret = get_format(c, sps);
> - if (ret < 0)
> - return ret;
> -
> - c->pix_fmt = ret;
> - s->pix_fmt = sps->pix_fmt;
> + c->sw_pix_fmt = sps->pix_fmt;
> + c->pix_fmt = get_format(c, sps);
> + if (c->pix_fmt < 0)
> + return AVERROR_INVALIDDATA;
> }
>
> c->width = pps->width - ((pps->r->pps_conf_win_left_offset +
> pps->r->pps_conf_win_right_offset) << sps->hshift[CHROMA]);
> @@ -1138,8 +1135,6 @@ static av_cold int
> vvc_decode_init(AVCodecContext *avctx)
> GDR_SET_RECOVERED(s);
> ff_thread_once(&init_static_once, init_default_scale_m);
>
> - s->pix_fmt = AV_PIX_FMT_NONE;
> -
> return 0;
> }
>
> diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
> index 382311e3be..6aa3121550 100644
> --- a/libavcodec/vvc/dec.h
> +++ b/libavcodec/vvc/dec.h
> @@ -241,8 +241,6 @@ typedef struct VVCContext {
>
> uint64_t nb_frames; ///< processed frames
> int nb_delayed; ///< delayed frames
> -
> - enum AVPixelFormat pix_fmt; ///< pix format of current frame
LGTM. thanks.
Fei
> } VVCContext ;
>
> #endif /* AVCODEC_VVC_DEC_H */
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs Nuo Mi
@ 2025-01-29 8:40 ` Frank Plowman
2025-01-29 10:30 ` Nuo Mi
0 siblings, 1 reply; 6+ messages in thread
From: Frank Plowman @ 2025-01-29 8:40 UTC (permalink / raw)
To: ffmpeg-devel
On 26/01/2025 03:10, Nuo Mi wrote:
> fixes https://github.com/ffvvc/tests/tree/main/fuzz/passed/000323.bit
>
> Co-authored-by: Frank Plowman <post@frankplowman.com>
> ---
> libavcodec/vvc/ps.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
> index c9f7c5c80f..01b4615eda 100644
> --- a/libavcodec/vvc/ps.c
> +++ b/libavcodec/vvc/ps.c
> @@ -1232,7 +1232,7 @@ static int sh_alf_aps(const VVCSH *sh, const VVCFrameParamSets *fps)
> return 0;
> }
>
> -static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
> +static int sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
> {
> const int slice_address = sh->r->sh_slice_address;
>
> @@ -1256,6 +1256,11 @@ static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps
> sh->num_ctus_in_curr_slice += pps->r->row_height_val[tile_y] * pps->r->col_width_val[tile_x];
> }
> }
> +
> + if (!sh->num_ctus_in_curr_slice)
> + return AVERROR_INVALIDDATA;
> +
> + return 0;
> }
>
> static void sh_qp_y(VVCSH *sh, const H266RawPPS *pps, const H266RawPictureHeader *ph)
> @@ -1352,7 +1357,9 @@ static int sh_derive(VVCSH *sh, const VVCFrameParamSets *fps)
> const H266RawPictureHeader *ph = fps->ph.r;
> int ret;
>
> - sh_slice_address(sh, sps, fps->pps);
> + ret = sh_slice_address(sh, sps, fps->pps);
> + if (ret < 0)
> + return ret;
> ret = sh_alf_aps(sh, fps);
> if (ret < 0)
> return ret;
LGTM!
Thanks,
Frank
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs
2025-01-29 8:40 ` Frank Plowman
@ 2025-01-29 10:30 ` Nuo Mi
0 siblings, 0 replies; 6+ messages in thread
From: Nuo Mi @ 2025-01-29 10:30 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, Jan 29, 2025 at 4:40 PM Frank Plowman <post@frankplowman.com> wrote:
> On 26/01/2025 03:10, Nuo Mi wrote:
> > fixes https://github.com/ffvvc/tests/tree/main/fuzz/passed/000323.bit
> >
> > Co-authored-by: Frank Plowman <post@frankplowman.com>
> > ---
> > libavcodec/vvc/ps.c | 11 +++++++++--
> > 1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
> > index c9f7c5c80f..01b4615eda 100644
> > --- a/libavcodec/vvc/ps.c
> > +++ b/libavcodec/vvc/ps.c
> > @@ -1232,7 +1232,7 @@ static int sh_alf_aps(const VVCSH *sh, const
> VVCFrameParamSets *fps)
> > return 0;
> > }
> >
> > -static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const
> VVCPPS *pps)
> > +static int sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const
> VVCPPS *pps)
> > {
> > const int slice_address = sh->r->sh_slice_address;
> >
> > @@ -1256,6 +1256,11 @@ static void sh_slice_address(VVCSH *sh, const
> H266RawSPS *sps, const VVCPPS *pps
> > sh->num_ctus_in_curr_slice +=
> pps->r->row_height_val[tile_y] * pps->r->col_width_val[tile_x];
> > }
> > }
> > +
> > + if (!sh->num_ctus_in_curr_slice)
> > + return AVERROR_INVALIDDATA;
> > +
> > + return 0;
> > }
> >
> > static void sh_qp_y(VVCSH *sh, const H266RawPPS *pps, const
> H266RawPictureHeader *ph)
> > @@ -1352,7 +1357,9 @@ static int sh_derive(VVCSH *sh, const
> VVCFrameParamSets *fps)
> > const H266RawPictureHeader *ph = fps->ph.r;
> > int ret;
> >
> > - sh_slice_address(sh, sps, fps->pps);
> > + ret = sh_slice_address(sh, sps, fps->pps);
> > + if (ret < 0)
> > + return ret;
> > ret = sh_alf_aps(sh, fps);
> > if (ret < 0)
> > return ret;
>
> LGTM!
>
Applied.
Thank you, Fei and Frank.
>
> Thanks,
> Frank
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-29 10:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-26 3:10 [FFmpeg-devel] [PATCH 1/3] lavc/vvcdec: remove unneeded set_output_format Nuo Mi
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt Nuo Mi
2025-01-27 2:33 ` Wang, Fei W
2025-01-26 3:10 ` [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs Nuo Mi
2025-01-29 8:40 ` Frank Plowman
2025-01-29 10:30 ` Nuo Mi
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git