This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0e0c64c91d2e202db5ad1228497fb64741ccbfe6 Author: Rainbaby <[email protected]> AuthorDate: Mon Nov 9 16:22:03 2026 +0900 Commit: Rainbaby <[email protected]> CommitDate: Mon Nov 30 15:50:17 2026 +0900 avcodec/cavs: look up the chroma QP per plane AVS+ (GY/T 257.1-2012) can adjust the Cb and Cr quantization parameters separately by chroma_quant_param_delta_cb and chroma_quant_param_delta_cr in the picture header (9.6.1), and the loop filter then uses each plane's own QP for chroma edges (9.11). Keep both deltas in the context and look the chroma QP up per plane. The deltas are always zero for now, so the output does not change. Signed-off-by: Rainbaby <[email protected]> --- libavcodec/cavs.c | 22 ++++++++++++++++++++-- libavcodec/cavs.h | 10 ++++++++++ libavcodec/cavsdec.c | 7 ++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 72a3ce70ed..457899f0f3 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -105,6 +105,16 @@ static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) beta = beta_tab[av_clip_uintp2(qp_avg + h->beta_offset, 6)]; \ tc = tc_tab[av_clip_uintp2(qp_avg + h->alpha_offset, 6)]; +/** + * Average of the chroma QPs of the current block and a neighbour for the + * chroma edge between them (9.11). + */ +static inline int chroma_qp_avg(const AVSContext *h, int qp_nb, int plane) +{ + return (ff_cavs_chroma_qp_of(h, h->qp, plane) + + ff_cavs_chroma_qp_of(h, qp_nb, plane) + 1) >> 1; +} + /** * in-loop deblocking filter for a single macroblock * @@ -159,9 +169,13 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) qp_avg = (h->qp + h->left_qp + 1) >> 1; SET_PARAMS; h->cdsp.cavs_filter_lv(h->cy, h->l_stride, alpha, beta, tc, bs[0], bs[1]); - qp_avg = (ff_cavs_chroma_qp[h->qp] + ff_cavs_chroma_qp[h->left_qp] + 1) >> 1; + qp_avg = chroma_qp_avg(h, h->left_qp, 0); SET_PARAMS; h->cdsp.cavs_filter_cv(h->cu, h->c_stride, alpha, beta, tc, bs[0], bs[1]); + if (h->chroma_qp_delta[0] != h->chroma_qp_delta[1]) { + qp_avg = chroma_qp_avg(h, h->left_qp, 1); + SET_PARAMS; + } h->cdsp.cavs_filter_cv(h->cv, h->c_stride, alpha, beta, tc, bs[0], bs[1]); } qp_avg = h->qp; @@ -173,9 +187,13 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1; SET_PARAMS; h->cdsp.cavs_filter_lh(h->cy, h->l_stride, alpha, beta, tc, bs[4], bs[5]); - qp_avg = (ff_cavs_chroma_qp[h->qp] + ff_cavs_chroma_qp[h->top_qp[h->mbx]] + 1) >> 1; + qp_avg = chroma_qp_avg(h, h->top_qp[h->mbx], 0); SET_PARAMS; h->cdsp.cavs_filter_ch(h->cu, h->c_stride, alpha, beta, tc, bs[4], bs[5]); + if (h->chroma_qp_delta[0] != h->chroma_qp_delta[1]) { + qp_avg = chroma_qp_avg(h, h->top_qp[h->mbx], 1); + SET_PARAMS; + } h->cdsp.cavs_filter_ch(h->cv, h->c_stride, alpha, beta, tc, bs[4], bs[5]); } } diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h index acc33b0793..80f17397dd 100644 --- a/libavcodec/cavs.h +++ b/libavcodec/cavs.h @@ -220,6 +220,7 @@ typedef struct AVSContext { uint8_t *top_c_pred_mode; ///< IntraChromaPredMode above, per column int loop_filter_disable; int alpha_offset, beta_offset; + int chroma_qp_delta[2]; ///< chroma_quant_param_delta of Cb and Cr int ref_flag; int mbx, mby, mbidx; ///< macroblock coordinates int flags; ///< availability flags of neighbouring macroblocks @@ -308,6 +309,15 @@ typedef struct AVSContext { extern const uint8_t ff_cavs_chroma_qp[64]; extern const uint8_t ff_cavs_partition_flags[30]; +/** + * Chroma quantization parameter (9.6.1): table 61 indexed by CurrentQP plus + * the picture's chroma delta for @p plane (0 Cb, 1 Cr). + */ +static inline int ff_cavs_chroma_qp_of(const AVSContext *h, int qp, int plane) +{ + return ff_cavs_chroma_qp[qp + h->chroma_qp_delta[plane]]; +} + /** mark block as using intra prediction */ #define CAVS_DIR_MV (cavs_vector){ 0, 0, 1, REF_DIR, 0 } /** mark block as "no prediction from this direction" diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index ab168ba8ca..9ff2e50de1 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1147,16 +1147,17 @@ static int decode_residual(AVSContext *h, const struct dec_2dvlc *r, static inline int decode_residual_chroma(AVSContext *h) { - const int qp = ff_cavs_chroma_qp[h->qp]; + const int qp_cb = ff_cavs_chroma_qp_of(h, h->qp, 0); + const int qp_cr = ff_cavs_chroma_qp_of(h, h->qp, 1); int ret; if (h->cbp & (1 << 4)) { - ret = decode_residual(h, chroma_dec, 0, 1, qp, h->cu, h->c_stride); + ret = decode_residual(h, chroma_dec, 0, 1, qp_cb, h->cu, h->c_stride); if (ret < 0) return ret; } if (h->cbp & (1 << 5)) { - ret = decode_residual(h, chroma_dec, 0, 1, qp, h->cv, h->c_stride); + ret = decode_residual(h, chroma_dec, 0, 1, qp_cr, h->cv, h->c_stride); if (ret < 0) return ret; } -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
