AV1 motion filed projection
AV1 motion filed projection 运动场 运动轨迹预测
开启:int enable_mfmv (Default is -1) 命令行
mfmv_enabled //real flag
mfmv
类: /* Motion Field Projection Info*/
DecMtMotionProjInfo motion_proj_info
相关变量:use_ref_frame_mvs
no_proj_flag
// MFMV Update//参考帧if (scs->mfmv_enabled && pcs->slice_type != I_SLICE &&pcs->parent_pcs_ptr->is_used_as_reference_flag) {uint32_t mi_stride = pcs->mi_stride;// block 坐标int32_t mi_row = ctx->blk_origin_y >> MI_SIZE_LOG2;int32_t mi_col = ctx->blk_origin_x >> MI_SIZE_LOG2;const int32_t offset = mi_row * mi_stride + mi_col;ModeInfo *mi_ptr = *(pcs->mi_grid_base + offset);//像素坐标const int x_mis = AOMMIN(ctx->blk_geom->bwidth >> MI_SIZE_LOG2,pcs->parent_pcs_ptr->av1_cm->mi_cols - mi_col);const int y_mis = AOMMIN(ctx->blk_geom->bheight >> MI_SIZE_LOG2,pcs->parent_pcs_ptr->av1_cm->mi_rows - mi_row);EbReferenceObject *obj_l0 = (EbReferenceObject *)pcs->parent_pcs_ptr->reference_picture_wrapper_ptr->object_ptr;//记录mvav1_copy_frame_mvs(pcs,pcs->parent_pcs_ptr->av1_cm,mi_ptr->mbmi,mi_row,mi_col,x_mis,y_mis,obj_l0);}
//MFMVif (is_islice || scs_ptr->mfmv_enabled == 0 ||pcs_ptr->parent_pcs_ptr->frm_hdr.error_resilient_mode) {ppcs->frm_hdr.use_ref_frame_mvs = 0;} else {if (fast_decode == 0) {if (enc_mode <= ENC_M9)ppcs->frm_hdr.use_ref_frame_mvs = 1;else {uint64_t avg_me_dist = 0;for (uint16_t b64_idx = 0; b64_idx < ppcs->b64_total_count; b64_idx++) {avg_me_dist += ppcs->me_64x64_distortion[b64_idx];}avg_me_dist /= ppcs->b64_total_count;avg_me_dist /= pcs_ptr->picture_qp;//分辨率小于360p or loss small 用参考帧的mvppcs->frm_hdr.use_ref_frame_mvs = avg_me_dist < 200 ||input_resolution <= INPUT_SIZE_360p_RANGE? 1: 0;}} else {if (enc_mode <= ENC_M9) {uint64_t avg_me_dist = 0;for (uint16_t b64_idx = 0; b64_idx < ppcs->b64_total_count; b64_idx++) {avg_me_dist += ppcs->me_64x64_distortion[b64_idx];}avg_me_dist /= ppcs->b64_total_count;avg_me_dist /= pcs_ptr->picture_qp;ppcs->frm_hdr.use_ref_frame_mvs = avg_me_dist < 50 ||input_resolution <= INPUT_SIZE_360p_RANGE? 1: 0;} else {ppcs->frm_hdr.use_ref_frame_mvs = input_resolution <= INPUT_SIZE_360p_RANGE ? 1 : 0;}}}
if (pcs_ptr->slice_type != I_SLICE && scs_ptr->mfmv_enabled)av1_setup_motion_field(pcs_ptr->parent_pcs_ptr->av1_cm, pcs_ptr);
static void av1_setup_motion_field(Av1Common *cm, PictureControlSet *pcs_ptr) {const OrderHintInfo *const order_hint_info =&pcs_ptr->parent_pcs_ptr->scs_ptr->seq_header.order_hint_info;memset(pcs_ptr->ref_frame_side, 0, sizeof(pcs_ptr->ref_frame_side));if (!order_hint_info->enable_order_hint)return;TPL_MV_REF *tpl_mvs_base = pcs_ptr->tpl_mvs;int size = ((cm->mi_rows + MAX_MIB_SIZE) >> 1) * (cm->mi_stride >> 1);const int cur_order_hint = pcs_ptr->parent_pcs_ptr->cur_order_hint;const EbReferenceObject *ref_buf[INTER_REFS_PER_FRAME];int ref_order_hint[INTER_REFS_PER_FRAME];//每帧计算lossfor (int ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {const int ref_idx = ref_frame - LAST_FRAME;int order_hint = 0;uint8_t list_idx0, ref_idx_l0;list_idx0 = get_list_idx(ref_frame);ref_idx_l0 = get_ref_frame_idx(ref_frame);EbReferenceObject *buf =(EbReferenceObject *)pcs_ptr->ref_pic_ptr_array[list_idx0][ref_idx_l0]->object_ptr;if (buf != NULL)order_hint = buf->order_hint;ref_buf[ref_idx] = buf;ref_order_hint[ref_idx] = order_hint;if (get_relative_dist(order_hint_info, order_hint, cur_order_hint) > 0)pcs_ptr->ref_frame_side[ref_frame] = 1;else if (order_hint == cur_order_hint)pcs_ptr->ref_frame_side[ref_frame] = -1;}//for a frame based mfmv, we need to keep computing the ref_frame_side regardless mfmv is used or noif (!pcs_ptr->parent_pcs_ptr->frm_hdr.use_ref_frame_mvs)return;for (int idx = 0; idx < size; ++idx) {tpl_mvs_base[idx].mfmv0.as_int = INVALID_MV;tpl_mvs_base[idx].ref_frame_offset = 0;}int ref_stamp = MFMV_STACK_SIZE - 1;if (ref_buf[0 /*LAST_FRAME - LAST_FRAME*/] != NULL) {const int alt_of_lst_order_hint =ref_buf[0 /*LAST_FRAME - LAST_FRAME*/]->ref_order_hint[ALTREF_FRAME - LAST_FRAME];const int is_lst_overlay = (alt_of_lst_order_hint ==ref_order_hint[GOLDEN_FRAME - LAST_FRAME]);if (!is_lst_overlay)motion_field_projection(cm, pcs_ptr, LAST_FRAME, 2);--ref_stamp;}if (get_relative_dist(order_hint_info, ref_order_hint[BWDREF_FRAME - LAST_FRAME], cur_order_hint) > 0) {if (motion_field_projection(cm, pcs_ptr, BWDREF_FRAME, 0))--ref_stamp;}if (get_relative_dist(order_hint_info, ref_order_hint[ALTREF2_FRAME - LAST_FRAME], cur_order_hint) > 0) {if (motion_field_projection(cm, pcs_ptr, ALTREF2_FRAME, 0))--ref_stamp;}if (get_relative_dist(order_hint_info, ref_order_hint[ALTREF_FRAME - LAST_FRAME], cur_order_hint) > 0 &&ref_stamp >= 0)if (motion_field_projection(cm, pcs_ptr, ALTREF_FRAME, 0))--ref_stamp;if (ref_stamp >= 0)motion_field_projection(cm, pcs_ptr, LAST2_FRAME, 2);
}
static int motion_field_projection(Av1Common *cm, PictureControlSet *pcs_ptr,MvReferenceFrame start_frame, int dir) {TPL_MV_REF *tpl_mvs_base = pcs_ptr->tpl_mvs;int ref_offset[REF_FRAMES] = {0};uint8_t list_idx0, ref_idx_l0;list_idx0 = get_list_idx(start_frame);ref_idx_l0 = get_ref_frame_idx(start_frame);EbReferenceObject *start_frame_buf =(EbReferenceObject *)pcs_ptr->ref_pic_ptr_array[list_idx0][ref_idx_l0]->object_ptr;if (start_frame_buf == NULL)return 0;if (start_frame_buf->frame_type == KEY_FRAME || start_frame_buf->frame_type == INTRA_ONLY_FRAME)return 0;// MFMV is not applied when the reference picture is of a different spatial resolution// (described in the AV1 spec section 7.9.2.)if (start_frame_buf->mi_rows != cm->mi_rows || start_frame_buf->mi_cols != cm->mi_cols) {return 0;}const int start_frame_order_hint = start_frame_buf->order_hint;const unsigned int *const ref_order_hints = &start_frame_buf->ref_order_hint[0];int start_to_current_frame_offset = get_relative_dist(&pcs_ptr->parent_pcs_ptr->scs_ptr->seq_header.order_hint_info,start_frame_order_hint,pcs_ptr->parent_pcs_ptr->cur_order_hint);for (int i = LAST_FRAME; i <= INTER_REFS_PER_FRAME; ++i)ref_offset[i] = get_relative_dist(&pcs_ptr->parent_pcs_ptr->scs_ptr->seq_header.order_hint_info,start_frame_order_hint,ref_order_hints[i - LAST_FRAME]);if (dir == 2)start_to_current_frame_offset = -start_to_current_frame_offset;const MV_REF *const mv_ref_base = start_frame_buf->mvs;const int mvs_rows = (cm->mi_rows + 1) >> 1;const int mvs_cols = (cm->mi_cols + 1) >> 1;for (int blk_row = 0; blk_row < mvs_rows; ++blk_row) {for (int blk_col = 0; blk_col < mvs_cols; ++blk_col) {const MV_REF *const mv_ref = &mv_ref_base[blk_row * mvs_cols + blk_col];MV fwd_mv = mv_ref->mv.as_mv;if (mv_ref->ref_frame > INTRA_FRAME) {MV this_mv;int mi_r, mi_c;const int ref_frame_offset = ref_offset[mv_ref->ref_frame];int pos_valid = abs(ref_frame_offset) <= MAX_FRAME_DISTANCE &&ref_frame_offset > 0 &&abs(start_to_current_frame_offset) <= MAX_FRAME_DISTANCE;if (pos_valid) {get_mv_projection(&this_mv, fwd_mv, start_to_current_frame_offset, ref_frame_offset);pos_valid = get_block_position(cm, &mi_r, &mi_c, blk_row, blk_col, this_mv, dir >> 1);}if (pos_valid) {const int mi_offset = mi_r * (cm->mi_stride >> 1) + mi_c;tpl_mvs_base[mi_offset].mfmv0.as_mv.row = fwd_mv.row;tpl_mvs_base[mi_offset].mfmv0.as_mv.col = fwd_mv.col;tpl_mvs_base[mi_offset].ref_frame_offset = ref_frame_offset;}}}}return 1;
}
AV1 motion filed projection相关推荐
- [AV1] Motion Vector Prediction
返回首页 AV1中的MV预测 类似于HEVC的AMVP,在AV1中,运动向量也不是直接传输的,而是要经过预测后,把运动向量残差给传过去,而可以给当前块的运动向量做参考的MV都保存在一个叫做RefSta ...
- HTML,JS与CSS
HTML和CSS,JavaScript(简称js)是万维网的核心技术,三种技术一起构成前端开发.HTML为网页结构,CSS为网页表现,JS为网页行为.如果说网页是一个人的话,那么HTML就是他的骨骼经 ...
- 3d服务器播放系统,3D立体电影放映系统
本词条缺少概述图,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧! 3D立体电影放映系统采用普通偏光式双机3D技术,播放3D左右格式的片源.常见三种双机放映的3D体验,依次为IMAX 3D.普通 ...
- [gdc16]荣耀战魂(ForHonor)的动画技术
gdc16, ubisoft带来. 对于< For Honor>, 之前就被其质感和异常真实连贯的动作所吸引,刚刚发售入了pc版,上手玩起来果然不同凡响. 这里所有的人都会对其非常出色的动 ...
- HTTP1.1协议-RFC2616-中文版
说明 本文档规定了互联网社区的标准组协议,并需要讨论和建议以便更加完善.请参考 "互联网官方协议标准"(STD 1)来了解本协议的标准化状态.本协议不限流传发布. 版权声明 Cop ...
- LibAOM与AV1的最新研发进展
# Editorial Note # 本次分享我们邀请到了来自Google Open Codec Team的韩敬宁博士,他向我们分享了AV1解码器的覆盖,AV1编码器性能的提升包括AV1压缩性能的提升 ...
- [AV1] AV1技术专栏(正在更新中)
AV1 专栏 学习AV1必备的利器: 手把手教你本地搭建 AV1 Analyzer 这个专栏是我花了半年的时间阅读libav1,SVT-AV1以及dav1d的源码后摸索总结出来的AV1技能树,希望能帮 ...
- 【Argoverse 1 Motion Forecasting Dataset】轨迹预测数据集简介
Argoverse 1https://www.argoverse.org/av1.html#forecasting-link 目录 1.数据集概述 1.1数据集简介 1.2数据收集方式 2. Argo ...
- Unity3D 中 Generic 动画导入设置和 Root Motion 之间的关系
Unity3D 的 Mecanim 动画系统可以直接复用 3DS MAX 中制作的动画文件中的位移,这个就是通过 applyRootMotion 来达成的,我们只需要在使用 Animator 控制动画 ...
最新文章
- json格式天气数据的获取,jsonp方式获取统计图数据
- Debian下使用OpenLDAP 管理端
- cx oracle 返回码,oracle错误代码处理cx_oracle
- 如何在gvim中安装autoproto自动显示函数原型
- android 配置java_home_android – React Native:未设置JAVA_HOME,并且在PATH中找不到“java”命令...
- 基于Linux的 Open×××网络之网络架构应用实例
- JQuery中使用Ajax赋值给全局变量失败异常的解决方法,jqueryajax
- 关于查看文件size
- Hub与Switch的帧的广播细节
- Comparator和Comparable (转)
- SQLyog 注册码(包含企业版注册码)
- 计算机组成原理考试试题答案,计算机组成原理期末考试试题及答案 (精选可编辑)...
- CG资源网 - Maya教程
- 如何使用U盘替换光驱引导部署WES7系统
- html之解决边框重合问题,鼠标移动文字上文字抖动问题
- python 抠图源码_比PS还好用!Python 20行代码批量抠图
- 玖逸云黑v1.4-更高级的云黑系统
- Flask-Assets 使用autoprefixer并压缩css/JS文件提高访问速度
- 新程序员001:开发者黄金十年
- Intellij IDEA免费版方法 (吃土学生最佳选择!!)