webrtc支持的最小宽度和高度

代码在:h264/sps_parser.cc

cpp 复制代码
//
// IMPORTANT ONES! Now we're getting to resolution. First we read the pic
// width/height in macroblocks (16x16), which gives us the base resolution,
// and then we continue on until we hit the frame crop offsets, which are used
// to signify resolutions that aren't multiples of 16.
//
// pic_width_in_mbs_minus1: ue(v)
sps.width = 16 * (reader.ReadExponentialGolomb() + 1);
cpp 复制代码
// Figure out the crop units in pixels. That's based on the chroma format's
// sampling, which is indicated by chroma_format_idc.
if (sps.separate_colour_plane_flag || chroma_format_idc == 0) {
  frame_crop_bottom_offset *= (2 - sps.frame_mbs_only_flag);
  frame_crop_top_offset *= (2 - sps.frame_mbs_only_flag);
} else if (!sps.separate_colour_plane_flag && chroma_format_idc > 0) {
  // Width multipliers for formats 1 (4:2:0) and 2 (4:2:2).
  if (chroma_format_idc == 1 || chroma_format_idc == 2) {
    frame_crop_left_offset *= 2;
    frame_crop_right_offset *= 2;
  }
  // Height multipliers for format 1 (4:2:0).
  if (chroma_format_idc == 1) {
    frame_crop_top_offset *= 2;
    frame_crop_bottom_offset *= 2;
  }
}
// Subtract the crop for each dimension.
sps.width -= (frame_crop_left_offset + frame_crop_right_offset);
sps.height -= (frame_crop_top_offset + frame_crop_bottom_offset);

读取图像的宽度和高度,以宏块(16x16)为单位,这给出了基本分辨率。然后,继续读取直到遇到帧裁剪偏移量,这些偏移量用于表示不是16的倍数的分辨率。

在这段代码中,"pic_width_in_mbs_minus1" 是一个无符号指数哥伦布编码(ue(v)),用于计算图像的宽度。最后一行代码则将图像的宽度设置为16乘以读取的值加1。

根据色度格式和色度平面标志来调整帧的裁剪偏移量,然后根据计算得到的偏移量来调整图像的宽度和高度,以实现正确的裁剪。

即支持16x16的块,然后按2的倍数做裁减。

相关推荐
北城青7 小时前
WebRTC Connection Negotiate解决
运维·服务器·webrtc
天天讯通11 小时前
网页WebRTC电话和软电话哪个好用?
webrtc
弱冠少年11 小时前
WebRTC入门
webrtc
limingade5 天前
手机实时提取SIM卡打电话的信令声音-(题外、插播一条广告)
android·物联网·计算机外设·音视频·webrtc·信号处理
余生H5 天前
拿下奇怪的前端报错:某些多摄手机拉取部分摄像头视频流会导致应用崩溃,该如何改善呢?
前端·javascript·webrtc·html5·webview·相机
Liveweb视频汇聚平台7 天前
如何使用 WebRTC 获取摄像头视频
音视频·webrtc
Crazy learner11 天前
WebRTC中的维纳滤波器实现详解:基于决策导向的SNR估计
人工智能·webrtc·语音识别
Rookie也要加油12 天前
01_WebRtc_一对一视频通话
笔记·学习·音视频·webrtc
Liveweb视频汇聚平台12 天前
国标GB28181视频融合监控汇聚平台的方案实现及场景应用
音视频·webrtc·实时音视频·h.265·视频编解码
太上绝情12 天前
webrtc-candidate形成分析
webrtc