[FFmpeg-devel] [PATCH 03/11] avcodec/vvcdec: deblock_bs, fix intra check for IBC

2024-02-21 Thread Nuo Mi
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.
---
 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   = _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) {
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 01/11] avcodec/vvcdec: refact out deblock_bs to reduce duplicate code

2024-02-21 Thread Nuo Mi
---
 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   = _mvf[pu_p];
+const MvField *mvf_q   = _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 = _mvf[y_pu * min_pu_width + xp_pu];
-const MvField *curr = _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->tab.pcmf[LUMA][y_tu * min_tu_width + xq_tu];
 uint8_t max_len_p, max_len_q;
-int bs;
-
-if (pcmf)
-bs = 0;
-else if (curr->pred_flag == PF_INTRA || left->pred_flag == 
PF_INTRA || curr->ciip_flag || left->ciip_flag)
-bs = 2;
-else 

[FFmpeg-devel] [PATCH 04/11] avcodec/vvcdec: cabac, fix non_inter_flag, pred_mode_flag, amvr_shift for IBC

2024-02-21 Thread Nuo Mi
---
 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, , , 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, , , 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);
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 06/11] avcodec/vvcdec: skip inter prediction for IBC blocks

2024-02-21 Thread Nuo Mi
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.
---
 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)
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 08/11] avcodec/vvcdec: fix dual tree for skipped transform tree/unit

2024-02-21 Thread Nuo Mi
fix IBC_E_Tencent_1.bit
---
 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;
 }
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 07/11] avcodec/vvcdec: ff_vvc_set_intra_mvf, refact to support dmvr tab

2024-02-21 Thread Nuo Mi
---
 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
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 11/11] avcodec/vvcdec: add Intra Block Copy decoder

2024-02-21 Thread Nuo Mi
From: Wu Jianhua 

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 
---
 libavcodec/vvc/vvc_intra.c | 81 ++
 libavcodec/vvc/vvcdec.c| 25 
 libavcodec/vvc/vvcdec.h|  3 ++
 3 files changed, 109 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)\
+>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  = >pu;
+const VVCFrameContext *fc = lc->fc;
+const VVCSPS *sps = fc->ps.sps;
+const Mv *bv  = >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)
 ff_vvc_predict_ciip(lc);
+else if (cu->pred_mode == MODE_IBC)
+vvc_predict_ibc(lc);
 if (cu->coded_flag) {
 ret = reconstruct(lc);
 } else {
@@ -607,6 +686,8 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, 
const int rx, 

[FFmpeg-devel] [PATCH 10/11] avcodec/vvcdec: add Intra Block Copy parser

2024-02-21 Thread Nuo Mi
From: Wu Jianhua 

Co-authored-by: Nuo Mi 
---
 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= >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, >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  = >cu->pu;
+const VVCSPS *sps = fc->ps.sps;
+MotionInfo *mi= >cu->pu.mi;
+int mvp_l0_flag   = 0;
+int amvr_shift= 4;
+Mv *mv= >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 @@ typedef enum PredFlag {
 PF_L0= 0x1,
 PF_L1= 0x2,
 PF_BI= 0x3,
+PF_IBC   = PF_L0 | 0x4,
 } PredFlag;
 
 typedef enum IntraPredMode {
diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c
index 56e4009741..6398fd3571 100644
--- a/libavcodec/vvc/vvc_mvs.c

[FFmpeg-devel] [PATCH 09/11] avcodec/vvcdec: refact, rename !is_mvp to check_mer

2024-02-21 Thread Nuo Mi
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.
---
 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= >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 = >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 = >neighbours[neighbour[i]];
-if (check_available(n, ctx->lc, 0)) {
+if (check_available(n, ctx->lc, 1)) {
 return _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 = >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 = >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 = _MVF(n->x, n->y);
 const int poc = rpl[lx].list[ref_idx];
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 05/11] avcodec/vvcdec: implement update_hmvp for IBC

2024-02-21 Thread Nuo Mi
From: Wu Jianhua 

Signed-off-by: Wu Jianhua 
Signed-off-by: Nuo Mi 
---
 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 = _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(>mv[L0], >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, >num_hmvp_ibc, _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, >num_hmvp, _MVF(cu->x0, cu->y0), 
compare_mv_ref_idx);
+}
 }
 
 MvField* ff_vvc_get_mvf(const VVCFrameContext *fc, const int x0, const int y0)
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 02/11] avcodec/vvcdec: set CuPredMode table for chroma

2024-02-21 Thread Nuo Mi
follow the spec
---
 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++) {
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 00/11] Add Intra Block Copy support to the vvc decoder

2024-02-21 Thread Nuo Mi
*** BLURB HERE ***

Nuo Mi (8):
  avcodec/vvcdec: refact out deblock_bs to reduce duplicate code
  avcodec/vvcdec: set CuPredMode table for chroma
  avcodec/vvcdec: deblock_bs, fix intra check for IBC
  avcodec/vvcdec: cabac, fix non_inter_flag, pred_mode_flag, amvr_shift
for IBC
  avcodec/vvcdec: skip inter prediction for IBC blocks
  avcodec/vvcdec: ff_vvc_set_intra_mvf, refact to support dmvr tab
  avcodec/vvcdec: fix dual tree for skipped transform tree/unit
  avcodec/vvcdec: refact, rename !is_mvp to check_mer

Wu Jianhua (3):
  avcodec/vvcdec: implement update_hmvp for IBC
  avcodec/vvcdec: add Intra Block Copy parser
  avcodec/vvcdec: add Intra Block Copy decoder

 libavcodec/vvc/vvc_cabac.c  |  10 +-
 libavcodec/vvc/vvc_ctu.c| 118 --
 libavcodec/vvc/vvc_ctu.h|   4 +
 libavcodec/vvc/vvc_filter.c | 181 --
 libavcodec/vvc/vvc_inter.c  |   2 +-
 libavcodec/vvc/vvc_intra.c  |  87 -
 libavcodec/vvc/vvc_mvs.c| 188 +---
 libavcodec/vvc/vvc_mvs.h|   4 +-
 libavcodec/vvc/vvcdec.c |  25 +
 libavcodec/vvc/vvcdec.h |   3 +
 10 files changed, 431 insertions(+), 191 deletions(-)

--
2.25.1

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

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


Re: [FFmpeg-devel] [PATCH] avcodec/evc: Remove redefine of HEVC_MAX_ENTRY_POINT_OFFSETS

2024-02-21 Thread myp...@gmail.com
On Thu, Feb 22, 2024 at 2:42 PM Zhao Zhili  wrote:
>
> From: Zhao Zhili 
>
> ---
>  libavcodec/evc.h | 9 -
>  1 file changed, 9 deletions(-)
>
> diff --git a/libavcodec/evc.h b/libavcodec/evc.h
> index 9711c760fe..e493455a42 100644
> --- a/libavcodec/evc.h
> +++ b/libavcodec/evc.h
> @@ -141,15 +141,6 @@ enum {
>
>  // A.4.1: table A.1 allows at most 600 slice segments for any level.
>  EVC_MAX_SLICE_SEGMENTS = 600,
> -
> -// 7.4.7.1: in the worst case (tiles_enabled_flag and
> -// entropy_coding_sync_enabled_flag are both set), entry points can be
> -// placed at the beginning of every Ctb row in every tile, giving an
> -// upper bound of (num_tile_columns_minus1 + 1) * PicHeightInCtbsY - 1.
> -// Only a stream with very high resolution and perverse parameters could
> -// get near that, though, so set a lower limit here with the maximum
> -// possible value for 4K video (at most 135 16x16 Ctb rows).
> -HEVC_MAX_ENTRY_POINT_OFFSETS = EVC_MAX_TILE_COLUMNS * 135,
>  };
LGTM, thx
___
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] [RFC] clarifying the TC conflict of interest rule

2024-02-21 Thread Gyan Doshi




On 2024-02-20 04:39 pm, Anton Khirnov wrote:
As for determining conflict of interest in case of dishonest TC 
members, I don't think there is a general solution for it.


This is not about dishonesty. Imagine a TC member genuinely does not 
self-assess or agree to a conflict of interest, does that
mean they can vote regardless of what the other members think? In other 
words, by whom and how is a claim of conflict adjudicated?


Regards,
Gyan

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

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


[FFmpeg-devel] [PATCH] avcodec/evc: Remove redefine of HEVC_MAX_ENTRY_POINT_OFFSETS

2024-02-21 Thread Zhao Zhili
From: Zhao Zhili 

---
 libavcodec/evc.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/libavcodec/evc.h b/libavcodec/evc.h
index 9711c760fe..e493455a42 100644
--- a/libavcodec/evc.h
+++ b/libavcodec/evc.h
@@ -141,15 +141,6 @@ enum {
 
 // A.4.1: table A.1 allows at most 600 slice segments for any level.
 EVC_MAX_SLICE_SEGMENTS = 600,
-
-// 7.4.7.1: in the worst case (tiles_enabled_flag and
-// entropy_coding_sync_enabled_flag are both set), entry points can be
-// placed at the beginning of every Ctb row in every tile, giving an
-// upper bound of (num_tile_columns_minus1 + 1) * PicHeightInCtbsY - 1.
-// Only a stream with very high resolution and perverse parameters could
-// get near that, though, so set a lower limit here with the maximum
-// possible value for 4K video (at most 135 16x16 Ctb rows).
-HEVC_MAX_ENTRY_POINT_OFFSETS = EVC_MAX_TILE_COLUMNS * 135,
 };
 
 #endif // AVCODEC_EVC_H
-- 
2.42.0

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

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


Re: [FFmpeg-devel] [PATCH] avutil/tx: print debug log at trace level

2024-02-21 Thread James Almer

On 2/22/2024 12:16 AM, Lynne wrote:

I see...
If you keep the "Transform tree" printout on debug, lgtm.


Done. Thanks.
___
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] avutil/tx: print debug log at trace level

2024-02-21 Thread Lynne
Feb 21, 2024, 17:38 by jamr...@gmail.com:

> On 2/21/2024 1:32 PM, Lynne wrote:
>
>> Feb 21, 2024, 15:43 by jamr...@gmail.com:
>>
>>> The output of TX is extremely verbose and makes it harder to find other 
>>> debug
>>> log messages, so only print it at trace level.
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavutil/tx.c | 10 +-
>>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/libavutil/tx.c b/libavutil/tx.c
>>> index f991618b4b..eefb3e2ac7 100644
>>> --- a/libavutil/tx.c
>>> +++ b/libavutil/tx.c
>>> @@ -643,7 +643,7 @@ static void print_cd_info(const FFTXCodelet *cd, int 
>>> prio, int len, int print_pr
>>>  if (print_prio)
>>>  av_bprintf(, ", prio: %i", prio);
>>>  -av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
>>> +av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
>>>  }
>>>  static void print_tx_structure(AVTXContext *s, int depth)
>>> @@ -651,7 +651,7 @@ static void print_tx_structure(AVTXContext *s, int 
>>> depth)
>>>  const FFTXCodelet *cd = s->cd_self;
>>>  for (int i = 0; i <= depth; i++)
>>> -av_log(NULL, AV_LOG_DEBUG, "");
>>> +av_log(NULL, AV_LOG_TRACE, "");
>>>  print_cd_info(cd, cd->prio, s->len, 0);
>>>  @@ -816,10 +816,10 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum 
>>> AVTXType type,
>>>  AV_QSORT(cd_matches, nb_cd_matches, TXCodeletMatch, cmp_matches);
>>>  #if !CONFIG_SMALL
>>> -av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
>>> +av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
>>>  for (int i = 0; i < nb_cd_matches; i++) {
>>> -av_log(NULL, AV_LOG_DEBUG, "%i: ", i + 1);
>>> +av_log(NULL, AV_LOG_TRACE, "%i: ", i + 1);
>>>  print_cd_info(cd_matches[i].cd, cd_matches[i].prio, 0, 1);
>>>  }
>>>  #endif
>>> @@ -929,7 +929,7 @@ av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, 
>>> enum AVTXType type,
>>>  *tx  = tmp.fn[0];
>>>  #if !CONFIG_SMALL
>>> -av_log(NULL, AV_LOG_DEBUG, "Transform tree:\n");
>>> +av_log(NULL, AV_LOG_TRACE, "Transform tree:\n");
>>>  print_tx_structure(*ctx, 0);
>>>  #endif
>>>
>>
>> It's a chunk of few dozen lines, I don't think it's spammy enough for trace.
>>
>
> It's extremely spammy. Here's what i get when i simply do "ffmpeg -loglevel 
> debug -i INPUT" with a file that has four Opus streams, simply for probing 
> them:
>
>> For transform of length 120, inverse, mdct_float, flags: [aligned, 
>> out_of_place], found 6 matches:
>>  1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, 
>> any], flags: [aligned, out_of_place, inv_only], prio: 544
>>  2: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: 
>> [15, any], flags: [unaligned, out_of_place, inv_only], prio: 304
>>  3: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: 
>> [5, any], flags: [unaligned, out_of_place, inv_only], prio: 144
>>  4: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: 
>> [3, any], flags: [unaligned, out_of_place, inv_only], prio: 112
>>  5: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], 
>> flags: [unaligned, out_of_place, inv_only], prio: 96
>>  6: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, 
>> any], flags: [unaligned, out_of_place, inv_only], prio: -130976
>> For transform of length 60, inverse, fft_float, flags: [aligned, inplace, 
>> preshuf, asm_call], found 1 matches:
>>  1: fft_pfa_15xM_asm_float_avx2 - type: fft_float, len: [60, ∞], factors[2]: 
>> [15, 2], flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 
>> 688
>> For transform of length 4, inverse, fft_float, flags: [aligned, inplace, 
>> preshuf, asm_call], found 1 matches:
>>  1: fft4_fwd_asm_float_sse2 - type: fft_float, len: 4, factor: 2, flags: 
>> [aligned, inplace, out_of_place, preshuf, asm_call], prio: 352
>> Transform tree:
>>  mdct_inv_float_avx2 - type: mdct_float, len: 120, factors[2]: [2, any], 
>> flags: [aligned, out_of_place, inv_only]
>>  fft_pfa_15xM_asm_float_avx2 - type: fft_float, len: 60, factors[2]: [15, 
>> 2], flags: [aligned, inplace, out_of_place, preshuf, asm_call]
>>  fft4_fwd_asm_float_sse2 - type: fft_float, len: 4, factor: 2, flags: 
>> [aligned, inplace, out_of_place, preshuf, asm_call]
>> For transform of length 240, inverse, mdct_float, flags: [aligned, 
>> out_of_place], found 6 matches:
>>  1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, 
>> any], flags: [aligned, out_of_place, inv_only], prio: 544
>>  2: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: 
>> [15, any], flags: [unaligned, out_of_place, inv_only], prio: 304
>>  3: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: 
>> [5, any], flags: [unaligned, out_of_place, inv_only], prio: 144
>>  4: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: 
>> [3, any], flags: [unaligned, out_of_place, inv_only], prio: 112
>>  5: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: 

