当前位置: 首页 > ops >正文

SVT-AV1源码学习-EbMotionEstimation.h 学习

#ifndef EbMotionEstimation_h //防止文件呗重复包含的宏定义开始标记

#define EbMotionEstimation_h 定义头文件标识符

#include "definitions.h" //包含定义文件

#include "coding_unit.h" //包含编码单元相关文件

#include "me_process.h" //包含运动估计处理相关文件

#include "me_context.h" //包含运动估计上下文相关文件

#include "pic_buffer_desc.h" //包含图像缓冲区描述相关文件

#include "reference_object.h" //包含参考对象相关文件

#include "pd_process.h"

#include "utility.h"

#include "aom_dsp_rtcd.h"

extern EbErrorType svt_som_motion_estimation_b64(

svt_aom_motion_estimation_b64, //用于对64x64大小的块进行运动估计,返回错误类型

PictureParentControlSet *pcs;//指向图像父控制集的指针参数

uint32_t b64_index, //64x64块的索引参数

uint32_t b64_origin_x, //64x64块的起始x坐标参数

uint32_t b64_origin_y, //64x64块的起始y坐标参数

MeContext *me_ctx; //指向运动估计上下文的指针参数

EbPictureBufferDesc *input_ptr); //指向输入图像缓冲区描述的指针参数

