[FFmpeg-cvslog] fftools/ffmpeg: declare loop indices inside loops
ffmpeg | branch: master | Anton Khirnov | Mon Feb 19 10:43:24 2024 +0100| [a2fc86378a18b2c2966ce3438df8f27f646438e5] | committer: Anton Khirnov fftools/ffmpeg: declare loop indices inside loops > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2fc86378a18b2c2966ce3438df8f27f646438e5 --- fftools/ffmpeg.c | 12 +--- fftools/ffmpeg_dec.c | 11 --- fftools/ffmpeg_enc.c | 6 ++ fftools/ffmpeg_filter.c | 24 ++-- fftools/ffmpeg_mux.c | 3 +-- fftools/ffmpeg_mux_init.c | 9 +++-- 6 files changed, 25 insertions(+), 40 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ee7b26d26..2f01a01e2d 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -325,21 +325,19 @@ const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }; static void ffmpeg_cleanup(int ret) { -int i; - if (do_benchmark) { int maxrss = getmaxrss() / 1024; av_log(NULL, AV_LOG_INFO, "bench: maxrss=%iKiB\n", maxrss); } -for (i = 0; i < nb_filtergraphs; i++) +for (int i = 0; i < nb_filtergraphs; i++) fg_free(&filtergraphs[i]); av_freep(&filtergraphs); -for (i = 0; i < nb_output_files; i++) +for (int i = 0; i < nb_output_files; i++) of_free(&output_files[i]); -for (i = 0; i < nb_input_files; i++) +for (int i = 0; i < nb_input_files; i++) ifile_close(&input_files[i]); if (vstats_file) { @@ -792,7 +790,7 @@ static int check_keyboard_interaction(int64_t cur_time) */ static int transcode(Scheduler *sch) { -int ret = 0, i; +int ret = 0; int64_t timer_start, transcode_ts = 0; print_stream_maps(); @@ -824,7 +822,7 @@ static int transcode(Scheduler *sch) ret = sch_stop(sch, &transcode_ts); /* write the trailer if needed */ -for (i = 0; i < nb_output_files; i++) { +for (int i = 0; i < nb_output_files; i++) { int err = of_write_trailer(output_files[i]); ret = err_merge(ret, err); } diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index 769ae36296..8c92b27cc1 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -871,14 +871,13 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); const AVCodecHWConfig *config = NULL; -int i; if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; if (dp->hwaccel_id == HWACCEL_GENERIC || dp->hwaccel_id == HWACCEL_AUTO) { -for (i = 0;; i++) { +for (int i = 0;; i++) { config = avcodec_get_hw_config(s->codec, i); if (!config) break; @@ -902,8 +901,7 @@ static HWDevice *hw_device_match_by_codec(const AVCodec *codec) { const AVCodecHWConfig *config; HWDevice *dev; -int i; -for (i = 0;; i++) { +for (int i = 0;; i++) { config = avcodec_get_hw_config(codec, i); if (!config) return NULL; @@ -981,12 +979,11 @@ static int hw_device_setup_for_decode(DecoderPriv *dp, } if (auto_device) { -int i; if (!avcodec_get_hw_config(codec, 0)) { // Decoder does not support any hardware devices. return 0; } -for (i = 0; !dev; i++) { +for (int i = 0; !dev; i++) { config = avcodec_get_hw_config(codec, i); if (!config) break; @@ -998,7 +995,7 @@ static int hw_device_setup_for_decode(DecoderPriv *dp, av_hwdevice_get_type_name(type), dev->name); } } -for (i = 0; !dev; i++) { +for (int i = 0; !dev; i++) { config = avcodec_get_hw_config(codec, i); if (!config) break; diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index e66f8e6183..bdba50df03 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -93,7 +93,6 @@ static int hw_device_setup_for_encode(OutputStream *ost, AVBufferRef *frames_ref { const AVCodecHWConfig *config; HWDevice *dev = NULL; -int i; if (frames_ref && ((AVHWFramesContext*)frames_ref->data)->format == @@ -103,7 +102,7 @@ static int hw_device_setup_for_encode(OutputStream *ost, AVBufferRef *frames_ref frames_ref = NULL; } -for (i = 0;; i++) { +for (int i = 0;; i++) { config = avcodec_get_hw_config(ost->enc_ctx->codec, i); if (!config) break; @@ -353,8 +352,7 @@ int enc_open(void *opaque, const AVFrame *frame) * global side data. */ if (ist) { -int i; -for (i = 0; i < ist->st->codecpar->nb_coded_side_data; i++) { +for (int i = 0; i < ist->st->codecpar->nb_coded_side_data; i++) { AVPacketSideData *sd_src = &ist->st->codecpar->c
[FFmpeg-cvslog] fftools/cmdutils: remove harmful variable shadowing
ffmpeg | branch: master | Anton Khirnov | Wed Feb 21 15:57:17 2024 +0100| [29e1b9d90c23c2c1e377dfec9960a232445acd33] | committer: Anton Khirnov fftools/cmdutils: remove harmful variable shadowing It causes write_option() to return 0 when calling func_arg() fails. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29e1b9d90c23c2c1e377dfec9960a232445acd33 --- fftools/cmdutils.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 5e181a0d85..3d613a4018 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -339,8 +339,6 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, *(double *)dst = num; } else { -int ret; - av_assert0(po->type == OPT_TYPE_FUNC && po->u.func_arg); ret = po->u.func_arg(optctx, opt, arg); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_sched: remove a triggerable assert in send_to_enc_sq()
ffmpeg | branch: master | Anton Khirnov | Tue Feb 20 12:37:16 2024 +0100| [c19c2078f360fc06059ed2ed6717004a0f3e8ff4] | committer: Anton Khirnov fftools/ffmpeg_sched: remove a triggerable assert in send_to_enc_sq() It can be triggered when send_to_enc_thread() returns AVERROR(ENOMEM). Propagate the error to the caller instead. Reported-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c19c2078f360fc06059ed2ed6717004a0f3e8ff4 --- fftools/ffmpeg_sched.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index cb9d8c6905..1144fce958 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -1541,31 +1541,34 @@ static int send_to_enc_sq(Scheduler *sch, SchEnc *enc, AVFrame *frame) // TODO: the SQ API should be extended to allow returning EOF // for individual streams ret = sq_receive(sq->sq, -1, SQFRAME(sq->frame)); -if (ret == AVERROR(EAGAIN)) { -ret = 0; -goto finish; -} else if (ret < 0) { -// close all encoders fed from this sync queue -for (unsigned i = 0; i < sq->nb_enc_idx; i++) { -int err = send_to_enc_thread(sch, &sch->enc[sq->enc_idx[i]], NULL); - -// if the sync queue error is EOF and closing the encoder -// produces a more serious error, make sure to pick the latter -ret = err_merge((ret == AVERROR_EOF && err < 0) ? 0 : ret, err); -} -goto finish; +if (ret < 0) { +ret = (ret == AVERROR(EAGAIN)) ? 0 : ret; +break; } enc = &sch->enc[sq->enc_idx[ret]]; ret = send_to_enc_thread(sch, enc, sq->frame); if (ret < 0) { -av_assert0(ret == AVERROR_EOF); av_frame_unref(sq->frame); +if (ret != AVERROR_EOF) +break; + sq_send(sq->sq, enc->sq_idx[1], SQFRAME(NULL)); continue; } } +if (ret < 0) { +// close all encoders fed from this sync queue +for (unsigned i = 0; i < sq->nb_enc_idx; i++) { +int err = send_to_enc_thread(sch, &sch->enc[sq->enc_idx[i]], NULL); + +// if the sync queue error is EOF and closing the encoder +// produces a more serious error, make sure to pick the latter +ret = err_merge((ret == AVERROR_EOF && err < 0) ? 0 : ret, err); +} +} + finish: pthread_mutex_unlock(&sq->lock); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_sched: simplify failure path in sch_dec_send()
ffmpeg | branch: master | Anton Khirnov | Fri Feb 16 16:07:58 2024 +0100| [a00765fcbe321d1a151ccbe34a8d8c9da7d2291d] | committer: Anton Khirnov fftools/ffmpeg_sched: simplify failure path in sch_dec_send() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a00765fcbe321d1a151ccbe34a8d8c9da7d2291d --- fftools/ffmpeg_sched.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index d91968822f..cb9d8c6905 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -2035,13 +2035,11 @@ int sch_dec_send(Scheduler *sch, unsigned dec_idx, AVFrame *frame) ret = 0; continue; } -goto finish; +return ret; } } -finish: -return ret < 0 ? ret : - (nb_done == dec->nb_dst) ? AVERROR_EOF : 0; +return (nb_done == dec->nb_dst) ? AVERROR_EOF : 0; } static int dec_done(Scheduler *sch, unsigned dec_idx) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: refact out deblock_bs to reduce duplicate code
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:13:56 2024 +0800| [ab2c9dfb26215419c33d76cac4d46c917d9959be] | committer: Nuo Mi avcodec/vvcdec: refact out deblock_bs to reduce duplicate code > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab2c9dfb26215419c33d76cac4d46c917d9959be --- libavcodec/vvc/vvc_filter.c | 176 ++-- 1 file changed, 55 insertions(+), 121 deletions(-) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index 5fa711c9e0..ca541fd997 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -474,8 +474,9 @@ static void vvc_deblock_subblock_bs_horizontal(const VVCLocalContext *lc, } } -static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, -const int x0, const int y0, const int width, const int height) +static av_always_inline int deblock_bs(const VVCLocalContext *lc, +const int x_p, const int y_p, const int x_q, const int y_q, +const RefPicList *rpl_p, const int c_idx, const int off_to_cb, const uint8_t has_sub_block) { const VVCFrameContext *fc = lc->fc; const MvField *tab_mvf = fc->tab.mvf; @@ -483,6 +484,44 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, const int log2_min_tu_size = MIN_TU_LOG2; const int min_pu_width = fc->ps.pps->min_pu_width; const int min_tu_width = fc->ps.pps->min_tu_width; +const int pu_p = (y_p >> log2_min_pu_size) * min_pu_width + (x_p >> log2_min_pu_size); +const int pu_q = (y_q >> log2_min_pu_size) * min_pu_width + (x_q >> log2_min_pu_size); +const MvField *mvf_p = &tab_mvf[pu_p]; +const MvField *mvf_q = &tab_mvf[pu_q]; +const uint8_t chroma = !!c_idx; +const int tu_p = (y_p >> log2_min_tu_size) * min_tu_width + (x_p >> log2_min_tu_size); +const int tu_q = (y_q >> log2_min_tu_size) * min_tu_width + (x_q >> log2_min_tu_size); +const uint8_t pcmf = fc->tab.pcmf[chroma][tu_p] && fc->tab.pcmf[chroma][tu_q]; + +if (pcmf) +return 0; + +if (mvf_p->pred_flag == PF_INTRA || mvf_q->pred_flag == PF_INTRA || mvf_p->ciip_flag || mvf_q->ciip_flag) +return 2; + +if (chroma) { +return fc->tab.tu_coded_flag[c_idx][tu_p] || + fc->tab.tu_coded_flag[c_idx][tu_q] || + fc->tab.tu_joint_cbcr_residual_flag[tu_p] || + fc->tab.tu_joint_cbcr_residual_flag[tu_q]; +} + +if (fc->tab.tu_coded_flag[LUMA][tu_p] || fc->tab.tu_coded_flag[LUMA][tu_q]) +return 1; + +if ((off_to_cb && ((off_to_cb % 8) || !has_sub_block))) +return 0; // inside a cu, not aligned to 8 or with no subblocks + +return boundary_strength(lc, mvf_q, mvf_p, rpl_p); +} + +static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, +const int x0, const int y0, const int width, const int height) +{ +const VVCFrameContext *fc = lc->fc; +const MvField *tab_mvf = fc->tab.mvf; +const int log2_min_pu_size = MIN_PU_LOG2; +const int min_pu_width = fc->ps.pps->min_pu_width; const int min_cb_log2 = fc->ps.sps->min_cb_log2_size_y; const int min_cb_width = fc->ps.pps->min_cb_width; const int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width + @@ -494,6 +533,7 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, const int cb_x = fc->tab.cb_pos_x[LUMA][off_q]; const int cb_y = fc->tab.cb_pos_y[LUMA][off_q]; const int cb_width = fc->tab.cb_width[LUMA][off_q]; +const int off_x= cb_x - x0; if (!is_intra) { if (fc->tab.msf[off_q] || fc->tab.iaf[off_q]) @@ -514,34 +554,9 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, if (boundary_left) { const RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? ff_vvc_get_ref_list(fc, fc->ref, x0 - 1, y0) : lc->sc->rpl; -const int xp_pu = (x0 - 1) >> log2_min_pu_size; -const int xq_pu = x0 >> log2_min_pu_size; -const int xp_tu = (x0 - 1) >> log2_min_tu_size; -const int xq_tu = x0 >> log2_min_tu_size; - for (int i = 0; i < height; i += 4) { -const int off_x = cb_x - x0; -const int y_pu = (y0 + i) >> log2_min_pu_size; -const int y_tu = (y0 + i) >> log2_min_tu_size; -const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -const uint8_t left_cbf_luma = fc->tab.tu_coded_flag[LUMA][y_tu * min_tu_width + xp_tu]; -const uint8_t curr_cbf_luma = fc->tab.tu_coded_flag[LUMA][y_tu * min_tu_width + xq_tu]; -const uint8_t pcmf = fc->tab.pcmf[LUMA][y_tu * min_tu_width + xp_tu] && -fc->t
[FFmpeg-cvslog] avcodec/vvcdec: implement update_hmvp for IBC
ffmpeg | branch: master | Wu Jianhua | Thu Feb 22 15:14:00 2024 +0800| [09946dc40b8c55624b65ac86f03b4f1b09d9b2dc] | committer: Nuo Mi avcodec/vvcdec: implement update_hmvp for IBC Signed-off-by: Wu Jianhua Signed-off-by: Nuo Mi > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09946dc40b8c55624b65ac86f03b4f1b09d9b2dc --- libavcodec/vvc/vvc_ctu.c | 9 ++-- libavcodec/vvc/vvc_ctu.h | 3 +++ libavcodec/vvc/vvc_mvs.c | 53 +++- 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index 2e48f7bed8..b78a1417c7 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -1717,10 +1717,15 @@ static int inter_data(VVCLocalContext *lc) } else { ret = mvp_data(lc); } -if (!pu->merge_gpm_flag && !pu->inter_affine_flag && !pu->merge_subblock_flag) { + +if (cu->pred_mode == MODE_IBC) +{ +ff_vvc_update_hmvp(lc, mi); +} else if (!pu->merge_gpm_flag && !pu->inter_affine_flag && !pu->merge_subblock_flag) { refine_regular_subblock(lc); ff_vvc_update_hmvp(lc, mi); } + if (!pu->dmvr_flag) fill_dmvr_info(lc->fc, cu->x0, cu->y0, cu->cb_width, cu->cb_height); return ret; @@ -2394,8 +2399,8 @@ int ff_vvc_coding_tree_unit(VVCLocalContext *lc, int ret; if (rx == pps->ctb_to_col_bd[rx]) { -//fix me for ibc ep->num_hmvp = 0; +ep->num_hmvp_ibc = 0; ep->is_first_qg = ry == pps->ctb_to_row_bd[ry] || !ctu_idx; } diff --git a/libavcodec/vvc/vvc_ctu.h b/libavcodec/vvc/vvc_ctu.h index ab3fac626d..5ed331a831 100644 --- a/libavcodec/vvc/vvc_ctu.h +++ b/libavcodec/vvc/vvc_ctu.h @@ -357,8 +357,11 @@ typedef struct EntryPoint { int ctu_end; uint8_t is_first_qg;// first quantization group + MvField hmvp[MAX_NUM_HMVP_CANDS]; ///< HmvpCandList int num_hmvp; ///< NumHmvpCand +MvField hmvp_ibc[MAX_NUM_HMVP_CANDS]; ///< HmvpIbcCandList +int num_hmvp_ibc; ///< NumHmvpIbcCand } EntryPoint; typedef struct VVCLocalContext { diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c index 2ed05ad2a4..8af57e8ed3 100644 --- a/libavcodec/vvc/vvc_mvs.c +++ b/libavcodec/vvc/vvc_mvs.c @@ -1758,34 +1758,49 @@ static av_always_inline int is_greater_mer(const VVCFrameContext *fc, const int y0_br >> plevel > y0 >> plevel; } -//8.5.2.16 Updating process for the history-based motion vector predictor candidate list -void ff_vvc_update_hmvp(VVCLocalContext *lc, const MotionInfo *mi) +static void update_hmvp(MvField *hmvp, int *num_hmvp, const MvField *mvf, +int (*compare)(const MvField *n, const MvField *o)) { -const VVCFrameContext *fc = lc->fc; -const CodingUnit *cu= lc->cu; -const int min_pu_width = fc->ps.pps->min_pu_width; -const MvField* tab_mvf = fc->tab.mvf; -EntryPoint* ep = lc->ep; -const MvField *mvf; int i; - -if (!is_greater_mer(fc, cu->x0, cu->y0, cu->x0 + cu->cb_width, cu->y0 + cu->cb_height)) -return; -mvf = &TAB_MVF(cu->x0, cu->y0); - -for (i = 0; i < ep->num_hmvp; i++) { -if (compare_mv_ref_idx(mvf, ep->hmvp + i)) { -ep->num_hmvp--; +for (i = 0; i < *num_hmvp; i++) { +if (compare(mvf, hmvp + i)) { +(*num_hmvp)--; break; } } if (i == MAX_NUM_HMVP_CANDS) { -ep->num_hmvp--; +(*num_hmvp)--; i = 0; } -memmove(ep->hmvp + i, ep->hmvp + i + 1, (ep->num_hmvp - i) * sizeof(MvField)); -ep->hmvp[ep->num_hmvp++] = *mvf; +memmove(hmvp + i, hmvp + i + 1, (*num_hmvp - i) * sizeof(MvField)); +hmvp[(*num_hmvp)++] = *mvf; +} + +static int compare_l0_mv(const MvField *n, const MvField *o) +{ +return IS_SAME_MV(&n->mv[L0], &o->mv[L0]); +} + +//8.6.2.4 Derivation process for IBC history-based block vector candidates +//8.5.2.16 Updating process for the history-based motion vector predictor candidate list +void ff_vvc_update_hmvp(VVCLocalContext *lc, const MotionInfo *mi) +{ +const VVCFrameContext *fc = lc->fc; +const CodingUnit *cu= lc->cu; +const int min_pu_width = fc->ps.pps->min_pu_width; +const MvField *tab_mvf = fc->tab.mvf; +EntryPoint *ep = lc->ep; + +if (cu->pred_mode == MODE_IBC) { +if (cu->cb_width * cu->cb_height <= 16) +return; +update_hmvp(ep->hmvp_ibc, &ep->num_hmvp_ibc, &TAB_MVF(cu->x0, cu->y0), compare_l0_mv); +} else { +if (!is_greater_mer(fc, cu->x0, cu->y0, cu->x0 + cu->cb_width, cu->y0 + cu->cb_height)) +return; +update_hmvp(ep->hmvp, &ep->num_hmvp, &TAB_MVF(cu->x0, cu->y0), compare_mv_ref_idx); +} } MvField* ff_vvc_get_mvf(const VVCFrameContext *fc, const int x0, co
[FFmpeg-cvslog] avcodec/vvcdec: set CuPredMode table for chroma
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:13:57 2024 +0800| [37ebebd055d8129cb590caf446c1ede4235875a1] | committer: Nuo Mi avcodec/vvcdec: set CuPredMode table for chroma follow the spec > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37ebebd055d8129cb590caf446c1ede4235875a1 --- libavcodec/vvc/vvc_ctu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index 36f98f5f2b..2e48f7bed8 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -1227,9 +1227,12 @@ static void set_cu_tabs(const VVCLocalContext *lc, const CodingUnit *cu) const VVCFrameContext *fc = lc->fc; const TransformUnit *tu = cu->tus.head; -set_cb_tab(lc, fc->tab.cpm[cu->ch_type], cu->pred_mode); -if (cu->tree_type != DUAL_TREE_CHROMA) +if (cu->tree_type != DUAL_TREE_CHROMA) { +set_cb_tab(lc, fc->tab.cpm[LUMA], cu->pred_mode); set_cb_tab(lc, fc->tab.skip, cu->skip_flag); +} +if (fc->ps.sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA) +set_cb_tab(lc, fc->tab.cpm[CHROMA], cu->pred_mode); while (tu) { for (int j = 0; j < tu->nb_tbs; j++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: deblock_bs, fix intra check for IBC
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:13:58 2024 +0800| [dd3650cada8ca12cceedd8a506bc2e054e04adca] | committer: Nuo Mi avcodec/vvcdec: deblock_bs, fix intra check for IBC An Intra Block Copy clip may use different modes for luma and chroma. For example, MODE_IBC for luma and MODE_INTRA for chroma. We have to check luma and chroma CuPredMode (cpm) separately. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd3650cada8ca12cceedd8a506bc2e054e04adca --- libavcodec/vvc/vvc_filter.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index ca541fd997..379d90d02b 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -482,8 +482,10 @@ static av_always_inline int deblock_bs(const VVCLocalContext *lc, const MvField *tab_mvf = fc->tab.mvf; const int log2_min_pu_size = MIN_PU_LOG2; const int log2_min_tu_size = MIN_TU_LOG2; +const int log2_min_cb_size = fc->ps.sps->min_cb_log2_size_y; const int min_pu_width = fc->ps.pps->min_pu_width; const int min_tu_width = fc->ps.pps->min_tu_width; +const int min_cb_width = fc->ps.pps->min_cb_width; const int pu_p = (y_p >> log2_min_pu_size) * min_pu_width + (x_p >> log2_min_pu_size); const int pu_q = (y_q >> log2_min_pu_size) * min_pu_width + (x_q >> log2_min_pu_size); const MvField *mvf_p = &tab_mvf[pu_p]; @@ -492,11 +494,14 @@ static av_always_inline int deblock_bs(const VVCLocalContext *lc, const int tu_p = (y_p >> log2_min_tu_size) * min_tu_width + (x_p >> log2_min_tu_size); const int tu_q = (y_q >> log2_min_tu_size) * min_tu_width + (x_q >> log2_min_tu_size); const uint8_t pcmf = fc->tab.pcmf[chroma][tu_p] && fc->tab.pcmf[chroma][tu_q]; +const int cb_p = (y_p >> log2_min_cb_size) * min_cb_width + (x_p >> log2_min_cb_size); +const int cb_q = (y_q >> log2_min_cb_size) * min_cb_width + (x_q >> log2_min_cb_size); +const uint8_t intra= fc->tab.cpm[chroma][cb_p] == MODE_INTRA || fc->tab.cpm[chroma][cb_q] == MODE_INTRA; if (pcmf) return 0; -if (mvf_p->pred_flag == PF_INTRA || mvf_q->pred_flag == PF_INTRA || mvf_p->ciip_flag || mvf_q->ciip_flag) +if (intra || mvf_p->ciip_flag || mvf_q->ciip_flag) return 2; if (chroma) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: skip inter prediction for IBC blocks
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:14:01 2024 +0800| [3241aa26d1de052fc104dc0fe9981d06c6dd9425] | committer: Nuo Mi avcodec/vvcdec: skip inter prediction for IBC blocks Intra Block Copy relies on reconstructed pixels from the current frame. We skip IBC during the inter prediction stage and handle it during the reconstruction stage. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3241aa26d1de052fc104dc0fe9981d06c6dd9425 --- libavcodec/vvc/vvc_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/vvc_inter.c b/libavcodec/vvc/vvc_inter.c index 6c9c8a7165..d5be32aa14 100644 --- a/libavcodec/vvc/vvc_inter.c +++ b/libavcodec/vvc/vvc_inter.c @@ -893,7 +893,7 @@ static void predict_inter(VVCLocalContext *lc) static int has_inter_luma(const CodingUnit *cu) { -return cu->pred_mode != MODE_INTRA && cu->pred_mode != MODE_PLT && cu->tree_type != DUAL_TREE_CHROMA; +return (cu->pred_mode == MODE_INTER || cu->pred_mode == MODE_SKIP) && cu->tree_type != DUAL_TREE_CHROMA; } int ff_vvc_predict_inter(VVCLocalContext *lc, const int rs) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: refact, rename !is_mvp to check_mer
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:14:04 2024 +0800| [422e8a877b1cd5d30486d8daf8a67e3122b81e50] | committer: Nuo Mi avcodec/vvcdec: refact, rename !is_mvp to check_mer For IBC, we'll utilize the check_available function. However, neither MVP nor merge mode need to check the motion estimation region. Let's rename it to avoid confusion. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=422e8a877b1cd5d30486d8daf8a67e3122b81e50 --- libavcodec/vvc/vvc_mvs.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c index 8fdbb00a41..56e4009741 100644 --- a/libavcodec/vvc/vvc_mvs.c +++ b/libavcodec/vvc/vvc_mvs.c @@ -589,7 +589,7 @@ static void init_neighbour_context(NeighbourContext *ctx, const VVCLocalContext ctx->lc = lc; } -static int check_available(Neighbour *n, const VVCLocalContext *lc, const int is_mvp) +static int check_available(Neighbour *n, const VVCLocalContext *lc, const int check_mer) { const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = fc->ps.sps; @@ -601,7 +601,7 @@ static int check_available(Neighbour *n, const VVCLocalContext *lc, const int is n->checked = 1; n->available = !sps->r->sps_entropy_coding_sync_enabled_flag || ((n->x >> sps->ctb_log2_size_y) <= (cu->x0 >> sps->ctb_log2_size_y)); n->available &= TAB_MVF(n->x, n->y).pred_flag != PF_INTRA; -if (!is_mvp) +if (check_mer) n->available &= !is_same_mer(fc, n->x, n->y, cu->x0, cu->y0); } return n->available; @@ -620,10 +620,9 @@ static const MvField *mv_merge_candidate(const VVCLocalContext *lc, const int x_ static const MvField* mv_merge_from_nb(NeighbourContext *ctx, const NeighbourIdx nb) { const VVCLocalContext *lc = ctx->lc; -const int is_mvp= 0; Neighbour *n= &ctx->neighbours[nb]; -if (check_available(n, lc, is_mvp)) +if (check_available(n, lc, 1)) return mv_merge_candidate(lc, n->x, n->y); return 0; } @@ -943,10 +942,9 @@ static int affine_merge_candidate(const VVCLocalContext *lc, const int x_cand, c static int affine_merge_from_nbs(NeighbourContext *ctx, const NeighbourIdx *nbs, const int num_nbs, MotionInfo* cand) { const VVCLocalContext *lc = ctx->lc; -const int is_mvp = 0; for (int i = 0; i < num_nbs; i++) { Neighbour *n = &ctx->neighbours[nbs[i]]; -if (check_available(n, lc, is_mvp) && affine_merge_candidate(lc, n->x, n->y, cand)) +if (check_available(n, lc, 1) && affine_merge_candidate(lc, n->x, n->y, cand)) return 1; } return 0; @@ -961,7 +959,7 @@ static const MvField* derive_corner_mvf(NeighbourContext *ctx, const NeighbourId const int min_pu_width = fc->ps.pps->min_pu_width; for (int i = 0; i < num_neighbour; i++) { Neighbour *n = &ctx->neighbours[neighbour[i]]; -if (check_available(n, ctx->lc, 0)) { +if (check_available(n, ctx->lc, 1)) { return &TAB_MVF(n->x, n->y); } } @@ -1461,12 +1459,11 @@ static int mvp_from_nbs(NeighbourContext *ctx, Mv *cps, const int num_cps) { const VVCLocalContext *lc = ctx->lc; -const int is_mvp= 1; int available = 0; for (int i = 0; i < num_nbs; i++) { Neighbour *n = &ctx->neighbours[nbs[i]]; -if (check_available(n, lc, is_mvp)) { +if (check_available(n, lc, 0)) { if (num_cps > 1) available = affine_mvp_candidate(lc, n->x, n->y, lx, ref_idx, cps, num_cps); else @@ -1601,12 +1598,11 @@ static int affine_mvp_constructed_cp(NeighbourContext *ctx, const MvField *tab_mvf = fc->tab.mvf; const int min_pu_width = fc->ps.pps->min_pu_width; const RefPicList* rpl = lc->sc->rpl; -const int is_mvp= 1; int available = 0; for (int i = 0; i < num_neighbour; i++) { Neighbour *n = &ctx->neighbours[neighbour[i]]; -if (check_available(n, ctx->lc, is_mvp)) { +if (check_available(n, ctx->lc, 0)) { const PredFlag maskx = lx + 1; const MvField* mvf = &TAB_MVF(n->x, n->y); const int poc = rpl[lx].list[ref_idx]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: cabac, fix non_inter_flag, pred_mode_flag, amvr_shift for IBC
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:13:59 2024 +0800| [5a388d2cc671766f21084f8676588b4538d8] | committer: Nuo Mi avcodec/vvcdec: cabac, fix non_inter_flag, pred_mode_flag, amvr_shift for IBC > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a388d2cc671766f21084f8676588b4538d8 --- libavcodec/vvc/vvc_cabac.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/vvc/vvc_cabac.c b/libavcodec/vvc/vvc_cabac.c index 4342dfc342..5e24a1b677 100644 --- a/libavcodec/vvc/vvc_cabac.c +++ b/libavcodec/vvc/vvc_cabac.c @@ -1196,10 +1196,10 @@ VVCSplitMode ff_vvc_split_mode(VVCLocalContext *lc, const int x0, const int y0, int ff_vvc_non_inter_flag(VVCLocalContext *lc, const int x0, const int y0, const int ch_type) { const VVCFrameContext *fc = lc->fc; -uint8_t inc, left = 0, top = 0; +uint8_t inc, left = MODE_INTER, top = MODE_INTER; get_left_top(lc, &left, &top, x0, y0, fc->tab.cpm[ch_type], fc->tab.cpm[ch_type]); -inc = left || top; +inc = left == MODE_INTRA || top == MODE_INTRA; return GET_CABAC(NON_INTER_FLAG + inc); } @@ -1207,10 +1207,10 @@ int ff_vvc_pred_mode_flag(VVCLocalContext *lc, const int is_chroma) { const VVCFrameContext *fc = lc->fc; const CodingUnit *cu = lc->cu; -uint8_t inc, left = 0, top = 0; +uint8_t inc, left = MODE_INTER, top = MODE_INTER; get_left_top(lc, &left, &top, cu->x0, cu->y0, fc->tab.cpm[is_chroma], fc->tab.cpm[is_chroma]); -inc = left || top; +inc = left == MODE_INTRA || top == MODE_INTRA; return GET_CABAC(PRED_MODE_FLAG + inc); } @@ -1569,7 +1569,7 @@ int ff_vvc_amvr_shift(VVCLocalContext *lc, const int inter_affine_flag, { int amvr_shift = 2; if (has_amvr_flag) { -if (amvr_flag(lc, inter_affine_flag)) { +if (pred_mode == MODE_IBC || amvr_flag(lc, inter_affine_flag)) { int idx; if (inter_affine_flag) { idx = amvr_precision_idx(lc, 2, 1); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: add Intra Block Copy parser
ffmpeg | branch: master | Wu Jianhua | Thu Feb 22 15:14:05 2024 +0800| [9481887755a2826120fd96409c0dca9a94b468e0] | committer: Nuo Mi avcodec/vvcdec: add Intra Block Copy parser Co-authored-by: Nuo Mi > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9481887755a2826120fd96409c0dca9a94b468e0 --- libavcodec/vvc/vvc_ctu.c | 76 +-- libavcodec/vvc/vvc_ctu.h | 1 + libavcodec/vvc/vvc_mvs.c | 113 ++- libavcodec/vvc/vvc_mvs.h | 2 + 4 files changed, 177 insertions(+), 15 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index 2cf6e82f26..75b9e73ae3 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -1444,6 +1444,22 @@ static void merge_data_block(VVCLocalContext *lc) } } +static void merge_data_ibc(VVCLocalContext *lc) +{ +const VVCFrameContext* fc = lc->fc; +const VVCSPS* sps = fc->ps.sps; +MotionInfo *mi= &lc->cu->pu.mi; +int merge_idx = 0; + +mi->pred_flag = PF_IBC; + +if (sps->max_num_ibc_merge_cand > 1) +merge_idx = ff_vvc_merge_idx(lc); + +ff_vvc_luma_mv_merge_ibc(lc, merge_idx, &mi->mv[L0][0]); +ff_vvc_store_mv(lc, mi); +} + static int hls_merge_data(VVCLocalContext *lc) { const VVCFrameContext *fc = lc->fc; @@ -1454,8 +1470,7 @@ static int hls_merge_data(VVCLocalContext *lc) pu->merge_gpm_flag = 0; pu->mi.num_sb_x = pu->mi.num_sb_y = 1; if (cu->pred_mode == MODE_IBC) { -avpriv_report_missing_feature(fc->log_ctx, "Intra Block Copy"); -return AVERROR_PATCHWELCOME; +merge_data_ibc(lc); } else { if (ph->max_num_subblock_merge_cand > 0 && cu->cb_width >= 8 && cu->cb_height >= 8) pu->merge_subblock_flag = ff_vvc_merge_subblock_flag(lc); @@ -1571,6 +1586,33 @@ static void mvp_add_difference(MotionInfo *mi, const int num_cp_mv, } } +static int mvp_data_ibc(VVCLocalContext *lc) +{ +const VVCFrameContext *fc = lc->fc; +const CodingUnit *cu = lc->cu; +const PredictionUnit *pu = &lc->cu->pu; +const VVCSPS *sps = fc->ps.sps; +MotionInfo *mi= &lc->cu->pu.mi; +int mvp_l0_flag = 0; +int amvr_shift= 4; +Mv *mv= &mi->mv[L0][0]; + +mi->pred_flag = PF_IBC; +mi->num_sb_x = 1; +mi->num_sb_y = 1; + +hls_mvd_coding(lc, mv); +if (sps->max_num_ibc_merge_cand > 1) +mvp_l0_flag = ff_vvc_mvp_lx_flag(lc); +if (sps->r->sps_amvr_enabled_flag && (mv->x || mv->y)) +amvr_shift = ff_vvc_amvr_shift(lc, pu->inter_affine_flag, cu->pred_mode, 1); + +ff_vvc_mvp_ibc(lc, mvp_l0_flag, amvr_shift, mv); +ff_vvc_store_mv(lc, mi); + +return 0; +} + static int mvp_data(VVCLocalContext *lc) { const VVCFrameContext *fc = lc->fc; @@ -1691,17 +1733,24 @@ static void refine_regular_subblock(const VVCLocalContext *lc) } } -static void fill_dmvr_info(const VVCFrameContext *fc, const int x0, const int y0, -const int width, const int height) +static void fill_dmvr_info(const VVCLocalContext *lc) { -const VVCPPS *pps = fc->ps.pps; -const int w = width >> MIN_PU_LOG2; +const VVCFrameContext *fc = lc->fc; +const CodingUnit *cu = lc->cu; + +if (cu->pred_mode == MODE_IBC) { +ff_vvc_set_intra_mvf(lc, 1); +} else { +const VVCPPS *pps = fc->ps.pps; +const int w = cu->cb_width >> MIN_PU_LOG2; + +for (int y = cu->y0 >> MIN_PU_LOG2; y < (cu->y0 + cu->cb_height) >> MIN_PU_LOG2; y++) { +const int idx = pps->min_pu_width * y + (cu->x0 >> MIN_PU_LOG2); +const MvField *mvf = fc->tab.mvf + idx; +MvField *dmvr_mvf = fc->ref->tab_dmvr_mvf + idx; -for (int y = y0 >> MIN_PU_LOG2; y < (y0 + height) >> MIN_PU_LOG2; y++) { -const int idx = pps->min_pu_width * y + (x0 >> MIN_PU_LOG2); -const MvField *mvf = fc->tab.mvf + idx; -MvField *dmvr_mvf = fc->ref->tab_dmvr_mvf + idx; -memcpy(dmvr_mvf, mvf, sizeof(MvField) * w); +memcpy(dmvr_mvf, mvf, sizeof(MvField) * w); +} } } @@ -1719,8 +1768,7 @@ static int inter_data(VVCLocalContext *lc) if (pu->general_merge_flag) { hls_merge_data(lc); } else if (cu->pred_mode == MODE_IBC){ -avpriv_report_missing_feature(lc->fc->log_ctx, "Intra Block Copy"); -return AVERROR_PATCHWELCOME; +ret = mvp_data_ibc(lc); } else { ret = mvp_data(lc); } @@ -1734,7 +1782,7 @@ static int inter_data(VVCLocalContext *lc) } if (!pu->dmvr_flag) -fill_dmvr_info(lc->fc, cu->x0, cu->y0, cu->cb_width, cu->cb_height); +fill_dmvr_info(lc); return ret; } diff --git a/libavcodec/vvc/vvc_ctu.h b/libavcodec/vvc/vvc_ctu.h index 5ed331a831..8020e184c5 100644 --- a/libavcodec/vvc/vvc_ctu.h +++ b/libavcodec/vvc/vvc_ctu.h @@ -217,6 +217,7
[FFmpeg-cvslog] avcodec/vvcdec: fix dual tree for skipped transform tree/unit
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:14:03 2024 +0800| [1ffeeb8a269b87a3c27000b88837f1fa50395cb9] | committer: Nuo Mi avcodec/vvcdec: fix dual tree for skipped transform tree/unit fix IBC_E_Tencent_1.bit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ffeeb8a269b87a3c27000b88837f1fa50395cb9 --- libavcodec/vvc/vvc_ctu.c | 24 +++- libavcodec/vvc/vvc_intra.c | 6 -- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index 00476c81e4..2cf6e82f26 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -481,8 +481,9 @@ static int hls_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_width, static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_width, int tu_height) { -VVCFrameContext *fc = lc->fc; -const VVCSPS *sps = fc->ps.sps; +VVCFrameContext *fc = lc->fc; +const CodingUnit *cu = lc->cu; +const VVCSPS *sps= fc->ps.sps; if (tu_width > sps->max_tb_size_y || tu_height > sps->max_tb_size_y) { const int ver_split_first = tu_width > sps->max_tb_size_y && tu_width > tu_height; @@ -501,11 +502,14 @@ static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_wid else SKIPPED_TRANSFORM_TREE(x0, y0 + trafo_height); } else { -TransformUnit *tu = add_tu(fc, lc->cu, x0, y0, tu_width, tu_height); -const int c_end = sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : (LUMA + 1); +TransformUnit *tu= add_tu(fc, lc->cu, x0, y0, tu_width, tu_height); +const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA; +const int c_start= cu->tree_type == DUAL_TREE_CHROMA ? CB : LUMA; +const int c_end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : CB; + if (!tu) return AVERROR_INVALIDDATA; -for (int i = LUMA; i < c_end; i++) { +for (int i = c_start; i < c_end; i++) { TransformBlock *tb = add_tb(tu, lc, x0, y0, tu_width >> sps->hshift[i], tu_height >> sps->vshift[i], i); if (i != CR) set_tb_pos(fc, tb); @@ -1125,11 +1129,14 @@ static void sbt_info(VVCLocalContext *lc, const VVCSPS *sps) static int skipped_transform_tree_unit(VVCLocalContext *lc) { -const CodingUnit *cu = lc->cu; +const H266RawSPS *rsps = lc->fc->ps.sps->r; +const CodingUnit *cu = lc->cu; int ret; -set_qp_y(lc, cu->x0, cu->y0, 0); -set_qp_c(lc); +if (cu->tree_type != DUAL_TREE_CHROMA) +set_qp_y(lc, cu->x0, cu->y0, 0); +if (rsps->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA) +set_qp_c(lc); ret = skipped_transform_tree(lc, cu->x0, cu->y0, cu->cb_width, cu->cb_height); if (ret < 0) return ret; @@ -1815,7 +1822,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in if (ret < 0) return ret; } else { -av_assert0(tree_type == SINGLE_TREE); ret = skipped_transform_tree_unit(lc); if (ret < 0) return ret; diff --git a/libavcodec/vvc/vvc_intra.c b/libavcodec/vvc/vvc_intra.c index 214ad38c8c..fb001d6713 100644 --- a/libavcodec/vvc/vvc_intra.c +++ b/libavcodec/vvc/vvc_intra.c @@ -602,8 +602,10 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in if (cu->coded_flag) { ret = reconstruct(lc); } else { -add_reconstructed_area(lc, LUMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height); -add_reconstructed_area(lc, CHROMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height); +if (cu->tree_type != DUAL_TREE_CHROMA) +add_reconstructed_area(lc, LUMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height); +if (sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA) +add_reconstructed_area(lc, CHROMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height); } cu = cu->next; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvcdec: add Intra Block Copy decoder
ffmpeg | branch: master | Wu Jianhua | Thu Feb 22 15:14:06 2024 +0800| [6c83cd5cb3e3ecd139fa826231b7f5893dd5cd57] | committer: Nuo Mi avcodec/vvcdec: add Intra Block Copy decoder Introduction at https://ieeexplore.ieee.org/document/9408666 passed files: 10b444_A_Kwai_3.bit 10b444_B_Kwai_3.bit CodingToolsSets_D_Tencent_2.bit IBC_A_Tencent_2.bit IBC_B_Tencent_2.bit IBC_C_Tencent_2.bit IBC_D_Tencent_2.bit IBC_E_Tencent_1.bit LOSSLESS_B_HHI_3.bit Signed-off-by: Wu Jianhua Signed-off-by: Nuo Mi > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c83cd5cb3e3ecd139fa826231b7f5893dd5cd57 --- libavcodec/vvc/vvc_intra.c | 81 ++ libavcodec/vvc/vvcdec.c| 26 +++ libavcodec/vvc/vvcdec.h| 3 ++ 3 files changed, 110 insertions(+) diff --git a/libavcodec/vvc/vvc_intra.c b/libavcodec/vvc/vvc_intra.c index fb001d6713..58dd492478 100644 --- a/libavcodec/vvc/vvc_intra.c +++ b/libavcodec/vvc/vvc_intra.c @@ -20,11 +20,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/frame.h" +#include "libavutil/imgutils.h" #include "vvc_data.h" #include "vvc_inter.h" #include "vvc_intra.h" #include "vvc_itx_1d.h" +#include "vvc_mvs.h" static int is_cclm(enum IntraPredMode mode) { @@ -580,6 +582,81 @@ static int reconstruct(VVCLocalContext *lc) return 0; } +#define POS(c_idx, x, y)\ +&fc->frame->data[c_idx][((y) >> fc->ps.sps->vshift[c_idx]) * fc->frame->linesize[c_idx] + \ +(((x) >> fc->ps.sps->hshift[c_idx]) << fc->ps.sps->pixel_shift)] + +#define IBC_POS(c_idx, x, y) \ +(fc->tab.ibc_vir_buf[c_idx] + \ +(x << ps) + (y + ((cu->y0 & ~(sps->ctb_size_y - 1)) >> vs)) * ibc_stride) +#define IBC_X(x) ((x) & ((fc->tab.sz.ibc_buffer_width >> hs) - 1)) +#define IBC_Y(y) ((y) & ((1 << sps->ctb_log2_size_y >> vs) - 1)) + +static void intra_block_copy(const VVCLocalContext *lc, const int c_idx) +{ +const CodingUnit *cu = lc->cu; +const PredictionUnit *pu = &cu->pu; +const VVCFrameContext *fc = lc->fc; +const VVCSPS *sps = fc->ps.sps; +const Mv *bv = &pu->mi.mv[L0][0]; +const int hs = sps->hshift[c_idx]; +const int vs = sps->vshift[c_idx]; +const int ps = sps->pixel_shift; +const int ref_x = IBC_X((cu->x0 >> hs) + (bv->x >> (4 + hs))); +const int ref_y = IBC_Y((cu->y0 >> vs) + (bv->y >> (4 + vs))); +const int w = cu->cb_width >> hs; +const int h = cu->cb_height >> vs; +const int ibc_buf_width = fc->tab.sz.ibc_buffer_width >> hs;///< IbcBufWidthY and IbcBufWidthC +const int rw = FFMIN(w, ibc_buf_width - ref_x); +const int ibc_stride = ibc_buf_width << ps; +const int dst_stride = fc->frame->linesize[c_idx]; +const uint8_t *ibc_buf= IBC_POS(c_idx, ref_x, ref_y); +uint8_t *dst = POS(c_idx, cu->x0, cu->y0); + +av_image_copy_plane(dst, dst_stride, ibc_buf, ibc_stride, rw << ps, h); + +if (w > rw) { +//wrap around, left part +ibc_buf = IBC_POS(c_idx, 0, ref_y); +dst += rw << ps; +av_image_copy_plane(dst, dst_stride, ibc_buf, ibc_stride, (w - rw) << ps, h); +} +} + +static void vvc_predict_ibc(const VVCLocalContext *lc) +{ +const H266RawSPS *rsps = lc->fc->ps.sps->r; + +intra_block_copy(lc, LUMA); +if (lc->cu->tree_type == SINGLE_TREE && rsps->sps_chroma_format_idc) { +intra_block_copy(lc, CB); +intra_block_copy(lc, CR); +} +} + +static void ibc_fill_vir_buf(const VVCLocalContext *lc, const CodingUnit *cu) +{ +const VVCFrameContext *fc = lc->fc; +const VVCSPS *sps = fc->ps.sps; +const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA; +const int start = cu->tree_type == DUAL_TREE_CHROMA; +const int end = has_chroma ? CR : LUMA; + +for (int c_idx = start; c_idx <= end; c_idx++) { +const int hs = sps->hshift[c_idx]; +const int vs = sps->vshift[c_idx]; +const int ps = sps->pixel_shift; +const int x = IBC_X(cu->x0 >> hs); +const int y = IBC_Y(cu->y0 >> vs); +const int src_stride = fc->frame->linesize[c_idx]; +const int ibc_stride = fc->tab.sz.ibc_buffer_width >> hs << ps; +const uint8_t *src = POS(c_idx, cu->x0, cu->y0); +uint8_t *ibc_buf = IBC_POS(c_idx, x, y); + +av_image_copy_plane(ibc_buf, ibc_stride, src, src_stride, cu->cb_width >> hs << ps , cu->cb_height >> vs); +} +} + int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const int ry) { const VVCFrameContext *fc = lc->fc; @@ -599,6 +676,8 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in if (cu->ciip_flag)
[FFmpeg-cvslog] avcodec/vvcdec: ff_vvc_set_intra_mvf, refact to support dmvr tab
ffmpeg | branch: master | Nuo Mi | Thu Feb 22 15:14:02 2024 +0800| [c503c0b33e2c5a7c6e47995cf21e7d247d459ce1] | committer: Nuo Mi avcodec/vvcdec: ff_vvc_set_intra_mvf, refact to support dmvr tab > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c503c0b33e2c5a7c6e47995cf21e7d247d459ce1 --- libavcodec/vvc/vvc_ctu.c | 2 +- libavcodec/vvc/vvc_mvs.c | 4 ++-- libavcodec/vvc/vvc_mvs.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index b78a1417c7..00476c81e4 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -1776,7 +1776,7 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in } else { intra_luma_pred_modes(lc); } -ff_vvc_set_intra_mvf(lc); +ff_vvc_set_intra_mvf(lc, 0); } if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA) && sps->r->sps_chroma_format_idc) { if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) { diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c index 8af57e8ed3..8fdbb00a41 100644 --- a/libavcodec/vvc/vvc_mvs.c +++ b/libavcodec/vvc/vvc_mvs.c @@ -262,11 +262,11 @@ void ff_vvc_set_mvf(const VVCLocalContext *lc, const int x0, const int y0, const } } -void ff_vvc_set_intra_mvf(const VVCLocalContext *lc) +void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, const int dmvr) { const VVCFrameContext *fc = lc->fc; const CodingUnit *cu= lc->cu; -MvField *tab_mvf= fc->tab.mvf; +MvField *tab_mvf= dmvr ? fc->ref->tab_dmvr_mvf : fc->tab.mvf; const int min_pu_width = fc->ps.pps->min_pu_width; const int min_pu_size = 1 << MIN_PU_LOG2; for (int dy = 0; dy < cu->cb_height; dy += min_pu_size) { diff --git a/libavcodec/vvc/vvc_mvs.h b/libavcodec/vvc/vvc_mvs.h index 6c46f9fdb2..358de5ec45 100644 --- a/libavcodec/vvc/vvc_mvs.h +++ b/libavcodec/vvc/vvc_mvs.h @@ -41,6 +41,6 @@ void ff_vvc_update_hmvp(VVCLocalContext *lc, const MotionInfo *mi); int ff_vvc_no_backward_pred_flag(const VVCLocalContext *lc); MvField* ff_vvc_get_mvf(const VVCFrameContext *fc, const int x0, const int y0); void ff_vvc_set_mvf(const VVCLocalContext *lc, const int x0, const int y0, const int w, const int h, const MvField *mvf); -void ff_vvc_set_intra_mvf(const VVCLocalContext *lc); +void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, int dmvr); #endif //AVCODEC_VVC_VVC_MVS_H ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc: Add infra.txt
ffmpeg | branch: master | Michael Niedermayer | Thu Feb 22 21:32:32 2024 +0100| [22845fbb80b7a45ac1fbae480de21eb0c87c7989] | committer: Michael Niedermayer doc: Add infra.txt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22845fbb80b7a45ac1fbae480de21eb0c87c7989 --- doc/infra.txt | 94 +++ 1 file changed, 94 insertions(+) diff --git a/doc/infra.txt b/doc/infra.txt new file mode 100644 index 00..30a85dd5ce --- /dev/null +++ b/doc/infra.txt @@ -0,0 +1,94 @@ +FFmpeg Infrastructure: +== + + + + +Servers: + + + +Main Server: + +Our Main server is hosted at telepoint.bg +for more details see: https://www.ffmpeg.org/#thanks_sponsor_0001 +Nothing runs on our main server directly, instead several VMs run on it. + + +ffmpeg.org VM: +-- +Web, mail, and public facing git, also website git + + +fftrac VM: +-- +trac.ffmpeg.org Issue tracking + + +ffaux VM: +- +patchwork.ffmpeg.orgPatch tracking +vote.ffmpeg.org Condorcet voting + + +fate: +- +fate.ffmpeg.org FFmpeg automated testing environment + + +coverage: +- +coverage.ffmpeg.org Fate code coverage + + +The main and fate server as well as VMs currently run ubuntu + + + +Cronjobs: +~ +Part of the docs is in the main ffmpeg repository as texi files, this part is build by a cronjob. So is the +doxygen stuff as well as the FFmpeg git snapshot. +These 3 scripts are under the ffcron user + + + +Git: + +Public facing git is provided by our infra, (https://git.ffmpeg.org/gitweb) +main developer ffmpeg git repository for historic reasons is provided by (g...@source.ffmpeg.org:ffmpeg) +Other developer git repositories are provided via g...@git.ffmpeg.org: +git mirrors are available on https://github.com/FFmpeg +(there are some exceptions where primary repositories are on github or elsewhere instead of the mirrors) + +Github mirrors are redundantly synced by multiple people + +You need a new git repository related to FFmpeg ? contact root at ffmpeg.org + + +Fate: +~ +fatesamples are provided via rsync. Every FFmpeg developer who has a shell account in ffmpeg.org +should be in the samples group and be able to upload samples. +See https://www.ffmpeg.org/fate.html#Uploading-new-samples-to-the-fate-suite + + + +Accounts: +~ +You need an account for some FFmpeg work? Send mail to root at ffmpeg.org + + + +VMs: + +You need a VM, docker container for FFmpeg? contact root at ffmpeg.org +(for docker, CC Andriy) + + + +IRC: + +irc channels are at https://libera.chat/ +irc channel archives are at https://libera.irclog.whitequark.org + ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: select iamfenc as movenc dep
ffmpeg | branch: master | Gyan Doshi | Sat Feb 24 18:44:26 2024 +0530| [ecb3c8a536fc41f7c4cd02cd7de7822803faff64] | committer: James Almer configure: select iamfenc as movenc dep Unbreaks movenc compilation in minimal configuration. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ecb3c8a536fc41f7c4cd02cd7de7822803faff64 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 197f762b58..2d0e6a444a 100755 --- a/configure +++ b/configure @@ -3554,7 +3554,7 @@ mlp_demuxer_select="mlp_parser" mmf_muxer_select="riffenc" mov_demuxer_select="iso_media riffdec iamfdec" mov_demuxer_suggest="zlib" -mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser" +mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser iamfenc" mp3_demuxer_select="mpegaudio_parser" mp3_muxer_select="mpegaudioheader" mp4_muxer_select="mov_muxer" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection
ffmpeg | branch: master | Marton Balint | Tue Feb 20 22:34:37 2024 +0100| [87677c2195e86b126c3438439a05d0a46ae5bb50] | committer: Marton Balint avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection This is the proper poll mode for waiting for an incoming connection according to the SRT API docs. Fixes ticket #9142. Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87677c2195e86b126c3438439a05d0a46ae5bb50 --- libavformat/libsrt.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index a1d732f841..a7aafea536 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -250,7 +250,7 @@ static int libsrt_listen(int eid, int fd, const struct sockaddr *addr, socklen_t if (srt_listen(fd, 1)) return libsrt_neterrno(h); -ret = libsrt_network_wait_fd_timeout(h, eid, 1, timeout, &h->interrupt_callback); +ret = libsrt_network_wait_fd_timeout(h, eid, 0, timeout, &h->interrupt_callback); if (ret < 0) return ret; @@ -391,7 +391,7 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags) char hostname[1024],proto[1024],path[1024]; char portstr[10]; int64_t open_timeout = 0; -int eid, write_eid; +int eid; av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); @@ -455,18 +455,21 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags) if (libsrt_socket_nonblock(fd, 1) < 0) av_log(h, AV_LOG_DEBUG, "libsrt_socket_nonblock failed\n"); -ret = write_eid = libsrt_epoll_create(h, fd, 1); -if (ret < 0) -goto fail1; if (s->mode == SRT_MODE_LISTENER) { +int read_eid = ret = libsrt_epoll_create(h, fd, 0); +if (ret < 0) +goto fail1; // multi-client -ret = libsrt_listen(write_eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h, s->listen_timeout); -srt_epoll_release(write_eid); +ret = libsrt_listen(read_eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h, s->listen_timeout); +srt_epoll_release(read_eid); if (ret < 0) goto fail1; srt_close(fd); fd = ret; } else { +int write_eid = ret = libsrt_epoll_create(h, fd, 1); +if (ret < 0) +goto fail1; if (s->mode == SRT_MODE_RENDEZVOUS) { if (srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) { ret = libsrt_neterrno(h); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fate/mxf: fix mxf-probe-j2k on big endian systems
ffmpeg | branch: master | Marton Balint | Thu Feb 22 00:31:05 2024 +0100| [569257735ba983217e664f5600b29e55d6dc4893] | committer: Marton Balint fate/mxf: fix mxf-probe-j2k on big endian systems Jpeg2000 decoder is decoding in native endian, so let's use the same workaround as in fate-mxf-probe-applehdr10. Fixes ticket #10868. Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=569257735ba983217e664f5600b29e55d6dc4893 --- tests/fate/mxf.mak | 2 +- tests/ref/fate/mxf-probe-j2k | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak index 8430b01d51..3e0e70e28b 100644 --- a/tests/fate/mxf.mak +++ b/tests/fate/mxf.mak @@ -29,7 +29,7 @@ fate-mxf-probe-dnxhd: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" FATE_MXF_PROBE-$(call DEMDEC, MXF, JPEG2000) += fate-mxf-probe-j2k fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf -fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" +fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/rgb48../rgb48/" FATE_MXF_PROBE-$(call DEMDEC, MXF, DVVIDEO PCM_S16LE) += fate-mxf-probe-dv25 fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-5.mxf diff --git a/tests/ref/fate/mxf-probe-j2k b/tests/ref/fate/mxf-probe-j2k index 149b3ea0b6..517fbb99a3 100644 --- a/tests/ref/fate/mxf-probe-j2k +++ b/tests/ref/fate/mxf-probe-j2k @@ -14,7 +14,7 @@ film_grain=0 has_b_frames=0 sample_aspect_ratio=1:1 display_aspect_ratio=16:9 -pix_fmt=rgb48le +pix_fmt=rgb48 level=-99 color_range=unknown color_space=unknown ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffprobe: Don't cast const away needlessly
ffmpeg | branch: master | Andreas Rheinhardt | Thu Feb 22 00:55:43 2024 +0100| [0f20e48e3d3efbb012d16bd2a26a68f7c98bb8ea] | committer: Andreas Rheinhardt fftools/ffprobe: Don't cast const away needlessly Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f20e48e3d3efbb012d16bd2a26a68f7c98bb8ea --- fftools/ffprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index aa1153e709..95643f9a23 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -789,7 +789,7 @@ static inline int validate_string(WriterContext *wctx, char **dstp, const char * av_bprint_init(&dstbuf, 0, AV_BPRINT_SIZE_UNLIMITED); endp = src + strlen(src); -for (p = (uint8_t *)src; *p;) { +for (p = src; *p;) { uint32_t code; int invalid = 0; const uint8_t *p0 = p; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffprobe: Constify printing section header
ffmpeg | branch: master | Andreas Rheinhardt | Thu Feb 22 01:00:16 2024 +0100| [ed5bf403d7b56f2e882f111e96aab4dc6161a558] | committer: Andreas Rheinhardt fftools/ffprobe: Constify printing section header Allows to avoid casting const away. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed5bf403d7b56f2e882f111e96aab4dc6161a558 --- fftools/ffprobe.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 95643f9a23..e63935baba 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -228,16 +228,18 @@ struct section { const char *element_name; ///< name of the contained element, if provided const char *unique_name; ///< unique section name, in case the name is ambiguous AVDictionary *entries_to_show; -const char *(* get_type)(void *data); ///< function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined +const char *(* get_type)(const void *data); ///< function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined int show_all_entries; }; -static const char *get_packet_side_data_type(void *data) { +static const char *get_packet_side_data_type(const void *data) +{ const AVPacketSideData *sd = (const AVPacketSideData *)data; return av_x_if_null(av_packet_side_data_name(sd->type), "unknown"); } -static const char *get_frame_side_data_type(void *data) { +static const char *get_frame_side_data_type(const void *data) +{ const AVFrameSideData *sd = (const AVFrameSideData *)data; return av_x_if_null(av_frame_side_data_name(sd->type), "unknown"); } @@ -474,7 +476,7 @@ typedef struct Writer { int (*init) (WriterContext *wctx); void (*uninit)(WriterContext *wctx); -void (*print_section_header)(WriterContext *wctx, void *data); +void (*print_section_header)(WriterContext *wctx, const void *data); void (*print_section_footer)(WriterContext *wctx); void (*print_integer) (WriterContext *wctx, const char *, long long int); void (*print_rational) (WriterContext *wctx, AVRational *q, char *sep); @@ -728,7 +730,7 @@ fail: } static inline void writer_print_section_header(WriterContext *wctx, - void *data, + const void *data, int section_id) { int parent_section_id; @@ -1056,7 +1058,7 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src) return dst; } -static void default_print_section_header(WriterContext *wctx, void *data) +static void default_print_section_header(WriterContext *wctx, const void *data) { DefaultContext *def = wctx->priv; char buf[32]; @@ -1226,7 +1228,7 @@ static av_cold int compact_init(WriterContext *wctx) return 0; } -static void compact_print_section_header(WriterContext *wctx, void *data) +static void compact_print_section_header(WriterContext *wctx, const void *data) { CompactContext *compact = wctx->priv; const struct section *section = wctx->section[wctx->level]; @@ -1423,7 +1425,7 @@ static const char *flat_escape_value_str(AVBPrint *dst, const char *src) return dst->str; } -static void flat_print_section_header(WriterContext *wctx, void *data) +static void flat_print_section_header(WriterContext *wctx, const void *data) { FlatContext *flat = wctx->priv; AVBPrint *buf = &wctx->section_pbuf[wctx->level]; @@ -1523,7 +1525,7 @@ static char *ini_escape_str(AVBPrint *dst, const char *src) return dst->str; } -static void ini_print_section_header(WriterContext *wctx, void *data) +static void ini_print_section_header(WriterContext *wctx, const void *data) { INIContext *ini = wctx->priv; AVBPrint *buf = &wctx->section_pbuf[wctx->level]; @@ -1634,7 +1636,7 @@ static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx #define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ') -static void json_print_section_header(WriterContext *wctx, void *data) +static void json_print_section_header(WriterContext *wctx, const void *data) { JSONContext *json = wctx->priv; AVBPrint buf; @@ -1795,7 +1797,7 @@ static av_cold int xml_init(WriterContext *wctx) #define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ') -static void xml_print_section_header(WriterContext *wctx, void *data) +static void xml_print_section_header(WriterContext *wctx, const void *data) { XMLContext *xml = wctx->priv; const struct section *section = wctx->section[wctx->level]; @@ -2334,7 +2336,7 @@ static void print_pkt_side_data(WriterContext *w, { const char *name = av_packet_side_data_name(sd->type); -writer_print_section_header(w, (void *)sd, id_data); +writer_print_section_h
[FFmpeg-cvslog] fftools/ffprobe: Use int64_t instead of long long int
ffmpeg | branch: master | Andreas Rheinhardt | Thu Feb 22 01:27:52 2024 +0100| [b31ee084a94aa1eb83c7b53e8fab665994783073] | committer: Andreas Rheinhardt fftools/ffprobe: Use int64_t instead of long long int This makes ffprobe match the rest of the codebase. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b31ee084a94aa1eb83c7b53e8fab665994783073 --- fftools/ffprobe.c | 47 --- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 31081d19e2..ea225f14ab 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -397,14 +397,14 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl) } struct unit_value { -union { double d; long long int i; } val; +union { double d; int64_t i; } val; const char *unit; }; static char *value_string(char *buf, int buf_size, struct unit_value uv) { double vald; -long long int vali; +int64_t vali; int show_float = 0; if (uv.unit == unit_second_str) { @@ -427,15 +427,15 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv) const char *prefix_string = ""; if (use_value_prefix && vald > 1) { -long long int index; +int64_t index; if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) { -index = (long long int) (log2(vald)) / 10; +index = (int64_t) (log2(vald)) / 10; index = av_clip(index, 0, FF_ARRAY_ELEMS(si_prefixes) - 1); vald /= si_prefixes[index].bin_val; prefix_string = si_prefixes[index].bin_str; } else { -index = (long long int) (log10(vald)) / 3; +index = (int64_t) (log10(vald)) / 3; index = av_clip(index, 0, FF_ARRAY_ELEMS(si_prefixes) - 1); vald /= si_prefixes[index].dec_val; prefix_string = si_prefixes[index].dec_str; @@ -443,10 +443,10 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv) vali = vald; } -if (show_float || (use_value_prefix && vald != (long long int)vald)) +if (show_float || (use_value_prefix && vald != (int64_t)vald)) snprintf(buf, buf_size, "%f", vald); else -snprintf(buf, buf_size, "%lld", vali); +snprintf(buf, buf_size, "%"PRId64, vali); av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || show_value_unit ? " " : "", prefix_string, show_value_unit ? uv.unit : ""); } @@ -478,7 +478,7 @@ typedef struct Writer { void (*print_section_header)(WriterContext *wctx, const void *data); void (*print_section_footer)(WriterContext *wctx); -void (*print_integer) (WriterContext *wctx, const char *, long long int); +void (*print_integer) (WriterContext *wctx, const char *, int64_t); void (*print_rational) (WriterContext *wctx, AVRational *q, char *sep); void (*print_string)(WriterContext *wctx, const char *, const char *); int flags; ///< a combination or WRITER_FLAG_* @@ -772,7 +772,7 @@ static inline void writer_print_section_footer(WriterContext *wctx) } static inline void writer_print_integer(WriterContext *wctx, -const char *key, long long int val) +const char *key, int64_t val) { const struct section *section = wctx->section[wctx->level]; @@ -1105,13 +1105,13 @@ static void default_print_str(WriterContext *wctx, const char *key, const char * writer_printf(wctx, "%s\n", value); } -static void default_print_int(WriterContext *wctx, const char *key, long long int value) +static void default_print_int(WriterContext *wctx, const char *key, int64_t value) { DefaultContext *def = wctx->priv; if (!def->nokey) writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key); -writer_printf(wctx, "%lld\n", value); +writer_printf(wctx, "%"PRId64"\n", value); } static const Writer default_writer = { @@ -1303,14 +1303,14 @@ static void compact_print_str(WriterContext *wctx, const char *key, const char * av_bprint_finalize(&buf, NULL); } -static void compact_print_int(WriterContext *wctx, const char *key, long long int value) +static void compact_print_int(WriterContext *wctx, const char *key, int64_t value) { CompactContext *compact = wctx->priv; if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep); if (!compact->nokey) writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key); -writer_printf(wctx, "%lld", value); +writer_printf(wctx, "%"PRId64, value); } static const Writer compact_writer = { @@ -1451,9 +1451,9 @@ static void flat_print_section_header(Wr
[FFmpeg-cvslog] fftools/ffprobe: Simplify printing xml values
ffmpeg | branch: master | Andreas Rheinhardt | Thu Feb 22 01:09:24 2024 +0100| [08328463d51b9fb4f38aa7a2342825230049547c] | committer: Andreas Rheinhardt fftools/ffprobe: Simplify printing xml values Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=08328463d51b9fb4f38aa7a2342825230049547c --- fftools/ffprobe.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index e63935baba..31081d19e2 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -1860,7 +1860,8 @@ static void xml_print_section_footer(WriterContext *wctx) } } -static void xml_print_value(WriterContext *wctx, const char *key, const void *value, const int is_int) +static void xml_print_value(WriterContext *wctx, const char *key, +const char *str, long long int num, const int is_int) { AVBPrint buf; XMLContext *xml = wctx->priv; @@ -1878,9 +1879,9 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va av_bprint_clear(&buf); if (is_int) { -writer_printf(wctx, " value=\"%lld\"/>\n", *(long long int *)value); +writer_printf(wctx, " value=\"%lld\"/>\n", num); } else { -av_bprint_escape(&buf, (const char *)value, NULL, +av_bprint_escape(&buf, str, NULL, AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES); writer_printf(wctx, " value=\"%s\"/>\n", buf.str); } @@ -1890,9 +1891,9 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va writer_w8(wctx, ' '); if (is_int) { -writer_printf(wctx, "%s=\"%lld\"", key, *(long long int *)value); +writer_printf(wctx, "%s=\"%lld\"", key, num); } else { -av_bprint_escape(&buf, (const char *)value, NULL, +av_bprint_escape(&buf, str, NULL, AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES); writer_printf(wctx, "%s=\"%s\"", key, buf.str); } @@ -1902,11 +1903,11 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va } static inline void xml_print_str(WriterContext *wctx, const char *key, const char *value) { -xml_print_value(wctx, key, (const void *)value, 0); +xml_print_value(wctx, key, value, 0, 0); } static inline void xml_print_int(WriterContext *wctx, const char *key, long long int value) { -xml_print_value(wctx, key, (const void *)&value, 1); +xml_print_value(wctx, key, NULL, value, 1); } static Writer xml_writer = { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/opt: Use correct function pointer type
ffmpeg | branch: master | Andreas Rheinhardt | Wed Feb 21 21:49:32 2024 +0100| [f705b8b5b4fb9390e2d1aeb9e864c099c8592d9d] | committer: Andreas Rheinhardt avutil/opt: Use correct function pointer type av_get_sample/pix_fmt() return their respective enums and are therefore not of the type int (*)(const char*), yet they are called as-if they were of this type. This works in practice, but is actually undefined behaviour. With Clang 17 UBSan these violations are flagged, affecting lots of tests. The number of failing tests went down from 3363 to 164 here with this patch. Reviewed-by: Mark Thompson Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f705b8b5b4fb9390e2d1aeb9e864c099c8592d9d --- libavutil/opt.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index d13b1ab504..0681b19896 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -444,16 +444,26 @@ static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t return 0; } +static int get_pix_fmt(const char *name) +{ +return av_get_pix_fmt(name); +} + static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst) { return set_string_fmt(obj, o, val, dst, - AV_PIX_FMT_NB, av_get_pix_fmt, "pixel format"); + AV_PIX_FMT_NB, get_pix_fmt, "pixel format"); +} + +static int get_sample_fmt(const char *name) +{ +return av_get_sample_fmt(name); } static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst) { return set_string_fmt(obj, o, val, dst, - AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format"); + AV_SAMPLE_FMT_NB, get_sample_fmt, "sample format"); } static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_t **dst) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/cbs_h266_syntax_template: Don't omit unused function parameter
ffmpeg | branch: master | Andreas Rheinhardt | Wed Feb 21 21:16:17 2024 +0100| [484e7716bc9c79ead7b345e38197d414d5cdccc8] | committer: Andreas Rheinhardt avcodec/cbs_h266_syntax_template: Don't omit unused function parameter The calls to the sei_decoded_picture_hash read and write functions are performed with four pointer arguments; just because one of them is unused by the callees does not mean that they can be omitted: This is undefined behaviour. (This was not recognized because the SEI_MESSAGE_RW macro contains casts.) Reviewed-by: Mark Thompson Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=484e7716bc9c79ead7b345e38197d414d5cdccc8 --- libavcodec/cbs_h266_syntax_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 26ee7a420b..e75f2f6971 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3430,7 +3430,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx, RWContext *rw, H266RawSEIDecodedPictureHash * - current) + current, SEIMessageState *unused) { int err, c_idx, i; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext: Don't check before av_buffer_unref()
ffmpeg | branch: master | Andreas Rheinhardt | Sun Feb 11 19:08:44 2024 +0100| [2e4e424ac237e34fe106dca4c224a46eabefb4c9] | committer: Andreas Rheinhardt avutil/hwcontext: Don't check before av_buffer_unref() av_buffer_unref() can handle AVBufferRef** that point to a NULL AVBufferRef*. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e4e424ac237e34fe106dca4c224a46eabefb4c9 --- libavutil/hwcontext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index e23bad230f..63fc1a6a22 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -297,8 +297,7 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) return buf; fail: -if (device_ref) -av_buffer_unref(&device_ref); +av_buffer_unref(&device_ref); if (ctx->internal) av_freep(&ctx->internal->priv); av_freep(&ctx->internal); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".