Re: [FFmpeg-devel] [PATCH 5/7] lavc/me_cmp: R-V V vsse vsad

2024-02-21 Thread flow gg
.macro vabsaddu dst src tmp
- vneg.v  \tmp, \src
- vmax.vv \tmp, \src, \tmp
+ vfabs.v \tmp, \src
vwaddu.wv   \dst, \dst, \tmp
.endm

After making this change, the tests did not pass. I'm not quite clear on
how to understand the differences..

checkasm: 4 of 21 tests have failed
benchmarking with native FFmpeg timers
nop: 7.0
func: vsad_0, x=46 y=13 h=4, error: asm=720974 c=6162
func: vsad_1, x=16 y=14 h=10, error: asm=1146753 c=9353
func: vsad_4, x=13 y=32 h=12, error: asm=2654565 c=14573
func: vsad_5, x=32 y=1 h=8, error: asm=917745 c=3865

Rémi Denis-Courmont  于2024年2月22日周四 02:07写道:

> Le tiistaina 6. helmikuuta 2024, 17.56.32 EET flow gg a écrit :
> >
>
> Did you try to compute integral absolute values with the ad-hoc (floating
> point) instruction instead of vneg/vmax? It should work since the sign is
> in
> the same place, though I don't know if it will be faster.
>
> --
> レミ・デニ-クールモン
> http://www.remlab.net/
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V put_vp8_pixels

2024-02-21 Thread flow gg
This vp8dsp.h is from libavcodec/aarch64/vp8dsp.h
It simply changes AARCH64 to RISCV
libavcodec/arm/vp8dsp.h uses a similar method (arm in this header file
added 4 lines of other arm function declarations)
I want to simply use the same pattern

Rémi Denis-Courmont  于2024年2月22日周四 02:02写道:

> Hello,
>
> Le maanantaina 19. helmikuuta 2024, 13.13.43 EET flow gg a écrit :
> > The reason for using m1+le8 instead of stride load + larger group
> > multipliers is the same as in "[FFmpeg-devel] [PATCH 1/7] lavc/me_cmp:
> R-V
> > V pix_abs."
> >
> > In the test, there is
> >
> > #define src (buf + 2 * SRC_BUF_STRIDE + 2 + 1)
> >
> > Therefore, not using e8 will result : (fatal signal 7: Bus error).
>
> Yes, you could also just say that alignment is insufficient :)
>
> It is still possible to load rectangles of up to 8 columns using vlseg8e8,
> but
> it might be slower than just repeating the 8 regular loads, and it won't
> work
> if you need calculations between rows.
>
> I may be missing something but I don't understand what purpose the header
> file
> serves here?
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavutil/timestamp.h: Fix loss of precision in timestamps for silencedetect on long files

2024-02-21 Thread Allan Cady via ffmpeg-devel
I had a similar thought, as all timestamps would have the same issue.

This is my first contribution here, and I don't know the code very well, so I 
was being cautious. I'm open to expanding the scope, but I'm sure I would need 
some help doing it right and not breaking things.

For starters, I'm curious why there are two functions & macros:

av_ts2str/av_ts_make_string (which used "%" format specifier)
av_ts2timestr/av_ts_make_time_string (which used "%6g")

Do you know the rationale for that? I see that only av_ts2timestr is used in 
silencedetect.c.

And are you suggesting we should fold those two functions into one?

I did notice something in the output from silencedetect. After I made my 
change, I see the output is now:


frame:92404 pts:53224175 pts_time:2413.79
lavfi.silence_start=2411.120272
frame:92411 pts:53228207 pts_time:2413.98
lavfi.silence_end=2413.992744
lavfi.silence_duration=2.872472


I see that the pts_time values still have the original formatting. I don't know 
what pts_time is, or where those lines are coming from. Seems like maybe those 
should have fixed precision as well.

Guidance for a noob please? Thanks.

(P.S. Can you tell me, when I reply to the list (as opposed to patch submission 
using git send-email), how should I address the email? Obviously it should go 
to ffmpeg-devel@ffmpeg.org, but should I include you as a recipient, or as a 
cc:, or only to the list? or is there some other way it gets directed to you? 
Any other guidance on how to format email? Thanks.)




On Wednesday, February 21, 2024 at 12:25:23 PM PST, Marton Balint 
 wrote: 

On Tue, 20 Feb 2024, Allan Cady via ffmpeg-devel wrote:

> When the silencedetect audio filter is run against long files, the
> output timestamps gradually lose precision as the scan proceeds further
> into the file. This is because the output format specifier ("%.6g" in
> libavutil/timestamp.h) limits the total field width to six significant
> digits. As the offset into the file increases, digits drop off the end,
> until eventually, for offsets greater than 10 seconds (about 28
> hours), fractions of a second disappear altogether, and the timestamps
> are logged as whole seconds.
>
> This patch changes the format to "%.6f" for silencedetect, which will
> give microsecond precision for all timestamps regardless of offset.
>
> libavutil/timestamp.h exposes a macro, av_ts2timestr, as the public
> interface. This macro was used by silencedetect.c, as well as other
> source files. In order to fix the issue for silencedetect without
> affecting other files and tests, I have added a new macro,
> av_ts2timestr_fixed_precision, which uses the new format specifier.
> The original av_ts_make_time_string remains, with the original
> behavior.

I'd rather just to fix av_ts_make_string to not limit the number of 
significant digits. Something like:

1) Print the number in decimal notation with at most 6 fractional digits. 
2) Use less fractional digits if the first format would not fit into 
AV_TS_MAX_STRING_SIZE.
3) Use scientific notation if the second format would not fit into 
AV_TS_MAX_STRINT_SIZE.

Regards,
Marton

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v3 2/2] lavc/dxvenc: migrate DXT1 encoder to lavu hashtable

2024-02-21 Thread Connor Worley
Offers a modest performance gain due to the switch from naive linear
probling to robin hood.

Signed-off-by: Connor Worley 
---
 libavcodec/dxvenc.c | 121 
 1 file changed, 33 insertions(+), 88 deletions(-)

diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 1ce2b1d014..980269657d 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -21,7 +21,7 @@
 
 #include 
 
-#include "libavutil/crc.h"
+#include "libavutil/hashtable.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 
@@ -38,72 +38,9 @@
  * appeared in the decompressed stream. Using a simple hash table (HT)
  * significantly speeds up the lookback process while encoding.
  */
-#define LOOKBACK_HT_ELEMS 0x4
+#define LOOKBACK_HT_ELEMS 0x20202
 #define LOOKBACK_WORDS0x20202
 