extern void svt_aom_downsample_2d_c(//声明外部函数

svt_aom_downsample_2d_c, 用于进行二维下采样操作

uint8_t *input_samples,//输入样本数据的指针参数

uint32_t input_stride, //输入样本的步长参数

uint32_t input_area_width, //输入区域的宽度参数

uint32_t input_area_height,//输入区域的高度参数

uint8_t *decim_samples, //下采样后的样本数据的指针参数

uint32_t decim_stride, //下采样后样本的步长参数

uint32_t decim_step //下采样步进参数);

extern EbErrorType open_loop_intra_search_sb(//声明外部函数

open_loop_intra_search_sb, //用于在开放环路模式下对超块进行intra 帧内搜索,返回错误类型

PictureParentControlSet *pcs;// 指向图像父控制集的指针参数

uint32_t sb_index;//超块的索引参数

MotionEstimationContext_t *me_context_ptr;//指向运动估计上下文的指针参数

EbPictureBufferDesc *input_ptr); //指向输入图像缓冲区描述的指针参数

extern EbErrorType av1_open_loop_intra_search(//声明外部函数

av1_open_loop_intra_search,用于AV1编码格式下的开放环路intra 搜索结果搜索,返回错误类型

PictureParentControlSet *pcs, //指向图像父控制集的指针参数

MotionEstimationContext_t *me_context_ptr, //指向运动估计上下文的指针参数

EbPictureBufferDesc *input_ptr); //指向输入图像缓冲区描述的指针参数

extern EbErrorType svt_aom_open_loop_intra_search_mb(//声明外部函数

svt_aom_open_loop_intra_search_mb,用于对宏块进行开放环路intra搜索结果搜索,返回错误类型

PictureParentControlSet *pcs, //指向图像父控制集的指针参数

uint32_t b64_index,//64x64块的索引参数

EbPictureBufferDesc *input_ptr); 指向输入图像缓冲区描述的指针参数

#define a_b_c 0 // 位置组合a_b_c的索引值

#define a_c_b 1 // 位置组合a_c_b的索引值

#define b_a_c 2 // 位置组合b_a_c的索引值

#define b_c_a 3 // 位置组合b_c_a的索引值

#define c_a_b 4 // 位置组合c_a_b的索引值

#define c_b_a 5 // 位置组合c_b_a的索引值

// The interpolation is performed using a set of three 4 tap filters

#define IFShiftAvcStyle 1

#define F0 0

#define F1 1

#define F2 2

#define MAX_SSE_VALUE 128 * 128 * 255 * 255

#define MAX_SAD_VALUE 128*128*255

// Thresholds used for determining level of motion (used in sparse search)

#define MEDIUM_TEMPORAL_MV_TH 2048

#define LOW_TEMPORAL_MV_TH 1024

#define TOP_LEFT_POSITION 0 // 左上位置索引

#define TOP_POSITION 1 // 上位置索引

#define TOP_RIGHT_POSITION 2 // 右上位置索引

#define RIGHT_POSITION 3 // 右位置索引

#define BOTTOM_RIGHT_POSITION 4 // 右下位置索引

#define BOTTOM_POSITION 5 // 下位置索引

#define BOTTOM_LEFT_POSITION 6 // 左下位置索引

#define LEFT_POSITION 7 // 左位置索引

// 插值使用三组4抽头滤波器

#define IFShiftAvcStyle 1 // AVC风格的插值移位值

#define F0 0 // 滤波器0的索引

#define F1 1 // 滤波器1的索引

#define F2 2 // 滤波器2的索引

#define MAX_SSE_VALUE 128 * 128 * 255 * 255 // SSE最大值

#define MAX_SAD_VALUE 128*128*255 // SAD最大值

// 用于确定运动水平的阈值(用于稀疏搜索)

#define MEDIUM_TEMPORAL_MV_TH 2048 // 中等时间运动向量阈值

#define LOW_TEMPORAL_MV_TH 1024 // 低时间运动向量阈值

#define HIGH_SPATIAL_MV_TH 2048 // 高空间运动向量阈值

#define MEDIUM_SPATIAL_MV_TH 512 // 中等空间运动向量阈值

#define LOW_SPATIAL_MV_TH 256 // 低空间运动向量阈值

// 插值滤波器系数

static const int32_t me_if_coeff[3][4] = { // 运动估计插值滤波器系数

{ -4, 54, 16, -2 }, // F0 // 滤波器0的系数

{ -4, 36, 36, -4 }, // F1 // 滤波器1的系数

{ -2, 16, 54, -4 }, // F2 // 滤波器2的系数

};

static const uint32_t tab16x16[16] = { // 16x16块的扫描顺序表

0, 1, 4, 5,

2, 3, 6, 7,

8, 9, 12, 13,

10, 11, 14, 15

};

static const uint32_t tab8x8[64] = {

0, 1, 4, 5, 16, 17, 20, 21,

2, 3, 6, 7, 18, 19, 22, 23,

8, 9, 12, 13, 24, 25, 28, 29,

10, 11, 14, 15, 26, 27, 30, 31,

32, 33, 36, 37, 48, 49, 52, 53,

34, 35, 38, 39, 50, 51, 54, 55,

40, 41, 44, 45, 56, 57, 60, 61,

42, 43, 46, 47, 58, 59, 62, 63

};

static const uin32_t partition_width[SQUARE_PU_COUNT] = {//分区宽度表

64, // (1) // 64x64块

32, 32, 32, 32, // (4) // 32x32块

16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, // (16) // 16x16块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

};

static const uint32_t partition_height[SQUARE_PU_COUNT] = { // 分区高度表

64, // (1) // 64x64块

32, 32, 32, 32, // (4) // 32x32块

16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, // (16) // 16x16块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // (16) // 8x8块

};

static const uint32_t pu_search_index_map[SQUARE_PU_COUNT][2] = { // PU搜索索引映射表

{ 0, 0 }, // 64x64块的原点

{ 0, 0 }, { 32, 0 }, { 0, 32 }, { 32, 32 }, // 32x32块的四个位置

{ 0, 0 }, { 16, 0 }, { 32, 0 }, { 48, 0 }, // 16x16块的第一行

{ 0, 16 }, { 16, 16 }, { 32, 16 }, { 48, 16 }, // 16x16块的第二行

{ 0, 32 }, { 16, 32 }, { 32, 32 }, { 48, 32 }, // 16x16块的第三行

{ 0, 48 }, { 16, 48 }, { 32, 48 }, { 48, 48 }, // 16x16块的第四行

{ 0, 0 }, { 8, 0 }, { 16, 0 }, { 24, 0 }, { 32, 0 }, { 40, 0 }, { 48, 0 }, { 56, 0 }, // 8x8块的第一行

{ 0, 8 }, { 8, 8 }, { 16, 8 }, { 24, 8 }, { 32, 8 }, { 40, 8 }, { 48, 8 }, { 56, 8 }, // 8x8块的第二行

{ 0, 16 }, { 8, 16 }, { 16, 16 }, { 24, 16 }, { 32, 16 }, { 40, 16 }, { 48, 16 }, { 56, 16 }, // 8x8块的第三行

{ 0, 24 }, { 8, 24 }, { 16, 24 }, { 24, 24 }, { 32, 24 }, { 40, 24 }, { 48, 24 }, { 56, 24 }, // 8x8块的第四行

{ 0, 32 }, { 8, 32 }, { 16, 32 }, { 24, 32 }, { 32, 32 }, { 40, 32 }, { 48, 32 }, { 56, 32 }, // 8x8块的第五行

{ 0, 40 }, { 8, 40 }, { 16, 40 }, { 24, 40 }, { 32, 40 }, { 40, 40 }, { 48, 40 }, { 56, 40 }, // 8x8块的第六行

{ 0, 48 }, { 8, 48 }, { 16, 48 }, { 24, 48 }, { 32, 48 }, { 40, 48 }, { 48, 48 }, { 56, 48 }, // 8x8块的第七行

{ 0, 56 }, { 8, 56 }, { 16, 56 }, { 24, 56 }, { 32, 56 }, { 40, 56 }, { 48, 56 }, { 56, 56 }, // 8x8块的第八行

};

extern uint32_t svt_aom_compute8x4_sad_kernel_c( //计算8x4SAD函数

uint8_t *src, //输入样本指针

uint32_t src_stride,//输入步长

uint8_t *ref,//输入参考样本指针

uint32_t ref_stride, //输入参考步长

);

extern void svt_ext_all_sad_calculation_8x8_16x16_c (//计算8x8和16x16SAD函数

uint8_t *src, //输入 帧指针

uint32_t src_stride, //输入步长

uint8_t *ref, //参考帧指针

uint32_t ref_stride,//参考步长

uint32_t mv, //运动向量

uint32_t *p_best_sad_8x8, //最佳8x8, SAD

uint32_t *p_best_sad_16x16, //最佳16x16, SAD

uint32_t *p_best_mv8x8, // 输出:最佳8x8运动向量

uint32_t *p_best_mv16x16, // 输出:最佳16x16运动向量

uint32_t p_eight_sad16x16[16][8], // 输出:16x16块的8个SAD值uint32_t p_eight_sad8x8[64][8], // 输出:8x8块的8个SAD值

Bool sub_sad); // 输入:是否计算子SAD

);

