c - vf_codecview.c 仅打印 'future' 中的运动 vector

标签 c ffmpeg video-processing

我试图理解 ffmpeg 绘制运动 vector 的方式。

我浏览了 vf_codecview.c 文件并看到了函数 draw_arrow它仅采用那些 source > 0 暗示仅来自 future 的 vector 。

有谁知道这是为什么吗?如果 ffmpeg 通过这个文件只计算 future ,那么计算过去和 future 有什么用呢?

最佳答案

事实并非如此

source 可以采用正值或负值。

/**
 * Where the current macroblock comes from; negative value when it comes
 * from the past, positive value when it comes from the future.
 * XXX: set exact relative ref frame reference instead of a +/- 1 "direction".
 */
int32_t source;

在您链接到的通话中,我们有

if ((direction == 0 && (s->mv & MV_P_FOR)  && frame->pict_type == AV_PICTURE_TYPE_P) ||
    (direction == 0 && (s->mv & MV_B_FOR)  && frame->pict_type == AV_PICTURE_TYPE_B) ||
    (direction == 1 && (s->mv & MV_B_BACK) && frame->pict_type == AV_PICTURE_TYPE_B))
    draw_arrow(frame->data[0], mv->dst_x, mv->dst_y, mv->src_x, mv->src_y,
              frame->width, frame->height, frame->linesize[0],
              100, 0, mv->source > 0);

如果宏 block 是根据过去的帧预测的,则最后一个表达式的计算结果为 0 并作为 0 传递,否则为 1

条件显然允许过去和 future 预测的宏 block 。

附注您正在查看版本 2.5 的源代码,此时该版本已经非常旧了。当前版本位于 https://ffmpeg.org/doxygen/trunk/vf__codecview_8c_source.html#l00256

关于c - vf_codecview.c 仅打印 'future' 中的运动 vector ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48902338/

相关文章:

FFmpeg api 在使用 422 或 420 色度二次采样和 SD 分辨率时生成失真图像

google-chrome - 与 Firefox 相比, native Chrome 视频播放器呈现模糊不清的 mp4 视频

ios - AVFoundation 旋转屏幕 - Obj C

c - 使用 zend 读取 php.ini for PHP 扩展(不是 PHP 语言)

c - c实现链表添加节点时出现段错误

c - 基本的 C 编程

iphone - 准备错误 : no such table: items

ffmpeg - 复制附加字体而不编码/remux

video - FFMPEG:将 UHD H265 转码为 SDR H264 而不会丢失颜色

ffmpeg - "does not contain any stream"如果 "EXT-X-MEDIA-SEQUENCE"> 0