-typedef struct HTEntry {
-uint32_t key;
-uint32_t pos;
-} HTEntry;
-
-static void ht_init(HTEntry *ht)
-{
-for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) {
-ht[i].pos = -1;
-}
-}
-
-static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
-uint32_t key, uint32_t pos)
-{
-uint32_t ret = -1;
-size_t hash = av_crc(hash_ctx, 0, (uint8_t*), 4) % LOOKBACK_HT_ELEMS;
-for (size_t i = hash; i < hash + LOOKBACK_HT_ELEMS; i++) {
-size_t wrapped_index = i % LOOKBACK_HT_ELEMS;
-HTEntry *entry = [wrapped_index];
-if (entry->key == key || entry->pos == -1) {
-ret = entry->pos;
-entry->key = key;
-entry->pos = pos;
-break;
-}
-}
-return ret;
-}
-
-static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
-  uint32_t key, uint32_t pos)
-{
-HTEntry *removed_entry = NULL;
-size_t removed_hash;
-size_t hash = av_crc(hash_ctx, 0, (uint8_t*), 4) % LOOKBACK_HT_ELEMS;
-
-for (size_t i = hash; i < hash + LOOKBACK_HT_ELEMS; i++) {
-size_t wrapped_index = i % LOOKBACK_HT_ELEMS;
-HTEntry *entry = [wrapped_index];
-if (entry->pos == -1)
-return;
-if (removed_entry) {
-size_t candidate_hash = av_crc(hash_ctx, 0, (uint8_t*)>key, 
4) % LOOKBACK_HT_ELEMS;
-if ((wrapped_index > removed_hash && (candidate_hash <= 
removed_hash || candidate_hash > wrapped_index)) ||
-(wrapped_index < removed_hash && (candidate_hash <= 
removed_hash && candidate_hash > wrapped_index))) {
-*removed_entry = *entry;
-entry->pos = -1;
-removed_entry = entry;
-removed_hash = wrapped_index;
-}
-} else if (entry->key == key) {
-if (entry->pos <= pos) {
-entry->pos = -1;
-removed_entry = entry;
-removed_hash = wrapped_index;
-} else {
-return;
-}
-}
-}
-}
-
 typedef struct DXVEncContext {
 AVClass *class;
 
@@ -120,10 +57,8 @@ typedef struct DXVEncContext {
 DXVTextureFormat tex_fmt;
 int (*compress_tex)(AVCodecContext *avctx);
 
-const AVCRC *crc_ctx;
-
-HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
-HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
+struct AVHashtableContext *color_ht;
+struct AVHashtableContext *lut_ht;
 } DXVEncContext;
 
 /* Converts an index offset value to a 2-bit opcode and pushes it to a stream.
@@ -158,27 +93,32 @@ static int dxv_compress_dxt1(AVCodecContext *avctx)
 DXVEncContext *ctx = avctx->priv_data;
 PutByteContext *pbc = >pbc;
 uint32_t *value;
-uint32_t color, lut, idx, color_idx, lut_idx, prev_pos, state = 16, pos = 
2, op = 0;
+uint32_t color, lut, idx, color_idx, lut_idx, prev_pos, state = 16, pos = 
0, op = 0;
 
-ht_init(ctx->color_lookback_ht);
-ht_init(ctx->lut_lookback_ht);
+av_hashtable_clear(ctx->color_ht);
+av_hashtable_clear(ctx->lut_ht);
 
 bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data));
+av_hashtable_set(ctx->color_ht, ctx->tex_data, );
+pos++;
 bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + 4));
-
-ht_lookup_and_upsert(ctx->color_lookback_ht, ctx->crc_ctx, 
AV_RL32(ctx->tex_data), 0);
-ht_lookup_and_upsert(ctx->lut_lookback_ht, ctx->crc_ctx, 
AV_RL32(ctx->tex_data + 4), 1);
+av_hashtable_set(ctx->lut_ht, ctx->tex_data + 4, );
+pos++;
 
 while (pos + 2 <= ctx->tex_size / 4) {
 idx = 0;
+color_idx = 0;
+lut_idx = 0;
 
 color = AV_RL32(ctx->tex_data + pos * 4);
-prev_pos = ht_lookup_and_upsert(ctx->color_lookback_ht, ctx->crc_ctx, 
color, pos);
-color_idx = prev_pos != -1 ? pos - prev_pos : 0;
+if (av_hashtable_get(ctx->color_ht, , _pos))
+color_idx = pos - prev_pos;
+av_hashtable_set(ctx->color_ht, , );
+
 if (pos >= LOOKBACK_WORDS) {
 uint32_t old_pos = pos - LOOKBACK_WORDS;
-uint32_t old_color = AV_RL32(ctx->tex_data + 

[FFmpeg-devel] [PATCH v3 1/2] lavu/hashtable: create generic robin hood hash table

2024-02-21 Thread Connor Worley
Signed-off-by: Connor Worley 
---
 libavutil/Makefile  |   2 +
 libavutil/hashtable.c   | 192 
 libavutil/hashtable.h   |  40 
 libavutil/tests/hashtable.c | 108 
 4 files changed, 342 insertions(+)
 create mode 100644 libavutil/hashtable.c
 create mode 100644 libavutil/hashtable.h
 create mode 100644 libavutil/tests/hashtable.c

diff --git a/libavutil/Makefile b/libavutil/Makefile
index e7709b97d0..be75d464fc 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -138,6 +138,7 @@ OBJS = adler32.o
\
fixed_dsp.o  \
frame.o  \
hash.o   \
+   hashtable.o  \
hdr_dynamic_metadata.o   \
hdr_dynamic_vivid_metadata.o \
hmac.o   \
@@ -251,6 +252,7 @@ TESTPROGS = adler32 
\
 file\
 fifo\
 hash\
+hashtable   \
 hmac\
 hwdevice\
 integer \
diff --git a/libavutil/hashtable.c b/libavutil/hashtable.c
new file mode 100644
index 00..155a264665
--- /dev/null
+++ b/libavutil/hashtable.c
@@ -0,0 +1,192 @@
+/*
+ * Generic hashtable
+ * Copyright (C) 2024 Connor Worley 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+
+#include "crc.h"
+#include "error.h"
+#include "mem.h"
+#include "hashtable.h"
+
+#define ALIGN _Alignof(size_t)
+
+struct AVHashtableContext {
+size_t key_size;
+size_t key_size_aligned;
+size_t val_size;
+size_t val_size_aligned;
+size_t entry_size;
+size_t max_entries;
+size_t utilization;
+const AVCRC *crc;
+uint8_t *table;
+uint8_t *swapbuf;
+};
+
+#define ENTRY_PSL(entry) (entry)
+#define ENTRY_OCC(entry) (ENTRY_PSL(entry) + FFALIGN(sizeof(size_t), ALIGN))
+#define ENTRY_KEY(entry) (ENTRY_OCC(entry) + FFALIGN(sizeof(size_t), ALIGN))
+#define ENTRY_VAL(entry) (ENTRY_KEY(entry) + ctx->key_size_aligned)
+
+#define KEYS_EQUAL(k1, k2) !memcmp(k1, k2, ctx->key_size)
+
+int av_hashtable_alloc(struct AVHashtableContext **ctx, size_t key_size, 
size_t val_size, size_t max_entries)
+{
+struct AVHashtableContext *res = av_malloc(sizeof(struct 
AVHashtableContext));
+if (!res)
+return AVERROR(ENOMEM);
+res->key_size = key_size;
+res->key_size_aligned = FFALIGN(key_size, ALIGN);
+res->val_size = val_size;
+res->val_size_aligned = FFALIGN(val_size, ALIGN);
+res->entry_size = FFALIGN(sizeof(size_t), ALIGN)
++ FFALIGN(sizeof(size_t), ALIGN)
++ res->key_size_aligned
++ res->val_size_aligned;
+res->max_entries = max_entries;
+res->utilization = 0;
+res->crc = av_crc_get_table(AV_CRC_32_IEEE);
+if (!res->crc) {
+av_hashtable_freep();
+return AVERROR_BUG;
+}
+res->table = av_calloc(res->max_entries, res->entry_size);
+if (!res->table) {
+av_hashtable_freep();
+return AVERROR(ENOMEM);
+}
+res->swapbuf = av_calloc(2, res->key_size_aligned + res->val_size_aligned);
+if (!res->swapbuf) {
+av_hashtable_freep();
+return AVERROR(ENOMEM);
+}
+*ctx = res;
+return 0;
+}
+
+static size_t hash_key(const struct AVHashtableContext *ctx, const void *key)
+{
+return av_crc(ctx->crc, 0, key, ctx->key_size) % ctx->max_entries;
+}
+
+int av_hashtable_get(const struct AVHashtableContext *ctx, const void *key, 
void *val)
+{
+   

[FFmpeg-devel] [PATCH 2/4] fftools/ffprobe: Constify printing section header

2024-02-21 Thread Andreas Rheinhardt
Allows to avoid casting const away.

Signed-off-by: Andreas Rheinhardt 
---
 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 = >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 = >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_header(w, sd, id_data);
 print_str("side_data_type", name ? name : "unknown");
 if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
 double rotation = av_display_rotation_get((int32_t *)sd->data);
@@ -2635,7 +2637,7 @@ static void print_frame_side_data(WriterContext *w,
 

[FFmpeg-devel] [PATCH 3/4] fftools/ffprobe: Simplify printing xml values

2024-02-21 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 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();
 
 if (is_int) {
-writer_printf(wctx, " value=\"%lld\"/>\n", *(long long int 
*)value);
+writer_printf(wctx, " value=\"%lld\"/>\n", num);
 } else {
-av_bprint_escape(, (const char *)value, NULL,
+av_bprint_escape(, 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(, (const char *)value, NULL,
+av_bprint_escape(, 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 *), 1);
+xml_print_value(wctx, key, NULL, value, 1);
 }
 
 static Writer xml_writer = {
-- 
2.40.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 4/4] fftools/ffprobe: Use int64_t instead of long long int

2024-02-21 Thread Andreas Rheinhardt
This makes ffprobe match the rest of the codebase.

Signed-off-by: Andreas Rheinhardt 
---
 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(, 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(WriterContext 
*wctx, const void *data)
 }
 }
 
-static void flat_print_int(WriterContext *wctx, const char *key, long long int 
value)
+static void flat_print_int(WriterContext *wctx, const char *key, int64_t value)
 {
-writer_printf(wctx, "%s%s=%lld\n", wctx->section_pbuf[wctx->level].str, 
key, value);
+

[FFmpeg-devel] [PATCH 1/4] fftools/ffprobe: Don't cast const away needlessly

2024-02-21 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 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(, 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;
-- 
2.40.1

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

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


[FFmpeg-devel] [PATCH 3/3] avcodec/cbs_h2645: Avoid function pointer casts, fix UB

2024-02-21 Thread Andreas Rheinhardt
The SEI message read/write functions are called
via function pointers where the SEI message-specific
context is passed as void*. But the actual function
definitions use a pointer to their proper context
in place of void*, making the calls undefined behaviour.
Clang UBSan 17 warns about this.

This commit fixes this by making the functions match
the type of the call. This reduced the number of failing
FATE tests with UBSan from 164 to 85 here.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h264_syntax_template.c | 24 ++---
 libavcodec/cbs_h265_syntax_template.c | 31 +--
 libavcodec/cbs_h266_syntax_template.c |  6 +++---
 libavcodec/cbs_sei.h  |  8 +++
 libavcodec/cbs_sei_syntax_template.c  | 23 
 5 files changed, 52 insertions(+), 40 deletions(-)

diff --git a/libavcodec/cbs_h264_syntax_template.c 
b/libavcodec/cbs_h264_syntax_template.c
index 0f8bba4a0d..282cd24292 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -511,9 +511,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext 
*rw,
 }
 
 static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext 
*rw,
-  H264RawSEIBufferingPeriod *current,
-  SEIMessageState *sei)
+  void *current_, SEIMessageState *sei)
 {
+H264RawSEIBufferingPeriod *current = current_;
 CodedBitstreamH264Context *h264 = ctx->priv_data;
 const H264RawSPS *sps;
 int err, i, length;
@@ -605,9 +605,9 @@ static int FUNC(sei_pic_timestamp)(CodedBitstreamContext 
*ctx, RWContext *rw,
 }
 
 static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw,
-H264RawSEIPicTiming *current,
-SEIMessageState *sei)
+void *current_, SEIMessageState *sei)
 {
+H264RawSEIPicTiming *current = current_;
 CodedBitstreamH264Context *h264 = ctx->priv_data;
 const H264RawSPS *sps;
 int err;
@@ -677,9 +677,9 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, 
RWContext *rw,
 }
 
 static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext *ctx, RWContext *rw,
-   H264RawSEIPanScanRect *current,
-   SEIMessageState *sei)
+   void *current_, SEIMessageState *sei)
 {
+H264RawSEIPanScanRect *current = current_;
 int err, i;
 
 HEADER("Pan-Scan Rectangle");
@@ -704,9 +704,9 @@ static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext 
*ctx, RWContext *rw,
 }
 
 static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw,
-H264RawSEIRecoveryPoint *current,
-SEIMessageState *sei)
+void *current_, SEIMessageState *sei)
 {
+H264RawSEIRecoveryPoint *current = current_;
 int err;
 
 HEADER("Recovery Point");
@@ -720,9 +720,9 @@ static int FUNC(sei_recovery_point)(CodedBitstreamContext 
*ctx, RWContext *rw,
 }
 
 static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, 
RWContext *rw,
-H264RawFilmGrainCharacteristics 
*current,
-SEIMessageState *state)
+void *current_, SEIMessageState 
*state)
 {
+H264RawFilmGrainCharacteristics *current = current_;
 CodedBitstreamH264Context *h264 = ctx->priv_data;
 const H264RawSPS *sps;
 int err, c, i, j;
@@ -803,9 +803,9 @@ static int 
FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContex
 }
 
 static int FUNC(sei_display_orientation)(CodedBitstreamContext *ctx, RWContext 
*rw,
- H264RawSEIDisplayOrientation *current,
- SEIMessageState *sei)
+ void *current_, SEIMessageState *sei)
 {
+H264RawSEIDisplayOrientation *current = current_;
 int err;
 
 HEADER("Display Orientation");
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index 2d4b954718..53ae0cabff 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1620,8 +1620,9 @@ static int 
FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
 
 static int FUNC(sei_buffering_period)
 (CodedBitstreamContext *ctx, RWContext *rw,
- H265RawSEIBufferingPeriod *current, SEIMessageState *sei)
+ void *current_, SEIMessageState *sei)
 {
+H265RawSEIBufferingPeriod *current = current_;
 CodedBitstreamH265Context *h265 = ctx->priv_data;
 const H265RawSPS *sps;
 const H265RawHRDParameters *hrd;
@@ -1730,8 +1731,9 @@ static int FUNC(sei_buffering_period)
 
 static 

[FFmpeg-devel] [PATCH 2/3] avutil/opt: Use correct function pointer type

2024-02-21 Thread Andreas Rheinhardt
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.

Signed-off-by: Andreas Rheinhardt 
---
 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)
-- 
2.40.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] fate/mxf: fix mxf-probe-j2k on big endian systems

2024-02-21 Thread Marton Balint
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 
---
 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
-- 
2.35.3

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

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


[FFmpeg-devel] [PATCH 1/3] avcodec/cbs_h266_syntax_template: Don't omit unused function parameter

2024-02-21 Thread Andreas Rheinhardt
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.)

Signed-off-by: Andreas Rheinhardt 
---
I found this via UBSan test failures with Clang 17,
but actually there are compiler warnings for this:
-Wcast-function-type for GCC and old Clang
and -Wcast-function-type in conjunction with
-Wno-cast-function-type-strict (without the latter,
Clang warns about conversions with different pointer
types, like int (*)(void*)->int (*)(struct Foo*);
the latter typically lead to UB (when used in a call),
but are actually common).

 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;
 
-- 
2.40.1

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

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


Re: [FFmpeg-devel] [PATCH] libavutil/timestamp.h: Fix loss of precision in timestamps for silencedetect on long files

2024-02-21 Thread Marton Balint




On Tue, 20 Feb 2024, Allan Cady via ffmpeg-devel wrote:


When the silencedetect audio filter is run against long files, the
output timestamps gradually lose precision as the scan proceeds further
into the file. This is because the output format specifier ("%.6g" in
libavutil/timestamp.h) limits the total field width to six significant
digits. As the offset into the file increases, digits drop off the end,
until eventually, for offsets greater than 10 seconds (about 28
hours), fractions of a second disappear altogether, and the timestamps
are logged as whole seconds.

This patch changes the format to "%.6f" for silencedetect, which will
give microsecond precision for all timestamps regardless of offset.

libavutil/timestamp.h exposes a macro, av_ts2timestr, as the public
interface. This macro was used by silencedetect.c, as well as other
source files. In order to fix the issue for silencedetect without
affecting other files and tests, I have added a new macro,
av_ts2timestr_fixed_precision, which uses the new format specifier.
The original av_ts_make_time_string remains, with the original
behavior.


I'd rather just to fix av_ts_make_string to not limit the number of 
significant digits. Something like:


1) Print the number in decimal notation with at most 6 fractional digits. 
2) Use less fractional digits if the first format would not fit into 
AV_TS_MAX_STRING_SIZE.
3) Use scientific notation if the second format would not fit into 
AV_TS_MAX_STRINT_SIZE.


Regards,
Marton
___
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 5/7] lavc/me_cmp: R-V V vsse vsad

2024-02-21 Thread Rémi Denis-Courmont
Le tiistaina 6. helmikuuta 2024, 17.56.32 EET flow gg a écrit :
> 

Did you try to compute integral absolute values with the ad-hoc (floating 
point) instruction instead of vneg/vmax? It should work since the sign is in 
the same place, though I don't know if it will be faster.

-- 
レミ・デニ-クールモン
http://www.remlab.net/



___
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] lavc/vp8dsp: R-V V put_vp8_pixels

2024-02-21 Thread Rémi Denis-Courmont
Hello,

Le maanantaina 19. helmikuuta 2024, 13.13.43 EET flow gg a écrit :
> The reason for using m1+le8 instead of stride load + larger group
> multipliers is the same as in "[FFmpeg-devel] [PATCH 1/7] lavc/me_cmp: R-V
> V pix_abs."
> 
> In the test, there is
> 
> #define src (buf + 2 * SRC_BUF_STRIDE + 2 + 1)
> 
> Therefore, not using e8 will result : (fatal signal 7: Bus error).

Yes, you could also just say that alignment is insufficient :)

It is still possible to load rectangles of up to 8 columns using vlseg8e8, but 
it might be slower than just repeating the 8 regular loads, and it won't work 
if you need calculations between rows.

I may be missing something but I don't understand what purpose the header file 
serves here?

-- 
Rémi Denis-Courmont
http://www.remlab.net/



___
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] fate/image: Enable fate-webp-rgb-lossless-palette-predictor test

2024-02-21 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Postponed in 9f4708c22def8a0f13c3b2bc39baca928bb58aaa
> because the sample had not been uploaded at that time.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  tests/fate/image.mak | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/fate/image.mak b/tests/fate/image.mak
> index 400199c28a..7c0e0fec08 100644
> --- a/tests/fate/image.mak
> +++ b/tests/fate/image.mak
> @@ -557,9 +557,8 @@ fate-webp-rgb-lena-lossless-rgb24: CMD = framecrc -i 
> $(TARGET_SAMPLES)/webp/rgb_
>  FATE_WEBP += fate-webp-rgba-lossless
>  fate-webp-rgba-lossless: CMD = framecrc -i 
> $(TARGET_SAMPLES)/webp/rgba_lossless.webp
>  
> -# TODO(https://trac.ffmpeg.org/ticket/9368): enable after sample is uploaded
> -# FATE_WEBP += fate-webp-rgb-lossless-palette-predictor
> -# fate-webp-rgb-lossless-palette-predictor: CMD = framecrc -i 
> $(TARGET_SAMPLES)/webp/dual_transform.webp
> +FATE_WEBP += fate-webp-rgb-lossless-palette-predictor
> +fate-webp-rgb-lossless-palette-predictor: CMD = framecrc -i 
> $(TARGET_SAMPLES)/webp/dual_transform.webp
>  
>  FATE_WEBP += fate-webp-rgb-lossy-q80
>  fate-webp-rgb-lossy-q80: CMD = framecrc -i 
> $(TARGET_SAMPLES)/webp/rgb_q80.webp

Will apply.

- Andreas

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

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


Re: [FFmpeg-devel] [PATCH 3/3] libswscale/utils: Fix bayer to yuvj

2024-02-21 Thread Michael Niedermayer
On Tue, Feb 20, 2024 at 03:49:22AM +0100, Michael Niedermayer wrote:
> Fixes: out of array access.
> 
> Earlier code assumes that a unscaled bayer to yuvj420 converter exists
> but the later code then skips yuvj420
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libswscale/utils.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown


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 2/3] Revert "swscale: fix sws_setColorspaceDetails after sws_init_context"

2024-02-21 Thread Michael Niedermayer
On Tue, Feb 20, 2024 at 03:49:21AM +0100, Michael Niedermayer wrote:
> Suggested by: Niklas Haas in Ticket10824
> 
> Fixes: Assertion failure
> Fixes: Ticket10824
> 
> This reverts commit cedf589c09c567b72bf4c1a58db53d94622567e1.
> ---
>  libswscale/swscale.c |  2 +-
>  libswscale/utils.c   | 10 +++---
>  2 files changed, 8 insertions(+), 4 deletions(-)

will apply

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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

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


Re: [FFmpeg-devel] [PATCH 1/2] swscale/utils: Allocate more dithererror

2024-02-21 Thread Michael Niedermayer
On Sat, Feb 17, 2024 at 06:09:46PM +0100, Michael Niedermayer wrote:
> Fixes: out of array read
> Signed-off-by: Michael Niedermayer 
> ---
>  libswscale/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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

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


Re: [FFmpeg-devel] [PATCH] [mov] Avoid OOM for invalid STCO / CO64 constructions.

2024-02-21 Thread Michael Niedermayer
On Fri, Feb 16, 2024 at 01:41:35PM -0800, Dale Curtis wrote:
> On Thu, Feb 15, 2024 at 2:35 PM Michael Niedermayer 
> wrote:
> 
> > FFMIN/MAX can evaluate their arguments multiple times so avio_rb32() might
> > be executed more than once
> >
> 
> Thanks. Good catch. Fixed.

>  mov.c |7 +++
>  1 file changed, 7 insertions(+)
> 08ba396380cc14f3df2bdd4a638c43c1c521b8fc  stco-clamp-entries-v4.patch
> From b94e542582e375025c59862cee58ec45d39c9cd6 Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Fri, 2 Feb 2024 20:49:44 +
> Subject: [PATCH] [mov] Avoid OOM for invalid STCO / CO64 constructions.
> 
> The `entries` value is read directly from the stream and used to
> allocate memory. This change clamps `entries` to however many are
> possible in the remaining atom or file size (whichever is smallest).
> 
> Fixes https://crbug.com/1429357
> 
> Signed-off-by: Dale Curtis 
> ---
>  libavformat/mov.c | 7 +++
>  1 file changed, 7 insertions(+)

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown


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] avcodec/h264dec: Return early in ff_h264_draw_horiz_band()

2024-02-21 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/h264dec.c | 23 +--
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index 9f5893c512..5cffeafc6b 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -104,9 +104,17 @@ void ff_h264_draw_horiz_band(const H264Context *h, 
> H264SliceContext *sl,
>  {
>  AVCodecContext *avctx = h->avctx;
>  const AVFrame   *src  = h->cur_pic.f;
> -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
> -int vshift = desc->log2_chroma_h;
> +const AVPixFmtDescriptor *desc;
> +int offset[AV_NUM_DATA_POINTERS];
> +int vshift;
>  const int field_pic = h->picture_structure != PICT_FRAME;
> +
> +if (!avctx->draw_horiz_band)
> +return;
> +
> +if (field_pic && h->first_field && !(avctx->slice_flags & 
> SLICE_FLAG_ALLOW_FIELD))
> +return;
> +
>  if (field_pic) {
>  height <<= 1;
>  y  <<= 1;
> @@ -114,24 +122,19 @@ void ff_h264_draw_horiz_band(const H264Context *h, 
> H264SliceContext *sl,
>  
>  height = FFMIN(height, avctx->height - y);
>  
> -if (field_pic && h->first_field && !(avctx->slice_flags & 
> SLICE_FLAG_ALLOW_FIELD))
> -return;
> -
> -if (avctx->draw_horiz_band) {
> -int offset[AV_NUM_DATA_POINTERS];
> -int i;
> +desc   = av_pix_fmt_desc_get(avctx->pix_fmt);
> +vshift = desc->log2_chroma_h;
>  
>  offset[0] = y * src->linesize[0];
>  offset[1] =
>  offset[2] = (y >> vshift) * src->linesize[1];
> -for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
> +for (int i = 3; i < AV_NUM_DATA_POINTERS; i++)
>  offset[i] = 0;
>  
>  emms_c();
>  
>  avctx->draw_horiz_band(avctx, src, offset,
> y, h->picture_structure, height);
> -}
>  }
>  
>  void ff_h264_free_tables(H264Context *h)

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] [PATCH] avcodec/cbs_vp8: Don't leave out ... in calls to variadic macros

2024-02-21 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> It is undefined behaviour (see C11, 6.10.3 (4); see also
> 14dd0a9057019e97ff9438f6cc1502f6922acb85).
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/cbs_vp8.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c
> index eabdef358f..1f7e81cfe6 100644
> --- a/libavcodec/cbs_vp8.c
> +++ b/libavcodec/cbs_vp8.c
> @@ -223,19 +223,19 @@ static int 
> cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
>  #define SUBSCRIPTS(subs, ...) \
>  (subs > 0 ? ((int[subs + 1]){subs, __VA_ARGS__}) : NULL)
>  
> -#define f(width, name) xf(width, name, 0)
> +#define f(width, name) xf(width, name, 0, )
>  
>  // bool [de|en]coder methods.
> -#define bc_f(width, name) bc_unsigned_subs(width, DEFAULT_PROB, true, name, 
> 0)
> -#define bc_s(width, name) bc_signed_subs(width, DEFAULT_PROB, name, 0)
> +#define bc_f(width, name) bc_unsigned_subs(width, DEFAULT_PROB, true, name, 
> 0, )
> +#define bc_s(width, name) bc_signed_subs(width, DEFAULT_PROB, name, 0, )
>  #define bc_fs(width, name, subs, ...) \
>  bc_unsigned_subs(width, DEFAULT_PROB, true, name, subs, __VA_ARGS__)
>  #define bc_ss(width, name, subs, ...) \
>  bc_signed_subs(width, DEFAULT_PROB, name, subs, __VA_ARGS__)
>  
>  // bool [de|en]coder methods for boolean value and disable tracing.
> -#define bc_b(name) bc_unsigned_subs(1, DEFAULT_PROB, false, name, 0)
> -#define bc_b_prob(prob, name) bc_unsigned_subs(1, prob, false, name, 0)
> +#define bc_b(name) bc_unsigned_subs(1, DEFAULT_PROB, false, name, 0, )
> +#define bc_b_prob(prob, name) bc_unsigned_subs(1, prob, false, name, 0, )
>  
>  #define READ
>  #define READWRITE read

Will apply this patch 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] [PATCH] fftools/ffmpeg: remove options deprecated before 6.0

2024-02-21 Thread Andreas Rheinhardt
Anton Khirnov:
> ---
> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> index 3f21815ba2..669c878c7f 100644
> --- a/tests/fate/ffmpeg.mak
> +++ b/tests/fate/ffmpeg.mak
> @@ -1,28 +1,3 @@
> -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV, 
> MD5_PROTOCOL) += fate-mapchan-6ch-extract-2
> -fate-mapchan-6ch-extract-2: tests/data/asynth-22050-6.wav
> -fate-mapchan-6ch-extract-2: CMD = ffmpeg -i 
> $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.0 -fflags 
> +bitexact -f wav md5: -map_channel 0.0.1 -fflags +bitexact -f wav md5:
> -
> -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN ARESAMPLE, WAV, PCM_S16LE, 
> PCM_S16LE, WAV) += fate-mapchan-6ch-extract-2-downmix-mono
> -fate-mapchan-6ch-extract-2-downmix-mono: tests/data/asynth-22050-6.wav
> -fate-mapchan-6ch-extract-2-downmix-mono: CMD = md5 -auto_conversion_filters 
> -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.1 
> -map_channel 0.0.0 -ac 1 -fflags +bitexact -f wav
> -
> -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) 
> += fate-mapchan-silent-mono
> -fate-mapchan-silent-mono: tests/data/asynth-22050-1.wav
> -fate-mapchan-silent-mono: CMD = md5 -i 
> $(TARGET_PATH)/tests/data/asynth-22050-1.wav -map_channel -1 -map_channel 
> 0.0.0 -fflags +bitexact -f wav
> -
> -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) 
> += fate-mapchan-2ch-extract-ch0-ch2-trailing
> -fate-mapchan-2ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-2.wav
> -fate-mapchan-2ch-extract-ch0-ch2-trailing: CMD = md5 -i 
> $(TARGET_PATH)/tests/data/asynth-44100-2.wav -map_channel 0.0.0 -map_channel 
> 0.0.2? -fflags +bitexact -f wav
> -
> -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) 
> += fate-mapchan-3ch-extract-ch0-ch2-trailing
> -fate-mapchan-3ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-3.wav
> -fate-mapchan-3ch-extract-ch0-ch2-trailing: CMD = md5 -i 
> $(TARGET_PATH)/tests/data/asynth-44100-3.wav -map_channel 0.0.0 -map_channel 
> 0.0.2? -fflags +bitexact -f wav
> -
> -FATE_MAPCHAN = $(FATE_MAPCHAN-yes)
> -
> -FATE_FFMPEG += $(FATE_MAPCHAN)
> -fate-mapchan: $(FATE_MAPCHAN)
> -
>  FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-filter_complex
>  fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex color=d=1:r=5 
> -fflags +bitexact
>  

Will this reduce coverage in the pan filter?

- Andreas

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

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


Re: [FFmpeg-devel] [PATCH] avutil/tx: print debug log at trace level

2024-02-21 Thread James Almer

On 2/21/2024 1:32 PM, Lynne wrote:

Feb 21, 2024, 15:43 by jamr...@gmail.com:


The output of TX is extremely verbose and makes it harder to find other debug
log messages, so only print it at trace level.

Signed-off-by: James Almer 
---
  libavutil/tx.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index f991618b4b..eefb3e2ac7 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -643,7 +643,7 @@ static void print_cd_info(const FFTXCodelet *cd, int prio, 
int len, int print_pr
  if (print_prio)
  av_bprintf(, ", prio: %i", prio);
  
-av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);

+av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
  }
  
  static void print_tx_structure(AVTXContext *s, int depth)

@@ -651,7 +651,7 @@ static void print_tx_structure(AVTXContext *s, int depth)
  const FFTXCodelet *cd = s->cd_self;
  
  for (int i = 0; i <= depth; i++)

-av_log(NULL, AV_LOG_DEBUG, "");
+av_log(NULL, AV_LOG_TRACE, "");
  
  print_cd_info(cd, cd->prio, s->len, 0);
  
@@ -816,10 +816,10 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,

  AV_QSORT(cd_matches, nb_cd_matches, TXCodeletMatch, cmp_matches);
  
  #if !CONFIG_SMALL

-av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
+av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
  
  for (int i = 0; i < nb_cd_matches; i++) {

-av_log(NULL, AV_LOG_DEBUG, "%i: ", i + 1);
+av_log(NULL, AV_LOG_TRACE, "%i: ", i + 1);
  print_cd_info(cd_matches[i].cd, cd_matches[i].prio, 0, 1);
  }
  #endif
@@ -929,7 +929,7 @@ av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, 
enum AVTXType type,
  *tx  = tmp.fn[0];
  
  #if !CONFIG_SMALL

-av_log(NULL, AV_LOG_DEBUG, "Transform tree:\n");
+av_log(NULL, AV_LOG_TRACE, "Transform tree:\n");
  print_tx_structure(*ctx, 0);
  #endif



It's a chunk of few dozen lines, I don't think it's spammy enough for trace.


It's extremely spammy. Here's what i get when i simply do "ffmpeg 
-loglevel debug -i INPUT" with a file that has four Opus streams, simply 
for probing them:



For transform of length 120, inverse, mdct_float, flags: [aligned, 
out_of_place], found 6 matches:
1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only], prio: 544
2: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: 
[15, any], flags: [unaligned, out_of_place, inv_only], prio: 304
3: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: 
[5, any], flags: [unaligned, out_of_place, inv_only], prio: 144
4: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: 
[3, any], flags: [unaligned, out_of_place, inv_only], prio: 112
5: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], 
flags: [unaligned, out_of_place, inv_only], prio: 96
6: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, 
any], flags: [unaligned, out_of_place, inv_only], prio: -130976
For transform of length 60, inverse, fft_float, flags: [aligned, inplace, 
preshuf, asm_call], found 1 matches:
1: fft_pfa_15xM_asm_float_avx2 - type: fft_float, len: [60, ∞], factors[2]: 
[15, 2], flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 688
For transform of length 4, inverse, fft_float, flags: [aligned, inplace, 
preshuf, asm_call], found 1 matches:
1: fft4_fwd_asm_float_sse2 - type: fft_float, len: 4, factor: 2, flags: 
[aligned, inplace, out_of_place, preshuf, asm_call], prio: 352
Transform tree:
mdct_inv_float_avx2 - type: mdct_float, len: 120, factors[2]: [2, any], 
flags: [aligned, out_of_place, inv_only]
fft_pfa_15xM_asm_float_avx2 - type: fft_float, len: 60, factors[2]: 
[15, 2], flags: [aligned, inplace, out_of_place, preshuf, asm_call]
fft4_fwd_asm_float_sse2 - type: fft_float, len: 4, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf, asm_call]
For transform of length 240, inverse, mdct_float, flags: [aligned, 
out_of_place], found 6 matches:
1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only], prio: 544
2: mdct_pfa_15xM_inv_float_c - type: mdct_float, len: [30, ∞], factors[2]: 
[15, any], flags: [unaligned, out_of_place, inv_only], prio: 304
3: mdct_pfa_5xM_inv_float_c - type: mdct_float, len: [10, ∞], factors[2]: 
[5, any], flags: [unaligned, out_of_place, inv_only], prio: 144
4: mdct_pfa_3xM_inv_float_c - type: mdct_float, len: [6, ∞], factors[2]: 
[3, any], flags: [unaligned, out_of_place, inv_only], prio: 112
5: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], 
flags: [unaligned, out_of_place, inv_only], prio: 96
6: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, 
any], flags: [unaligned, out_of_place, inv_only], prio: -130976
For transform of length 120, inverse, fft_float, flags: [aligned, 

Re: [FFmpeg-devel] [PATCH] avutil/tx: print debug log at trace level

2024-02-21 Thread Lynne
Feb 21, 2024, 15:43 by jamr...@gmail.com:

> The output of TX is extremely verbose and makes it harder to find other debug
> log messages, so only print it at trace level.
>
> Signed-off-by: James Almer 
> ---
>  libavutil/tx.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavutil/tx.c b/libavutil/tx.c
> index f991618b4b..eefb3e2ac7 100644
> --- a/libavutil/tx.c
> +++ b/libavutil/tx.c
> @@ -643,7 +643,7 @@ static void print_cd_info(const FFTXCodelet *cd, int 
> prio, int len, int print_pr
>  if (print_prio)
>  av_bprintf(, ", prio: %i", prio);
>  
> -av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
> +av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
>  }
>  
>  static void print_tx_structure(AVTXContext *s, int depth)
> @@ -651,7 +651,7 @@ static void print_tx_structure(AVTXContext *s, int depth)
>  const FFTXCodelet *cd = s->cd_self;
>  
>  for (int i = 0; i <= depth; i++)
> -av_log(NULL, AV_LOG_DEBUG, "");
> +av_log(NULL, AV_LOG_TRACE, "");
>  
>  print_cd_info(cd, cd->prio, s->len, 0);
>  
> @@ -816,10 +816,10 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum 
> AVTXType type,
>  AV_QSORT(cd_matches, nb_cd_matches, TXCodeletMatch, cmp_matches);
>  
>  #if !CONFIG_SMALL
> -av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
> +av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
>  
>  for (int i = 0; i < nb_cd_matches; i++) {
> -av_log(NULL, AV_LOG_DEBUG, "%i: ", i + 1);
> +av_log(NULL, AV_LOG_TRACE, "%i: ", i + 1);
>  print_cd_info(cd_matches[i].cd, cd_matches[i].prio, 0, 1);
>  }
>  #endif
> @@ -929,7 +929,7 @@ av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, 
> enum AVTXType type,
>  *tx  = tmp.fn[0];
>  
>  #if !CONFIG_SMALL
> -av_log(NULL, AV_LOG_DEBUG, "Transform tree:\n");
> +av_log(NULL, AV_LOG_TRACE, "Transform tree:\n");
>  print_tx_structure(*ctx, 0);
>  #endif 
>

It's a chunk of few dozen lines, I don't think it's spammy enough for trace.
___
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] fftools/cmdutils: remove harmful variable shadowing

2024-02-21 Thread Anton Khirnov
It causes write_option() to return 0 when calling func_arg() fails.
---
 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);
-- 
2.42.0

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

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


Re: [FFmpeg-devel] [RFC] fate rsync switch to git

2024-02-21 Thread epirat07


On 21 Feb 2024, at 15:38, Niklas Haas wrote:

> On Tue, 20 Feb 2024 20:43:30 +0200 Jan Ekström  wrote:
>> Do note that the idea was that this would only be for management of
>> the main archive, so it would not affect clients/runners rsync'ing
>> from the main archive.
>>
>> Of course clients which want to sync directly from git could do that,
>> but the idea would be to keep the sync requirements same for FATE
>> clients/runners: if you are only running tests, rsync is enough.
>>
>> As after all, the primary reasons for having the samples in git would
>> be versioning, more concrete known states in a public archive (I would
>> probably not call this a "backup", but it would mean we would have the
>> history in multiple places at least), as well as - if we utilize
>> something like git{lab,hub} - easier workflow to adding new samples by
>> means of f.ex. merge/pull requests.
>>
>> This idea originated from looking at how the dav1d project handled
>> their reference sample suite, which seems to have served them well
>> enough: https://code.videolan.org/videolan/dav1d-test-data
>>
>> Regards,
>> Jan
>
> Is there any reason (besides efficiency hit) not to make the FATE repo
> a `git submodule` of the FFmpeg git repo? That way, commits which depend
> on certain additions to fate-samples can explicitly depend on the
> commits adding those files, developers can more easily see (e.g. via
> `git status`) if the fate samples are out-of-date (or use `git pull
> --recurse-submodules` to automate the process).

I am all for having it in git but do not like the idea of a git submodule
at all as they are a nightmare to work with, sometimes create absolutely
unworkable conflicts when rebasing and other oddities…

(We use submodules for the Icecast project, it was my idea back then and
I regret it…)

>
> It will also make the samples repo historically consistent, e.g. if
> somebody changes a detail about a file in a later commit, older commits
> referencing the unmodified version will continue passing FATE tests. I'm
> not sure if this has ever been a concern in the past, but it may well
> be one in the future.
>
> Worrying about the performance impact of rsync vs git-lfs (or equivalent
> solutions) seems like premature optimization to me; and the ease of
> maintenance, historical consistency, transparency in process, and
> end-user convenience of a git repository seems to far outweigh the
> drawbacks.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avutil/tx: print debug log at trace level

2024-02-21 Thread James Almer
The output of TX is extremely verbose and makes it harder to find other debug
log messages, so only print it at trace level.

Signed-off-by: James Almer 
---
 libavutil/tx.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index f991618b4b..eefb3e2ac7 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -643,7 +643,7 @@ static void print_cd_info(const FFTXCodelet *cd, int prio, 
int len, int print_pr
 if (print_prio)
 av_bprintf(, ", prio: %i", prio);
 
-av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
+av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
 }
 
 static void print_tx_structure(AVTXContext *s, int depth)
@@ -651,7 +651,7 @@ static void print_tx_structure(AVTXContext *s, int depth)
 const FFTXCodelet *cd = s->cd_self;
 
 for (int i = 0; i <= depth; i++)
-av_log(NULL, AV_LOG_DEBUG, "");
+av_log(NULL, AV_LOG_TRACE, "");
 
 print_cd_info(cd, cd->prio, s->len, 0);
 
@@ -816,10 +816,10 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum 
AVTXType type,
 AV_QSORT(cd_matches, nb_cd_matches, TXCodeletMatch, cmp_matches);
 
 #if !CONFIG_SMALL
-av_log(NULL, AV_LOG_DEBUG, "%s\n", bp.str);
+av_log(NULL, AV_LOG_TRACE, "%s\n", bp.str);
 
 for (int i = 0; i < nb_cd_matches; i++) {
-av_log(NULL, AV_LOG_DEBUG, "%i: ", i + 1);
+av_log(NULL, AV_LOG_TRACE, "%i: ", i + 1);
 print_cd_info(cd_matches[i].cd, cd_matches[i].prio, 0, 1);
 }
 #endif
@@ -929,7 +929,7 @@ av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, 
enum AVTXType type,
 *tx  = tmp.fn[0];
 
 #if !CONFIG_SMALL
-av_log(NULL, AV_LOG_DEBUG, "Transform tree:\n");
+av_log(NULL, AV_LOG_TRACE, "Transform tree:\n");
 print_tx_structure(*ctx, 0);
 #endif
 
-- 
2.43.2

___
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] [RFC] fate rsync switch to git

2024-02-21 Thread Niklas Haas
On Tue, 20 Feb 2024 20:43:30 +0200 Jan Ekström  wrote:
> Do note that the idea was that this would only be for management of
> the main archive, so it would not affect clients/runners rsync'ing
> from the main archive.
> 
> Of course clients which want to sync directly from git could do that,
> but the idea would be to keep the sync requirements same for FATE
> clients/runners: if you are only running tests, rsync is enough.
> 
> As after all, the primary reasons for having the samples in git would
> be versioning, more concrete known states in a public archive (I would
> probably not call this a "backup", but it would mean we would have the
> history in multiple places at least), as well as - if we utilize
> something like git{lab,hub} - easier workflow to adding new samples by
> means of f.ex. merge/pull requests.
> 
> This idea originated from looking at how the dav1d project handled
> their reference sample suite, which seems to have served them well
> enough: https://code.videolan.org/videolan/dav1d-test-data
> 
> Regards,
> Jan

Is there any reason (besides efficiency hit) not to make the FATE repo
a `git submodule` of the FFmpeg git repo? That way, commits which depend
on certain additions to fate-samples can explicitly depend on the
commits adding those files, developers can more easily see (e.g. via
`git status`) if the fate samples are out-of-date (or use `git pull
--recurse-submodules` to automate the process).

It will also make the samples repo historically consistent, e.g. if
somebody changes a detail about a file in a later commit, older commits
referencing the unmodified version will continue passing FATE tests. I'm
not sure if this has ever been a concern in the past, but it may well
be one in the future.

Worrying about the performance impact of rsync vs git-lfs (or equivalent
solutions) seems like premature optimization to me; and the ease of
maintenance, historical consistency, transparency in process, and
end-user convenience of a git repository seems to far outweigh the
drawbacks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/jpeg2000dec: support of 2 fields in 1 AVPacket

2024-02-21 Thread Jerome Martinez

On 21/02/2024 14:11, Tomas Härdin wrote:


mxfdec can detect cases where there will be two separate fields in one
KLV,


In practice the issue is not to detect I2 case in mxfdec (it saves us 
only a little during probing of the first frame, but I could add such 
signaling in a patch after this one because it is actually independent 
from the management of 2 fields in the decoder if we want to support 
buggy files), the issue is to split per field in mxfdec.


SMPTE ST 422 extracts:
"Users are cautioned that the code values for SOC and EOC are not 
protected and can occur within the image size marker segment (SIZ), 
quantization marker segment (QCD), comment marker segment (COM) and 
other places."
"Decoders can derive the bytestream offsets of each field by analysing 
the code stream format within the essence element as described in 
ISO/IEC 15444-1."


Note that this MXF + jp2k spec hints that separating fields should be 
done in the decoder, not the demuxer.
It is impossible to split per field in a codec-neutral manner due to 
lack of metadata for that in MXF, and doing that in mxfdec implies to 
duplicate jp2k header parser code in mxfdec, and to add a similar parser 
per supported video format in the future.



and the decoder(s) can if I'm not mistaken be instructed to decode
into an AVFrame with stride and offset set up for interlaced decoding.



I checked the MPEG-2 Video decoder and it does not do what you say, it 
does what I do with this patch:
- mpegvideo_parser (so the parser of raw files, equivalent to mxfdec) 
understands that the stream has 2 separate fields and puts them in 1 
single AVPacket. It could separate them put it doesn't.
- mpeg12dec (equivalent to jpeg2000dec) understands that there are 2 
separate fields and applies a stride and offset internally and outputs a 
frame in AVFrame, not a field. It could provide fields but it doesn't.
I checked only what I know well, MPEG-2 Video, maybe it is done the way 
you indicate elsewhere, currently I see no example about the idea 
that stride and offset should be provided by the demuxer, would you mind 
to show some code in FFmpeg doing this way?
And stride and offset in signaling would mean that the target decoder 
must support stride and offset in signaling (including jpeg2000dec so 
getting a part of my current patch anyway), so no more "universal" as 
far as I understand.


Also:
Other comments say that AVPacket is expected to receive the packet as it 
in the container so no split of packet.
Other comments say that AVFrame is expected to receive a frame and 
never, at least for the moment, a field.
I don't see how to respect theses 2 indications, while 
mpegvideo_parser.c + mpeg12dec.c are conforming to theses indications 
because they do as in this patch.


My understanding of other comments is that my patch proposal is the 
right way to do it, I am lost here with contradictions in the indicated 
path for the support of such file.

e.g. https://ffmpeg.org/pipermail/ffmpeg-devel/2024-February/321540.html


It should be possible to have ffmpeg set up the necessary plumbing for
this.


But is it how it works elsewhere in FFmpeg? Would such complex and deep 
modifications be accepted by others?
Please confirm that it would be accepted before I go so deep in the 
changes of FFmpeg code, or please indicate where such tip is already 
stored in codec context.
And it is not only plumbing, it is implementing a jp2k parser in mxfdec 
for splitting fields, impossible otherwise to split the fields and it is 
NOT for all codec at once (which is impossible in practice due to the 
need to have codec dependent split of fields).


And in practice, what it the inconvenience to do this way, with very few 
modifications and in a similar manner of what is done elsewhere in 
FFmpeg with separate fields?
Especially with patch v2 which adds nearly (a couple of comparisons 
between integers) no performance impact to previously supported content.


As a summary, IMO this patch is conform to what is done elsewhere in 
FFmpeg for separated fiels e.g. in mpeg12dec and is conform to what is 
hinted in the specification by checking the 2nd codestream offset in the 
decoder rather than in the demuxer.


Jérôme
___
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] [MXF] - Add "footer_with_hmd" option

2024-02-21 Thread Tomas Härdin
ons 2024-02-21 klockan 08:47 +0100 skrev Cédric Le Barz:
> 
> 
> -Message d'origine-
> De : ffmpeg-devel  De la part de
> Tomas Härdin
> Envoyé : lundi 19 février 2024 11:40
> À : FFmpeg development discussions and patches
> 
> Objet : Re: [FFmpeg-devel] [PATCH] [MXF] - Add "footer_with_hmd"
> option
> 
> fre 2024-02-09 klockan 11:58 +0100 skrev Cédric Le Barz:
> > Add "footer_with_hmd" option: this option activates the writing of
> > the 
> > header metadata in the footer partition.
> 
> Sounds useful for writing MXF to a stream.
> 
> Could use a test.
> 
> /Tomas
> ___
> 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".
> 
> 
> 
> 
> Hi Tomas,
> 
> What do you mean by "Could you a test.".
> Thanks,

I mean a test that uses the option and then we check the hash of the
output so that we don't have regressions in the future.

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/jpeg2000dec: support of 2 fields in 1 AVPacket

2024-02-21 Thread Tomas Härdin
This is still J2K specific rather than handling it properly for all
codecs all at once.

mxfdec can detect cases where there will be two separate fields in one
KLV, and the decoder(s) can if I'm not mistaken be instructed to decode
into an AVFrame with stride and offset set up for interlaced decoding.

It should be possible to have ffmpeg set up the necessary plumbing for
this.

/Tomas
___
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] [RFC] fate rsync switch to git

2024-02-21 Thread Michael Niedermayer
On Wed, Feb 21, 2024 at 02:39:42AM +0100, Jean-Baptiste Kempf wrote:
> Yo,
> 
> On Tue, 20 Feb 2024, at 15:31, Michael Niedermayer wrote:
> > I did hear (at fosdem?)
> > about the idea to switch from rsync to git for managing the fate samples
> > i thought the idea sounds interresting but isnt rsync more efficient ?
> 
> Yes, that's my idea.
> 
> The git part is not for others clients to sync, but just to manage the 
> samples.
> 
> It allows to have versioning of the samples, with the extra ability to have 
> branches and tags matching the ffmpeg branches.

versioning is fine

branches, we did not need, and adding branches sounds like a solution
searching for a problem


> It avoids the weird dance "waiting for FATE admin to upload thing", because 
> their would be multiple approvers/committers to that repo.

we have 15 people in the samples group that have the power to upload samples,
the bottleneck is that only 2 of them actual do upload and noone else is
volunteering


> It simplifies the workflow on the admin side, since with a git hook, the 
> server does "git update" in the directory that will be rsync'd by the 
> mirrors. And it does not change their workflow, still using rsync.

It still requires people to push the new sample to git and that git is
a different architecture than how the samples normally where downloaded if you
keep rsync

I mean everyone has a rsync based checkout like now for "make fate"
updating with "make fate-rsync"

they add a sample to this and then they have no git to push that to
cuz, no .git directory is there.
This can be handled in a few ways but it mainly seems messy

what i suggest is that someone adds a
make fate-rsync-upload
that runs the rsync command
that way the other people who actually have fate samlpe upload rights
actually do the upload after testing a patch instead of waiting for 2 people
to do it.

Such "fate-rsync-upload" is easy and needs no change to architecture it also
doesnt make any future change to architecture any more difficult
so i suggets that to be done together with people volunteering to do fate sample
uploads themselfs if they freuqently review/approve patches that need such 
uploads

If people prefer switching to git then we need an volunteer to write and test 
the
related hook(s). I can create a git repo for it
Iam mainly hesitant now because it seems an additional layer not replacing a 
layer

thx

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
than the original author, trying to rewrite it will not make it better.


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 v2 1/2] avdevice: deprecate opengl outdev

2024-02-21 Thread Lynne
Feb 21, 2024, 12:34 by j...@itanimul.li:

> Signed-off-by: J. Dekker 
> ---
>  doc/outdevs.texi|  2 +-
>  libavdevice/opengl_enc.c| 11 +++
>  libavdevice/version_major.h |  2 ++
>  3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/doc/outdevs.texi b/doc/outdevs.texi
> index f0484bbf8f..941429a8c8 100644
> --- a/doc/outdevs.texi
> +++ b/doc/outdevs.texi
> @@ -302,7 +302,7 @@ ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev 
> /dev/fb0
>  See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
>

We have removed demuxers and decoders before without a deprecation period.
I think we should do the same here, as it is just a muxer.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/aarch64: add hevc deblock NEON

2024-02-21 Thread Martin Storsjö

On Wed, 21 Feb 2024, J. Dekker wrote:


Benched using single-threaded full decode on an Ampere Altra.

Bpp Before  After  Speedup
8   73,3s   65,2s  1.124x
10  114,2s  104,0s 1.098x
12  125,8s  115,7s 1.087x

Signed-off-by: J. Dekker 
---
libavcodec/aarch64/hevcdsp_deblock_neon.S | 421 ++
libavcodec/aarch64/hevcdsp_init_aarch64.c |  18 +
2 files changed, 439 insertions(+)



+0:  // STRONG FILTER
+
+// P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - 
p0, -tc3, tc3);
+add v21.8h, v2.8h, v3.8h   // (p1 + p0
+add v21.8h, v4.8h, v21.8h  // + q0)
+shl v21.8h, v21.8h, #1 //   * 2
+add v22.8h, v1.8h, v5.8h   //   (p2 + q1)
+add v21.8h, v22.8h, v21.8h // +
+srshrv21.8h, v21.8h, #3 //   >> 3
+sub v21.8h, v21.8h, v3.8h  //- p0
+


The srshr line is incorrectly indented here (and elsewhere)


+sqxtun  v4.8b, v4.8h
+sqxtun  v5.8b, v5.8h
+sqxtun  v6.8b, v6.8h
+sqxtun  v7.8b, v7.8h
+.endif
+ret
+3:  ret x6


Please indent the "x6" here like other operands


+.macro hevc_loop_filter_luma dir bitdepth
+function ff_hevc_\dir\()_loop_filter_luma_\bitdepth\()_neon, export=1
+mov x6, x30
+.if \dir == v


In GAS assembler, .if does a numerical comparison - it can't do string 
comparisons.


The right way to do this is to do ".ifc \dir, v", which does a string 
comparison.


(If you really do need to do this like a numerical comparison, it's 
possible to define e.g. "v" as a numeric symbol as well, see e.g. 
https://code.videolan.org/videolan/dav1d/-/merge_requests/1603/diffs?commit_id=d4746c908c56cb2e8545efd348b8cdc13f2f2253 
but that's not really the nicest way to do it.)


This issue breaks compilation with Clang. With gas-preprocessor (for 
MSVC), it manages to build correctly, but does the wrong thing.



To avoid me having to test all these build configurations manually, 
remembering to check all these corner case build configurations and check 
indentation and all, I've set up a PoC for testing such things on Github 
Actions.


If you have a repo on github, grab my commits from 
https://github.com/mstorsjo/FFmpeg/commits/gha-aarch64 (there are a couple 
of them), add your changes on top of these, and push it as a branch to 
your own github repo, then check the output from the actions.


Here's the output of a run with the patches you just posted: 
https://github.com/mstorsjo/FFmpeg/actions/runs/7988312683


// 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".


[FFmpeg-devel] [PATCH v2 2/2] avdevice: deprecate sdl outdev

2024-02-21 Thread J. Dekker
Signed-off-by: J. Dekker 
---
 doc/outdevs.texi|  8 +++-
 libavdevice/sdl2.c  | 10 ++
 libavdevice/version_major.h |  2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index 941429a8c8..9ee857528e 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -408,7 +408,13 @@ ffmpeg  -i INPUT -f pulse "stream name"
 
 @section sdl
 
-SDL (Simple DirectMedia Layer) output device.
+SDL (Simple DirectMedia Layer) output device. Deprecated and will be removed.
+
+For monitoring purposes in FFmpeg, pipes and a video player such as ffplay can 
be used:
+
+@example
+ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -
+@end example
 
 "sdl2" can be used as alias for "sdl".
 
diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c
index 342a253dc0..ec3c3d19b5 100644
--- a/libavdevice/sdl2.c
+++ b/libavdevice/sdl2.c
@@ -51,6 +51,7 @@ typedef struct {
 SDL_Rect texture_rect;
 
 int inited;
+int warned;
 } SDLContext;
 
 static const struct sdl_texture_format_entry {
@@ -165,6 +166,15 @@ static int sdl2_write_header(AVFormatContext *s)
 int i, ret = 0;
 int flags  = 0;
 
+if (!sdl->warned) {
+av_log(sdl, AV_LOG_WARNING,
+"The sdl output device is deprecated due to being fundamentally 
incompatible with libavformat API. "
+"For monitoring purposes in ffmpeg you can output to a file or use 
pipes and a video player.\n"
+"Example: ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -\n"
+);
+sdl->warned = 1;
+}
+
 if (!sdl->window_title)
 sdl->window_title = av_strdup(s->url);
 
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index da5854ed4c..6e04e0939d 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -37,5 +37,7 @@
 #define FF_API_BKTR_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
 // reminder to remove the opengl device on next major bump
 #define FF_API_OPENGL_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
+// reminder to remove the sdl2 device on next major bump
+#define FF_API_SDL2_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
 
 #endif /* AVDEVICE_VERSION_MAJOR_H */
-- 
2.43.2

___
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 v2 1/2] avdevice: deprecate opengl outdev