extern void svt_ext_eight_sad_calculation_32x32_64x64_c(//计算32x32和64x64SAD函数

uint32_t p_sad16x16[16][8], //输入 16x16SAD

uint32_t *p_best_sad_32x32, // 输出:最佳32x32 SAD值

uint32_t *p_best_sad_64x64, // 输出:最佳64x64 SAD值

uint32_t *p_best_mv32x32, // 输出:最佳32x32运动向量uint32_t *p_best_mv64x64, // 输出:最佳64x64运动向量

uint32_t mv, // 输入:运动向量

uint32_t p_sad32x32[4][8]); // 输出:32x32块的SAD值

);

extern uint32_t svt_aom_get_me_info_index( //获取运动估计信息索引函数

uint32_t max_me_block, //输入最大运动估计块大小

const BlockGeom *blk_geom, //块几何信息

uint32_t geom_offset_x, //x方向几何偏移

uint32_t geom_offset_y , //y方向几何偏移

);

uint16_t svt_aom_get_scaled_picture_distance(uint16_t dist); //获取缩放后的图像距离函数

http://www.xdnf.cn/news/4799.html

相关文章:

  • SSM 框架是指什么,其优缺点,怎样用到在你的程序里
  • 交流中的收获-250508
  • AI Agent | 深度剖析 AI Agent:从基础原理到关键能力
  • 如何在 Logback 日志框架中加入链路 ID
  • 嵌入式开发学习日志Day16
  • MAC电脑日期与时间问题和定位不能正常使用问题
  • mysql数据库体验
  • 国标GB28181软件EasyGBS雪亮工程打造智能高效的视频监控新体系
  • git的常用命令详解
  • 【redis】分片方案
  • 一文读懂Python之requests模块(36)
  • 扣子创建一个应用
  • 基于vm加密的php逆向分析
  • verilog循环仿真
  • Spark处理过程-案例数据清洗
  • Linux命令行参数注入详解
  • 深入剖析ThreadLocal:原理、应用与最佳实践
  • 笔试强训——第七周
  • 前端三大件---CSS
  • 塔能空压系统节能方案:为华东某电子厂降耗赋能
  • JavaSE核心知识点02面向对象编程02-02(封装、继承、多态)
  • 基于LLM的全自动视频生成工具:MoneyPrinterTurbo 技术解析
  • CAN总线通讯接口卡:工业通信的核心桥梁
  • wails3学习-runtime:Window无边框设置
  • 数据结构(四)——栈的应用—数制转换
  • Java线程阻塞方法LockSupport.park()/Thread.sleep()/Object.wait()详解:原理、区别
  • java实战(第六篇):统计投票信息
  • [特殊字符]【深圳金融科技交流会】AI大模型如何重塑资管新生态?一线实战干货来了!
  • 极简远程革命:打破公网桎梏,重塑数字生活新体验
  • Vue 3.0中Treeshaking特性