From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: benjamin.bross@hhi.fraunhofer.de, Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/vvcdec: misc, move src offset inside emulated_edge
Date: Mon, 3 Jun 2024 20:51:13 +0800
Message-ID: <TYSPR06MB6433F41EF9AE715200C2C043AAFF2@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20240603125117.10791-1-nuomi2021@gmail.com>
---
libavcodec/vvc/inter.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c
index 0843c99eb6..07b55c4bac 100644
--- a/libavcodec/vvc/inter.c
+++ b/libavcodec/vvc/inter.c
@@ -57,6 +57,8 @@ static void emulated_edge(const VVCLocalContext *lc, uint8_t *dst,
const int dmvr_clip = x_sb != x_off || y_sb != y_off;
int pic_width, pic_height;
+ *src += y_off * *src_stride + (x_off * (1 << fc->ps.sps->pixel_shift));
+
subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_chroma);
subpic_offset(&x_sb, &y_sb, sps, pps, subpic_idx, is_chroma);
subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_chroma);
@@ -170,7 +172,6 @@ static void mc(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, const Mv
x_off += mv->x >> (4 + hs);
y_off += mv->y >> (4 + vs);
- src += y_off * src_stride + (x_off * (1 << fc->ps.sps->pixel_shift));
MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, x_off, y_off);
fc->vvcdsp.inter.put[is_chroma][idx][!!my][!!mx](dst, src, src_stride, block_h, hf, vf, block_w);
@@ -199,7 +200,6 @@ static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride
x_off += mv->x >> (4 + hs);
y_off += mv->y >> (4 + vs);
- src += y_off * src_stride + (x_off * (1 << fc->ps.sps->pixel_shift));
MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, x_off, y_off);
if (derive_weight_uni(&denom, &wx, &ox, lc, mvf, c_idx)) {
@@ -236,7 +236,7 @@ static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride,
const int oy = y_off + (mv->y >> (4 + vs));
const VVCFrame *ref = refs[i];
ptrdiff_t src_stride = ref->frame->linesize[c_idx];
- const uint8_t *src = ref->frame->data[c_idx] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift));
+ const uint8_t *src = ref->frame->data[c_idx];
const int8_t *hf = INTER_FILTER(hpel_if_idx, mx);
const int8_t *vf = INTER_FILTER(hpel_if_idx, my);
@@ -306,7 +306,6 @@ static void scaled_ref_pos_and_step(const VVCLocalContext *lc, const VVCRefPic *
static void emulated_edge_scaled(VVCLocalContext *lc, const uint8_t **src, ptrdiff_t *src_stride, int *src_height,
const VVCFrame *ref, const int x, const int y, const int dx, const int dy, const int w, const int h, const int is_chroma)
{
- const VVCFrameContext *fc = lc->fc;
const int x_off = SCALED_INT(x);
const int y_off = SCALED_INT(y);
const int x_end = SCALED_INT(x + w * dx);
@@ -316,8 +315,6 @@ static void emulated_edge_scaled(VVCLocalContext *lc, const uint8_t **src, ptrdi
const int block_w = x_end - x_off + (x_end == x_last);
const int block_h = *src_height = y_end - y_off + (y_end == y_last);
- *src += y_off * *src_stride + (x_off * (1 << fc->ps.sps->pixel_shift));
-
MC_EMULATED_EDGE(lc->edge_emu_buffer, src, src_stride, x_off, y_off);
}
@@ -414,7 +411,6 @@ static void luma_prof_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst
x_off += mv->x >> 4;
y_off += mv->y >> 4;
- src += y_off * src_stride + (x_off * (1 << fc->ps.sps->pixel_shift));
MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, x_off, y_off);
if (cb_prof_flag) {
@@ -444,8 +440,8 @@ static void luma_prof(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref,
const int idx = av_log2(block_w) - 1;
const int is_chroma = 0;
uint16_t *prof_tmp = lc->tmp2 + PROF_TEMP_OFFSET;
- ptrdiff_t src_stride = ref->frame->linesize[0];
- const uint8_t *src = ref->frame->data[0] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift));
+ ptrdiff_t src_stride = ref->frame->linesize[LUMA];
+ const uint8_t *src = ref->frame->data[LUMA];
const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx];
const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my];
@@ -704,7 +700,7 @@ static void dmvr_mv_refine(VVCLocalContext *lc, MvField *mvf, MvField *orig_mv,
const int oy = y_off + (mv->y >> 4) - sr_range;
const VVCFrame *ref = refs[i];
ptrdiff_t src_stride = ref->frame->linesize[LUMA];
- const uint8_t *src = ref->frame->data[LUMA] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift));
+ const uint8_t *src = ref->frame->data[LUMA];
MC_EMULATED_EDGE_BILINEAR(lc->edge_emu_buffer, &src, &src_stride, ox, oy);
fc->vvcdsp.inter.dmvr[!!my][!!mx](tmp[i], src, src_stride, pred_h, mx, my, pred_w);
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next parent reply other threads:[~2024-06-03 13:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240603125117.10791-1-nuomi2021@gmail.com>
2024-06-03 12:51 ` Nuo Mi [this message]
2024-06-03 12:51 ` [FFmpeg-devel] [PATCH 3/5] avcodec/vvcdec: refact out emulated_edge_no_wrap Nuo Mi
2024-06-03 12:51 ` [FFmpeg-devel] [PATCH 4/5] avcodec/vvcdec: misc, reindent inter.c Nuo Mi
2024-06-03 12:51 ` [FFmpeg-devel] [PATCH 5/5] avcodec/vvcdec: support mv wraparound Nuo Mi
2024-06-04 0:40 ` Michael Niedermayer
2024-06-04 12:11 ` Nuo Mi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TYSPR06MB6433F41EF9AE715200C2C043AAFF2@TYSPR06MB6433.apcprd06.prod.outlook.com \
--to=nuomi2021@gmail.com \
--cc=benjamin.bross@hhi.fraunhofer.de \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git