2024-02-21 Thread J. Dekker
Signed-off-by: J. Dekker 
---
 doc/outdevs.texi|  2 +-
 libavdevice/opengl_enc.c| 11 +++
 libavdevice/version_major.h |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index f0484bbf8f..941429a8c8 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -302,7 +302,7 @@ ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev 
/dev/fb0
 See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
 
 @section opengl
-OpenGL output device.
+OpenGL output device. Deprecated and will be removed.
 
 To enable this output device you need to configure FFmpeg with 
@code{--enable-opengl}.
 
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index b2ac6eb16a..69de6fad03 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -224,6 +224,8 @@ typedef struct OpenGLContext {
 int picture_height;///< Rendered height
 int window_width;
 int window_height;
+
+int warned;
 } OpenGLContext;
 
 static const struct OpenGLFormatDesc {
@@ -1060,6 +1062,15 @@ static av_cold int opengl_write_header(AVFormatContext 
*h)
 AVStream *st;
 int ret;
 
+if (!opengl->warned) {
+av_log(opengl, AV_LOG_WARNING,
+"The opengl output device is deprecated due to being fundamentally 
incompatible with libavformat API. "
+"For monitoring purposes in ffmpeg you can output to a file or use 
pipes and a video player.\n"
+"Example: ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -\n"
+);
+opengl->warned = 1;
+}
+
 if (h->nb_streams != 1 ||
 par->codec_type != AVMEDIA_TYPE_VIDEO ||
 (par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME && par->codec_id != 
AV_CODEC_ID_RAWVIDEO)) {
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index 9f7b79b2ee..da5854ed4c 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -35,5 +35,7 @@
 
 // reminder to remove the bktr device on next major bump
 #define FF_API_BKTR_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
+// reminder to remove the opengl device on next major bump
+#define FF_API_OPENGL_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
 
 #endif /* AVDEVICE_VERSION_MAJOR_H */
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 3/3] avcodec/aarch64: add hevc deblock NEON

2024-02-21 Thread J. Dekker
Benched using single-threaded full decode on an Ampere Altra.

Bpp Before  After  Speedup
8   73,3s   65,2s  1.124x
10  114,2s  104,0s 1.098x
12  125,8s  115,7s 1.087x

Signed-off-by: J. Dekker 
---
 libavcodec/aarch64/hevcdsp_deblock_neon.S | 421 ++
 libavcodec/aarch64/hevcdsp_init_aarch64.c |  18 +
 2 files changed, 439 insertions(+)

diff --git a/libavcodec/aarch64/hevcdsp_deblock_neon.S 
b/libavcodec/aarch64/hevcdsp_deblock_neon.S
index 8227f65649..1995f21807 100644
--- a/libavcodec/aarch64/hevcdsp_deblock_neon.S
+++ b/libavcodec/aarch64/hevcdsp_deblock_neon.S
@@ -181,3 +181,424 @@ hevc_h_loop_filter_chroma 12
 hevc_v_loop_filter_chroma 8
 hevc_v_loop_filter_chroma 10
 hevc_v_loop_filter_chroma 12
+
+.macro hevc_loop_filter_luma_body bitdepth
+function hevc_loop_filter_luma_body_\bitdepth\()_neon, export=0
+.if \bitdepth > 8
+lsl w2, w2, #(\bitdepth - 8) // beta <<= BIT_DEPTH - 8
+.else
+uxtlv0.8h, v0.8b
+uxtlv1.8h, v1.8b
+uxtlv2.8h, v2.8b
+uxtlv3.8h, v3.8b
+uxtlv4.8h, v4.8b
+uxtlv5.8h, v5.8b
+uxtlv6.8h, v6.8b
+uxtlv7.8h, v7.8b
+.endif
+ldr w7, [x3] // tc[0]
+ldr w8, [x3, #4] // tc[1]
+dup v18.4h, w7
+dup v19.4h, w8
+trn1v18.2d, v18.2d, v19.2d
+.if \bitdepth > 8
+shl v18.8h, v18.8h, #(\bitdepth - 8)
+.endif
+dup v27.8h, w2 // beta
+// tc25
+shl v19.8h, v18.8h, #2 // * 4
+add v19.8h, v19.8h, v18.8h // (tc * 5)
+srshr   v19.8h, v19.8h, #1 // (tc * 5 + 1) >> 1
+sshrv17.8h, v27.8h, #2 // beta2
+
+// beta_2 check
+// dp0  = abs(P2  - 2 * P1  + P0)
+add v22.8h, v3.8h, v1.8h
+shl v23.8h, v2.8h, #1
+sabdv30.8h, v22.8h, v23.8h
+// dq0  = abs(Q2  - 2 * Q1  + Q0)
+add v21.8h, v6.8h, v4.8h
+shl v26.8h, v5.8h, #1
+sabdv31.8h, v21.8h, v26.8h
+// d0   = dp0 + dq0
+add v20.8h, v30.8h, v31.8h
+shl v25.8h, v20.8h, #1
+// (d0 << 1) < beta_2
+cmgtv23.8h, v17.8h, v25.8h
+
+// beta check
+// d0 + d3 < beta
+mov x9, #0x
+dup v24.2d, x9
+and v25.16b, v24.16b, v20.16b
+addpv25.8h, v25.8h, v25.8h // 1+0 0+1 1+0 0+1
+addpv25.4h, v25.4h, v25.4h // 1+0+0+1 1+0+0+1
+cmgtv25.4h, v27.4h, v25.4h // lower/upper mask in h[0/1]
+mov w9, v25.s[0]
+cmp w9, #0
+sxtlv26.4s, v25.4h
+sxtlv16.2d, v26.2s // full skip mask
+b.eq3f // skip both blocks
+
+// TODO: we can check the full skip mask with the weak/strong mask to
+// potentially skip weak or strong calculation entirely if we only 
have one
+
+// beta_3 check
+// abs(P3  -  P0) + abs(Q3  -  Q0) < beta_3
+sshrv17.8h, v17.8h, #1 // beta_3
+sabdv20.8h, v0.8h, v3.8h
+sabav20.8h, v7.8h, v4.8h
+cmgtv21.8h, v17.8h, v20.8h
+
+and v23.16b, v23.16b, v21.16b
+
+// tc25 check
+// abs(P0  -  Q0) < tc25
+sabdv20.8h, v3.8h, v4.8h
+cmgtv21.8h, v19.8h, v20.8h
+
+and v23.16b, v23.16b, v21.16b
+
+// Generate low/high line max from lines 0/3/4/7
+// mask out lines 2/3/5/6
+not v20.16b, v24.16b // 0x
+orr v23.16b, v23.16b, v20.16b
+
+// generate weak/strong mask
+uminp   v23.8h, v23.8h, v23.8h // extend to singles
+sxtlv23.4s, v23.4h
+uminp   v26.4s, v23.4s, v23.4s // check lines
+// extract to gpr
+ext v25.16b, v26.16b, v26.16b, #2
+zip1v17.4s, v26.4s, v26.4s
+mov w12, v25.s[0]
+mov w11, #0x
+mov w13, #0x
+//   -> strong strong
+//   -> strong weak
+//   -> weak   strong
+//   -> weak   weak
+cmp w12, w13
+b.hi0f // only strong/strong, skip weak nd_p/nd_q calc
+
+// weak nd_p/nd_q
+// d0+d3
+and v30.16b, v30.16b, v24.16b // d0 __ __ d3 d4 __ __ d7
+and v31.16b, v31.16b, v24.16b
+addpv30.8h, v30.8h, v30.8h // [d0+__ __+d3 d4+__ __+d7] [ 
... ]
+addp

[FFmpeg-devel] [PATCH 2/3] avcodec/x86: disable hevc 12b luma deblock

2024-02-21 Thread J. Dekker
Over/underflow in some cases.

Signed-off-by: J. Dekker 
---
 libavcodec/x86/hevcdsp_init.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/x86/hevcdsp_init.c b/libavcodec/x86/hevcdsp_init.c
index 31e81eb11f..11cb1b3bfd 100644
--- a/libavcodec/x86/hevcdsp_init.c
+++ b/libavcodec/x86/hevcdsp_init.c
@@ -1205,10 +1205,11 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int 
bit_depth)
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->hevc_v_loop_filter_chroma = 
ff_hevc_v_loop_filter_chroma_12_sse2;
 c->hevc_h_loop_filter_chroma = 
