From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH v2 42/71] avcodec/vc1_mc: Don't check AVFrame INTERLACE flags Date: Sat, 11 May 2024 22:51:06 +0200 Message-ID: <GV1P250MB07377F58B7A4C5D72DACBC9B8FE02@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB074471DDEA29072B2586F0EF8FE02@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> Instead cache these values in VC1Context to avoid the indirection and AND. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/vc1.h | 1 + libavcodec/vc1_mc.c | 20 +++++++++----------- libavcodec/vc1dec.c | 2 ++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 0e01458c89..185236662f 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -293,6 +293,7 @@ typedef struct VC1Context{ uint8_t next_luty[2][256], next_lutuv[2][256]; ///< lookup tables used for intensity compensation uint8_t (*curr_luty)[256] ,(*curr_lutuv)[256]; int last_use_ic, *curr_use_ic, next_use_ic, aux_use_ic; + int last_interlaced, next_interlaced; ///< whether last_pic, next_pic is interlaced int rnd; ///< rounding control int cbptab; diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index 90ff1eee58..fad9a4c370 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -233,7 +233,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) luty = v->last_luty; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } } else { srcY = s->next_pic.data[0]; @@ -242,7 +242,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) luty = v->next_luty; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } if (!srcY || !srcU) { @@ -482,13 +482,13 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) srcY = s->last_pic.data[0]; luty = v->last_luty; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } } else { srcY = s->next_pic.data[0]; luty = v->next_luty; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } if (!srcY) { @@ -708,14 +708,14 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) srcV = s->last_pic.data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } } else { srcU = s->next_pic.data[1]; srcV = s->next_pic.data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } if (!srcU) { @@ -884,13 +884,13 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) srcV = s->next_pic.data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } else { srcU = s->last_pic.data[1]; srcV = s->last_pic.data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } if (!srcU) return; @@ -1009,7 +1009,7 @@ void ff_vc1_interp_mc(VC1Context *v) int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int v_edge_pos = s->v_edge_pos >> v->field_mode; int use_ic = v->next_use_ic; - int interlace; + int interlace = v->next_interlaced; int linesize, uvlinesize; if (!v->field_mode && !v->s.next_pic.data[0]) @@ -1034,8 +1034,6 @@ void ff_vc1_interp_mc(VC1Context *v) srcU = s->next_pic.data[1]; srcV = s->next_pic.data[2]; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); - src_x = s->mb_x * 16 + (mx >> 2); src_y = s->mb_y * 16 + (my >> 2); uvsrc_x = s->mb_x * 8 + (uvmx >> 2); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 71fda305da..36a47502f5 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1064,6 +1064,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, v->s.cur_pic_ptr->field_picture = v->field_mode; v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE); v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff; + v->last_interlaced = v->s.last_pic_ptr ? v->s.last_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; + v->next_interlaced = v->s.next_pic_ptr ? v->s.next_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; // process pulldown flags s->cur_pic_ptr->f->repeat_pict = 0; -- 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-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-05-11 20:57 UTC|newest] Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-11 20:23 [FFmpeg-devel] [PATCH v2 01/71] avcodec/ratecontrol: Fix double free on error Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 02/71] avcodec/ratecontrol: Pass RCContext directly in ff_rate_control_uninit() Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 03/71] avcodec/ratecontrol: Don't call ff_rate_control_uninit() ourselves Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 04/71] avcodec/mpegvideo, ratecontrol: Remove write-only skip_count Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 05/71] avcodec/ratecontrol: Avoid padding in RateControlEntry Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 06/71] avcodec/get_buffer: Remove redundant check Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 07/71] avcodec/mpegpicture: Store linesize in ScratchpadContext Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 08/71] avcodec/mpegvideo_dec: Sync linesize and uvlinesize between threads Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 09/71] avcodec/mpegvideo_dec: Factor allocating dummy frames out Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 10/71] avcodec/mpegpicture: Mark dummy frames as such Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 11/71] avcodec/mpeg12dec: Allocate dummy frames for non-I fields Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 12/71] avcodec/mpegvideo_motion: Remove dead checks for existence of reference Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 13/71] avcodec/mpegvideo_motion: Optimize check away Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 14/71] " Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 15/71] avcodec/mpegvideo_motion: Avoid constant function argument Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 16/71] avcodec/msmpeg4enc: Only calculate coded_cbp when used Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 17/71] avcodec/mpegvideo: Only allocate coded_block when needed Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 18/71] avcodec/mpegvideo: Don't reset coded_block unnecessarily Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 19/71] avcodec/mpegvideo: Only allocate cbp_table, pred_dir_table when needed Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 20/71] avcodec/mpegpicture: Always reset motion val buffer Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 21/71] avcodec/mpegpicture: Always reset mbskip_table Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 22/71] avcodec/mpegvideo: Redo aligning mb_height for VC-1 Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 23/71] avcodec/mpegvideo, mpegpicture: Add buffer pool Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 24/71] avcodec/mpegpicture: Reindent after the previous commit Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 25/71] avcodec/mpegpicture: Use RefStruct-pool API Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 26/71] avcodec/h263: Move encoder-only part out of ff_h263_update_motion_val() Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 27/71] avcodec/h263, mpeg(picture|video): Only allocate mbskip_table for MPEG-4 Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 28/71] avcodec/mpegvideo: Reindent after the previous commit Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 29/71] avcodec/h263: Move setting mbskip_table to decoder/encoders Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 30/71] avcodec/mpegvideo: Restrict resetting mbskip_table to MPEG-4 decoder Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 31/71] avcodec/mpegvideo: Shorten variable names Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 32/71] avcodec/mpegpicture: Reduce value of MAX_PLANES define Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 33/71] avcodec/mpegpicture: Cache AVFrame.data and linesize values Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 34/71] avcodec/rv30, rv34, rv40: Avoid indirection Andreas Rheinhardt 2024-05-11 20:50 ` [FFmpeg-devel] [PATCH v2 35/71] avcodec/mpegvideo: Add const where appropriate Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 36/71] avcodec/vc1_pred: Remove unused function parameter Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 37/71] avcodec/mpegpicture: Improve error messages and code Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 38/71] avcodec/mpegpicture: Split ff_alloc_picture() into check and alloc part Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 39/71] avcodec/mpegvideo_enc: Pass AVFrame*, not Picture* to alloc_picture() Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 40/71] avcodec/mpegvideo_enc: Move copying properties " Andreas Rheinhardt 2024-05-12 19:55 ` Michael Niedermayer 2024-06-08 14:03 ` [FFmpeg-devel] [PATCH v3 " Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 41/71] avcodec/mpegpicture: Rename Picture->MPVPicture Andreas Rheinhardt 2024-05-11 20:51 ` Andreas Rheinhardt [this message] 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 43/71] avcodec/mpegpicture: Split MPVPicture into WorkPicture and ordinary Pic Andreas Rheinhardt 2024-06-23 22:28 ` Michael Niedermayer 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 44/71] avcodec/error_resilience: Deduplicate cleanup code Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 45/71] avcodec/mpegvideo_enc: Factor setting length of B frame chain out Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 46/71] avcodec/mpegvideo_enc: Return early when getting length of B frame chain Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 47/71] avcodec/mpegvideo_enc: Reindentation Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 48/71] avcodec/mpeg12dec: Don't initialize inter tables for IPU Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 49/71] avcodec/mpeg12dec: Only initialize IDCT " Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 50/71] avcodec/mpeg12dec: Remove write-only assignment Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 51/71] avcodec/mpeg12dec: Set out_format only once Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 52/71] avformat/riff: Declare VCR2 to be MPEG-2 Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 53/71] avcodec/mpegvideo_dec: Add close function for mpegvideo-decoders Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 54/71] avcodec/mpegpicture: Make MPVPicture refcounted Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 55/71] avcodec/mpeg4videoenc: Avoid branch for writing stuffing Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 56/71] avcodec/mpeg4videoenc: Simplify writing startcodes Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 57/71] avcodec/mpegpicture: Use ThreadProgress instead of ThreadFrame API Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 58/71] avcodec/mpegpicture: Avoid loop and branch when setting motion_val Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 59/71] avcodec/mpegpicture: Use union for b_scratchpad and rd_scratchpad Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 60/71] avcodec/mpegpicture: Avoid MotionEstContext in ff_mpeg_framesize_alloc() Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 61/71] avcodec/mpegvideo_enc: Unify initializing PutBitContexts Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 62/71] avcodec/mpeg12enc: Simplify writing startcodes Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 63/71] avcodec/mpegvideo_dec, rv34: Simplify check for "does pic exist?" Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 64/71] avcodec/mpegvideo_dec: Don't sync encoder-only coded_picture_number Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 65/71] avcodec/mpeg12dec: Pass Mpeg1Context* in mpeg_field_start() Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 66/71] avcodec/mpeg12dec: Don't initialize inter_scantable Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 67/71] avcodec/mpegvideo: Remove pblocks Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 68/71] avcodec/mpegvideo: Use enum for msmpeg4_version Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 69/71] avcodec/ituh263enc: Remove redundant check Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 70/71] avcodec/mpegvideo_enc: Binarize reference Andreas Rheinhardt 2024-05-11 20:51 ` [FFmpeg-devel] [PATCH v2 71/71] avcodec/vc1_pred: Fix indentation Andreas Rheinhardt 2024-06-11 20:59 ` [FFmpeg-devel] [PATCH v2 01/71] avcodec/ratecontrol: Fix double free on error 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=GV1P250MB07377F58B7A4C5D72DACBC9B8FE02@GV1P250MB0737.EURP250.PROD.OUTLOOK.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