From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/hevcdec: Constify src pointers of HEVC DSP functions Date: Mon, 1 Aug 2022 15:09:20 +0200 Message-ID: <DB6PR0101MB2214F6F8BBD70BE95D94672F8F9A9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw) In-Reply-To: <DB6PR0101MB2214178D3E6B8DCA5B86F8198F9A9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> This is possible now that the HEVC DSP API treats them as const. Also constify the AVFrames whose data is used as source in such cases. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/hevcdec.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 9b14fa50f9..2ca0f7efca 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -1198,7 +1198,7 @@ static int hls_transform_unit(HEVCLocalContext *lc, int x0, int y0, ptrdiff_t stride = s->frame->linesize[1]; int hshift = s->ps.sps->hshift[1]; int vshift = s->ps.sps->vshift[1]; - int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer; + const int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer; int16_t *coeffs = (int16_t*)lc->edge_emu_buffer2; int size = 1 << log2_trafo_size_c; @@ -1228,7 +1228,7 @@ static int hls_transform_unit(HEVCLocalContext *lc, int x0, int y0, ptrdiff_t stride = s->frame->linesize[2]; int hshift = s->ps.sps->hshift[2]; int vshift = s->ps.sps->vshift[2]; - int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer; + const int16_t *coeffs_y = (int16_t*)lc->edge_emu_buffer; int16_t *coeffs = (int16_t*)lc->edge_emu_buffer2; int size = 1 << log2_trafo_size_c; @@ -1492,11 +1492,11 @@ static int hls_pcm_sample(HEVCLocalContext *lc, int x0, int y0, int log2_cb_size */ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref, const Mv *mv, int x_off, int y_off, + const AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h, int luma_weight, int luma_offset) { const HEVCContext *const s = lc->parent; - uint8_t *src = ref->data[0]; + const uint8_t *src = ref->data[0]; ptrdiff_t srcstride = ref->linesize[0]; int pic_width = s->ps.sps->width; int pic_height = s->ps.sps->height; @@ -1553,8 +1553,9 @@ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, * @param current_mv current motion vector structure */ static void luma_mc_bi(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref0, const Mv *mv0, int x_off, int y_off, - int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) + const AVFrame *ref0, const Mv *mv0, int x_off, int y_off, + int block_w, int block_h, const AVFrame *ref1, + const Mv *mv1, struct MvField *current_mv) { const HEVCContext *const s = lc->parent; ptrdiff_t src0stride = ref0->linesize[0]; @@ -1573,8 +1574,8 @@ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, int y_off1 = y_off + (mv1->y >> 2); int idx = hevc_pel_weight[block_w]; - uint8_t *src0 = ref0->data[0] + y_off0 * src0stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); - uint8_t *src1 = ref1->data[0] + y_off1 * src1stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); + const uint8_t *src0 = ref0->data[0] + y_off0 * src0stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); + const uint8_t *src1 = ref1->data[0] + y_off1 * src1stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); if (x_off0 < QPEL_EXTRA_BEFORE || y_off0 < QPEL_EXTRA_AFTER || x_off0 >= pic_width - block_w - QPEL_EXTRA_AFTER || @@ -1644,7 +1645,7 @@ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, */ static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t *dst0, - ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, + ptrdiff_t dststride, const uint8_t *src0, ptrdiff_t srcstride, int reflist, int x_off, int y_off, int block_w, int block_h, const struct MvField *current_mv, int chroma_weight, int chroma_offset) { @@ -1709,12 +1710,13 @@ static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t *dst0, * @param current_mv current motion vector structure * @param cidx chroma component(cb, cr) */ -static void chroma_mc_bi(HEVCLocalContext *lc, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, +static void chroma_mc_bi(HEVCLocalContext *lc, uint8_t *dst0, ptrdiff_t dststride, + const AVFrame *ref0, const AVFrame *ref1, int x_off, int y_off, int block_w, int block_h, const MvField *current_mv, int cidx) { const HEVCContext *const s = lc->parent; - uint8_t *src1 = ref0->data[cidx+1]; - uint8_t *src2 = ref1->data[cidx+1]; + const uint8_t *src1 = ref0->data[cidx+1]; + const uint8_t *src2 = ref1->data[cidx+1]; ptrdiff_t src1stride = ref0->linesize[cidx+1]; ptrdiff_t src2stride = ref1->linesize[cidx+1]; int weight_flag = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || -- 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 prev parent reply other threads:[~2022-08-01 13:09 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-01 13:08 [FFmpeg-devel] [PATCH 1/3] avcodec/hevcdsp: Constify src pointers Andreas Rheinhardt 2022-08-01 13:09 ` Andreas Rheinhardt [this message] 2022-08-01 13:09 ` [FFmpeg-devel] [PATCH 3/3] avcodec/h264chroma: Constify src in h264_chroma_mc_func Andreas Rheinhardt
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=DB6PR0101MB2214F6F8BBD70BE95D94672F8F9A9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \ --to=andreas.rheinhardt@outlook.com \ --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