ff_hevc_h_loop_filter_chroma_12_sse2;
-if (ARCH_X86_64) {
-c->hevc_v_loop_filter_luma = 
ff_hevc_v_loop_filter_luma_12_sse2;
-c->hevc_h_loop_filter_luma = 
ff_hevc_h_loop_filter_luma_12_sse2;
-}
+// FIXME: 12-bit luma deblock over/underflows in some cases
+// if (ARCH_X86_64) {
+// c->hevc_v_loop_filter_luma = 
ff_hevc_v_loop_filter_luma_12_sse2;
+// c->hevc_h_loop_filter_luma = 
ff_hevc_h_loop_filter_luma_12_sse2;
+// }
 SAO_BAND_INIT(12, sse2);
 SAO_EDGE_INIT(12, sse2);
 
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 1/3] checkasm/hevc_deblock: add luma and chroma full

2024-02-21 Thread J. Dekker
Signed-off-by: J. Dekker 
---
 tests/checkasm/hevc_deblock.c | 246 +-
 1 file changed, 215 insertions(+), 31 deletions(-)

diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c
index 66fc8d5646..91e57f5cf5 100644
--- a/tests/checkasm/hevc_deblock.c
+++ b/tests/checkasm/hevc_deblock.c
@@ -19,9 +19,9 @@
 #include 
 
 #include "libavutil/intreadwrite.h"
+#include "libavutil/macros.h"
 #include "libavutil/mem_internal.h"
 
-#include "libavcodec/avcodec.h"
 #include "libavcodec/hevcdsp.h"
 
 #include "checkasm.h"
@@ -29,10 +29,11 @@
 static const uint32_t pixel_mask[3] = { 0x, 0x03ff03ff, 0x0fff0fff };
 
 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
-#define BUF_STRIDE (8 * 2)
-#define BUF_LINES (8)
-#define BUF_OFFSET (BUF_STRIDE * BUF_LINES)
-#define BUF_SIZE (BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2)
+#define BUF_STRIDE (16 * 2)
+#define BUF_LINES (16)
+// large buffer sizes based on high bit depth
+#define BUF_OFFSET (2 * BUF_STRIDE * BUF_LINES)
+#define BUF_SIZE (2 * BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2)
 
 #define randomize_buffers(buf0, buf1, size) \
 do {\
@@ -45,57 +46,240 @@ static const uint32_t pixel_mask[3] = { 0x, 
0x03ff03ff, 0x0fff0fff };
 }   \
 } while (0)
 
-static void check_deblock_chroma(HEVCDSPContext *h, int bit_depth)
+static void check_deblock_chroma(HEVCDSPContext *h, int bit_depth, int c)
 {
-int32_t tc[2] = { 0, 0 };
+// see tctable[] in hevc_filter.c, we check full range
+int32_t tc[2] = { rnd() % 25, rnd() % 25 };
 // no_p, no_q can only be { 0,0 } for the simpler assembly (non *_c
 // variant) functions, see deblocking_filter_CTB() in hevc_filter.c
-uint8_t no_p[2] = { 0, 0 };
-uint8_t no_q[2] = { 0, 0 };
+uint8_t no_p[2] = { rnd() & c, rnd() & c };
+uint8_t no_q[2] = { rnd() & c, rnd() & c };
 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
 
 declare_func(void, uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t 
*no_p, uint8_t *no_q);
 
-if (check_func(h->hevc_h_loop_filter_chroma, 
"hevc_h_loop_filter_chroma%d", bit_depth)) {
-for (int i = 0; i < 4; i++) {
-randomize_buffers(buf0, buf1, BUF_SIZE);
-// see betatable[] in hevc_filter.c
-tc[0] = (rnd() & 63) + (rnd() & 1);
-tc[1] = (rnd() & 63) + (rnd() & 1);
+if (check_func(c ? h->hevc_h_loop_filter_chroma_c : 
h->hevc_h_loop_filter_chroma,
+ "hevc_h_loop_filter_chroma%d%s", bit_depth, c ? 
"_full" : ""))
+{
+randomize_buffers(buf0, buf1, BUF_SIZE);
 
-call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
-call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+if (memcmp(buf0, buf1, BUF_SIZE))
+fail();
+bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+}
+
+if (check_func(c ? h->hevc_v_loop_filter_chroma_c : 
h->hevc_v_loop_filter_chroma,
+ "hevc_v_loop_filter_chroma%d%s", bit_depth, c ? 
"_full" : ""))
+{
+randomize_buffers(buf0, buf1, BUF_SIZE);
+
+call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+if (memcmp(buf0, buf1, BUF_SIZE))
+fail();
+bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
+}
+}
+
+#define P3 buf[-4 * xstride]
+#define P2 buf[-3 * xstride]
+#define P1 buf[-2 * xstride]
+#define P0 buf[-1 * xstride]
+#define Q0 buf[0 * xstride]
+#define Q1 buf[1 * xstride]
+#define Q2 buf[2 * xstride]
+#define Q3 buf[3 * xstride]
+
+#define TC25(x) ((tc[x] * 5 + 1) >> 1)
+#define MASK(x) (uint16_t)(x & ((1 << (bit_depth)) - 1))
+#define GET(x) ((SIZEOF_PIXEL == 1) ? *(uint8_t*)() : *(uint16_t*)())
+#define SET(x, y) do { \
+uint16_t z = MASK(y); \
+if (SIZEOF_PIXEL == 1) \
+*(uint8_t*)() = z; \
+else \
+*(uint16_t*)() = z; \
+} while (0)
+#define RANDCLIP(x, diff) av_clip(GET(x) - (diff), 0, \
+(1 << (bit_depth)) - 1) + rnd() % FFMAX(2 * (diff), 1)
+
+// NOTE: this function doesn't work 'correctly' in that it won't always choose
+// strong/strong or weak/weak, in most cases it tends to but will sometimes mix
+// weak/strong or even skip sometimes. This is more useful to test correctness
+// for these functions, though it does make benching them difficult. The 
easiest
+// way to bench these functions is to check an overall decode since there are 
too
+// many paths and ways to trigger the deblock: we would have to bench all
+// permutations of weak/strong/skip/nd_q/nd_p/no_q/no_p and it quickly becomes
+// too much.
+static void 

[FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg_sched: remove a triggerable assert in send_to_enc_sq()

2024-02-21 Thread Anton Khirnov
It can be triggered when send_to_enc_thread() returns AVERROR(ENOMEM).
Propagate the error to the caller instead.

Reported-by: Andreas Rheinhardt
---
 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, >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 = >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, >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(>lock);
 
-- 
2.42.0

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

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


[FFmpeg-devel] [PATCH 1/3] fftools/ffmpeg: declare loop indices inside loops

2024-02-21 Thread Anton Khirnov
---
 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([i]);
 av_freep();
 
-for (i = 0; i < nb_output_files; i++)
+for (int i = 0; i < nb_output_files; i++)
 of_free(_files[i]);
 
-for (i = 0; i < nb_input_files; i++)
+for (int i = 0; i < nb_input_files; i++)
 ifile_close(_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, _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 = >st->codecpar->coded_side_data[i];
 if (sd_src->type != AV_PKT_DATA_CPB_PROPERTIES) {
 AVPacketSideData *sd_dst = 
av_packet_side_data_new(>par_in->coded_side_data,
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 79cc101fb6..4731c78ba0 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -330,7 +330,7 

[FFmpeg-devel] [PATCH 2/3] fftools/ffmpeg_sched: simplify failure path in sch_dec_send()

2024-02-21 Thread Anton Khirnov
---
 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)
-- 
2.42.0

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

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


[FFmpeg-devel] [PATCH] fftools/ffmpeg: remove options deprecated before 6.0

2024-02-21 Thread Anton Khirnov
---
 Changelog |   1 +
 doc/ffmpeg.texi   |  75 ---
 fftools/ffmpeg.h  |  31 --
 fftools/ffmpeg_filter.c   |  14 -
 fftools/ffmpeg_mux.c  |   5 --
 fftools/ffmpeg_mux_init.c |  75 +--
 fftools/ffmpeg_opt.c  | 122 --
 tests/fate/ffmpeg.mak |  25 
 8 files changed, 3 insertions(+), 345 deletions(-)

diff --git a/Changelog b/Changelog
index 610ee61dd6..ab95a4b730 100644
--- a/Changelog
+++ b/Changelog
@@ -27,6 +27,7 @@ version :
 - a C11-compliant compiler is now required; note that this requirement
   will be bumped to C17 in the near future, so consider updating your
   build environment if it lacks C17 support
+- removed deprecated ffmpeg CLI options -psnr and -map_channel
 
 version 6.1:
 - libaribcaption decoder
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 5a214dd139..bee3cd4c70 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1230,10 +1230,6 @@ list separated with slashes. Two first values are the 
beginning and
 end frame numbers, last one is quantizer to use if positive, or quality
 factor if negative.
 
-@item -psnr
-Calculate PSNR of compressed frames. This option is deprecated, pass the
-PSNR flag to the encoder instead, using @code{-flags +psnr}.
-
 @item -vstats
 Dump video coding statistics to @file{vstats_HHMMSS.log}. See the
 @ref{vstats_file_format,,vstats file format} section for the format 
description.
@@ -1806,77 +1802,6 @@ such streams is attempted.
 Allow input streams with unknown type to be copied instead of failing if 
copying
 such streams is attempted.
 
-@item -map_channel 
[@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][?][:@var{output_file_id}.@var{stream_specifier}]
-This option is deprecated and will be removed. It can be replaced by the
-@var{pan} filter. In some cases it may be easier to use some combination of the
-@var{channelsplit}, @var{channelmap}, or @var{amerge} filters.
-
-Map an audio channel from a given input to an output. If
-@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will
-be mapped on all the audio streams.
-
-Using "-1" instead of
-@var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted
-channel.
-
-A trailing @code{?} will allow the map_channel to be
-optional: if the map_channel matches no channel the map_channel will be 
ignored instead
-of failing.
-
-For example, assuming @var{INPUT} is a stereo audio file, you can switch the
-two audio channels with the following command:
-@example
-ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
-@end example
-
-If you want to mute the first channel and keep the second:
-@example
-ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT
-@end example
-
-The order of the "-map_channel" option specifies the order of the channels in
-the output stream. The output channel layout is guessed from the number of
-channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac"
-in combination of "-map_channel" makes the channel gain levels to be updated if
-input and output channel layouts don't match (for instance two "-map_channel"
-options and "-ac 6").
-
-You can also extract each channel of an input to specific outputs; the 
following
-command extracts two channels of the @var{INPUT} audio stream (file 0, stream 
0)
-to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs:
-@example
-ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
-@end example
-
-The following example splits the channels of a stereo input into two separate
-streams, which are put into the same output file:
-@example
-ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 
0.0.1:0.1 -y out.ogg
-@end example
-
-Note that currently each output stream can only contain channels from a single
-input stream; you can't for example use "-map_channel" to pick multiple input
-audio channels contained in different streams (from the same or different 
files)
-and merge them into a single output stream. It is therefore not currently
-possible, for example, to turn two separate mono streams into a single stereo
-stream. However splitting a stereo stream into two single channel mono streams
-is possible.
-
-If you need this feature, a possible workaround is to use the @emph{amerge}
-filter. For example, if you need to merge a media (here @file{input.mkv}) with 
2
-mono audio streams into one single stereo channel audio stream (and keep the
-video stream), you can use the following command:
-@example
-ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v 
copy output.mkv
-@end example
-
-To map the first two audio channels from the first input, and using the
-trailing @code{?}, ignore the audio channel mapping if the first input is
-mono instead of stereo:
-@example
-ffmpeg -i INPUT -map_channel 0.0.0 -map_channel 0.0.1? OUTPUT
-@end example
-
 

Re: [FFmpeg-devel] [PATCH] checkasm: Add a "run-checkasm" make target

2024-02-21 Thread Martin Storsjö

On Wed, 14 Feb 2024, Martin Storsjö wrote:


Contrary to the existing "fate-checkasm", this always prints the
tool output, and runs all tests at once instead of splitting it up
per target group. This is more useful when the user expects to
look directly at the tool output, instead of being part of a full
fate run.

(On failure with the regular "make fate-checkasm" targets, none of
the tool output is printed, but stored in files. If run with reporting
set up to the FATE website, the individual failures are uploaded there,
but if it is run in some sort of other CI setup, the intermediate files
might not be available afterwards for inspection.)
---
tests/checkasm/Makefile | 4 
1 file changed, 4 insertions(+)

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 3562acb2b2..3af42a679b 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -91,6 +91,10 @@ CHECKASM := tests/checkasm/checkasm$(EXESUF)
$(CHECKASM): $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(CHECKASMOBJS) 
$(FF_STATIC_DEP_LIBS) $(EXTRALIBS-avcodec) $(EXTRALIBS-avfilter) 
$(EXTRALIBS-avformat) $(EXTRALIBS-avutil) $(EXTRALIBS-swresample) $(EXTRALIBS)

+run-checkasm: $(CHECKASM)
+run-checkasm:
+   $(TARGET_EXEC) $(TARGET_PATH)/$(CHECKASM)


I've amended this locally with a $(Q) at the start, to silence the 
executed command, unless executed with V=1.


I'll push this patch later today if there aren't any objections.

// 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] [MXF] - Add "footer_with_hmd" option

2024-02-21 Thread Cédric Le Barz


-Message d'origine-
De : ffmpeg-devel  De la part de Tomas Härdin
Envoyé : lundi 19 février 2024 11:40
À : FFmpeg development discussions and patches 
Objet : Re: [FFmpeg-devel] [PATCH] [MXF] - Add "footer_with_hmd" option

fre 2024-02-09 klockan 11:58 +0100 skrev Cédric Le Barz:
> Add "footer_with_hmd" option: this option activates the writing of the 
> header metadata in the footer partition.

Sounds useful for writing MXF to a stream.

Could use a test.

/Tomas
___
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".




Hi Tomas,

What do you mean by "Could you a test.".
Thanks,

Cédric

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