中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

小米手機(jī)做網(wǎng)站服務(wù)器嗎網(wǎng)站排名優(yōu)化公司

小米手機(jī)做網(wǎng)站服務(wù)器嗎,網(wǎng)站排名優(yōu)化公司,最新中國企業(yè)500強(qiáng)名單,網(wǎng)站名稱與主辦單位一、引言 通過FFmpeg命令可以獲取到H.264裸流文件的色彩格式(又譯作色度采樣結(jié)構(gòu)、像素格式): 在vlc中也可以獲取到色彩格式(vlc底層也使用了FFmpeg進(jìn)行解碼): 這個色彩格式就是之前的文章《音視頻入門基礎(chǔ)…

一、引言

通過FFmpeg命令可以獲取到H.264裸流文件的色彩格式(又譯作色度采樣結(jié)構(gòu)、像素格式):

在vlc中也可以獲取到色彩格式(vlc底層也使用了FFmpeg進(jìn)行解碼):

這個色彩格式就是之前的文章《音視頻入門基礎(chǔ):像素格式專題(4)——YUV簡介》中描述的像素格式。所以FFmpeg和vlc是怎樣獲取到H.264編碼的視頻的色彩格式呢?它們其實是通過SPS中的屬性chroma_format_idc獲取的。

二、H.264官方文檔對chroma_format_idc的描述

chroma_format_idc屬性在H.264官方文檔《T-REC-H.264-202108-I!!PDF-E.pdf》第44頁中定義:

根據(jù)H.264官方文檔《T-REC-H.264-202108-I!!PDF-E.pdf》第22頁,當(dāng)chroma_format_idc = 0時,色彩格式為單色;chroma_format_idc = 1時,色彩格式為YUV 4:2:0;chroma_format_idc = 2時,色彩格式為YUV 4:2:2;chroma_format_idc = 3時,色彩格式為YUV 4:4:4:

根據(jù)H.264官方文檔第74頁,chroma_format_idc的值應(yīng)該在0到3的范圍內(nèi)(包括0和3)。當(dāng)chroma_format_idc不存在時,應(yīng)推斷其值為1(4:2:0的色度格式)。

也就是說,只有當(dāng)profile_idc等于下面紅框里的這些值時,chroma_format_idc才會存在。如果profile_idc不是這些值,chroma_format_idc的值就是1,表示色彩格式為YUV 4:2:0:

三、計算色彩格式的例子

下面以某個視頻文件為例,講述怎么計算它的色彩格式。用Elecard Stream Analyzer工具打開一個用H.264編碼的視頻文件,看到其profile_idc值為77。由于profile_idc不是上圖紅框里的那些值,所以chroma_format_idc值為1,所以該視頻的色彩格式為YUV 4:2:0:

用Elecard StreamEye工具可以看到該視頻的色彩格式確實為YUV 4:2:0,證明我們的計算是正確的:

四、FFmpeg源碼中獲取色彩格式的實現(xiàn)

從文章《音視頻入門基礎(chǔ):H.264專題(10)——FFmpeg源碼中,存放SPS屬性的結(jié)構(gòu)體和解碼SPS的函數(shù)分析》中,我們可以知道,FFmpeg源碼中通過ff_h264_decode_seq_parameter_set函數(shù)解碼SPS,從而拿到SPS中的屬性。

在ff_h264_decode_seq_parameter_set函數(shù)中有如下代碼,通過下面的這部分代碼拿到SPS中的chroma_format_idc:

int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,H264ParamSets *ps, int ignore_truncation)
{//...if (sps->profile_idc == 100 ||  // High profilesps->profile_idc == 110 ||  // High10 profilesps->profile_idc == 122 ||  // High422 profilesps->profile_idc == 244 ||  // High444 Predictive profilesps->profile_idc ==  44 ||  // Cavlc444 profilesps->profile_idc ==  83 ||  // Scalable Constrained High profile (SVC)sps->profile_idc ==  86 ||  // Scalable High Intra profile (SVC)sps->profile_idc == 118 ||  // Stereo High profile (MVC)sps->profile_idc == 128 ||  // Multiview High profile (MVC)sps->profile_idc == 138 ||  // Multiview Depth High profile (MVCD)sps->profile_idc == 144) {  // old High444 profilesps->chroma_format_idc = get_ue_golomb_31(gb);//...}else {sps->chroma_format_idc = 1;//...}//...
}

然后在FFmpeg源碼的源文件libavcodec/h264_parser.c的parse_nal_units函數(shù)中,通過如下代碼,得到色彩格式:

static inline int parse_nal_units(AVCodecParserContext *s,AVCodecContext *avctx,const uint8_t * const buf, int buf_size)
{//...for (;;) {switch (nal.type) {case H264_NAL_SPS:ff_h264_decode_seq_parameter_set(&nal.gb, avctx, &p->ps, 0);break;//...case H264_NAL_IDR_SLICE://...switch (sps->bit_depth_luma) {case 9:if (sps->chroma_format_idc == 3)      s->format = AV_PIX_FMT_YUV444P9;else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P9;else                                  s->format = AV_PIX_FMT_YUV420P9;break;case 10:if (sps->chroma_format_idc == 3)      s->format = AV_PIX_FMT_YUV444P10;else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P10;else                                  s->format = AV_PIX_FMT_YUV420P10;break;case 8:if (sps->chroma_format_idc == 3)      s->format = AV_PIX_FMT_YUV444P;else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P;else                                  s->format = AV_PIX_FMT_YUV420P;break;default:s->format = AV_PIX_FMT_NONE;}//... }//...}
}

http://www.risenshineclean.com/news/9628.html

相關(guān)文章:

  • 哈爾濱快速建站案例百度識圖網(wǎng)頁版入口
  • 彩票網(wǎng)站怎么做的營銷模式
  • 凡科做網(wǎng)站不要錢seo搜索引擎入門教程
  • 做報名網(wǎng)站中國國家培訓(xùn)網(wǎng)是真的嗎
  • spd2007怎么創(chuàng)建網(wǎng)站品牌推廣的意義
  • 網(wǎng)站開發(fā)代理報價表成都私人網(wǎng)站制作
  • 北京做網(wǎng)站在線html5制作網(wǎng)站
  • 泰安人力資源招聘長沙靠譜關(guān)鍵詞優(yōu)化服務(wù)
  • 獨(dú)立設(shè)計購物網(wǎng)站網(wǎng)絡(luò)推廣方案范例
  • 網(wǎng)站seo優(yōu)化關(guān)鍵詞國內(nèi)外搜索引擎大全
  • 學(xué)校網(wǎng)站設(shè)計的作用營銷平臺建設(shè)
  • wordpress限制站點(diǎn)使用時間河南品牌網(wǎng)站建設(shè)
  • 最基本的網(wǎng)絡(luò)營銷站點(diǎn)西安優(yōu)化網(wǎng)站公司
  • wordpress做的好的網(wǎng)站如何優(yōu)化網(wǎng)站快速排名
  • 萊山做網(wǎng)站的公司熊貓關(guān)鍵詞工具官網(wǎng)
  • 域名注冊后怎么建網(wǎng)站全網(wǎng)營銷推廣案例
  • 商城網(wǎng)站都有什么功能模塊免費(fèi)網(wǎng)站推廣工具
  • 網(wǎng)站建設(shè)規(guī)劃書的空間seo軟文代寫
  • 做網(wǎng)站學(xué)習(xí)營銷策略范文
  • 長沙企業(yè)網(wǎng)站建設(shè)服務(wù)怎么做網(wǎng)址
  • 淮北市住房和城鄉(xiāng)建設(shè)局網(wǎng)站出售外鏈
  • 門戶網(wǎng)站類型北京疫情消息1小時前
  • 手機(jī)網(wǎng)站制作費(fèi)用多少seo廠商
  • 黃驊市海邊深圳優(yōu)化排名公司
  • 網(wǎng)站制作服務(wù)公司婚戀網(wǎng)站排名前三
  • 怎樣做營銷型網(wǎng)站推廣ppt抖音seo軟件
  • 網(wǎng)頁設(shè)計和網(wǎng)站開發(fā)有什么區(qū)別百度競價是什么工作
  • 如何給一個網(wǎng)站做定時的更新深圳網(wǎng)站制作推廣
  • 國內(nèi)永久在線免費(fèi)建站百度網(wǎng)盤資源搜索引擎入口
  • 深圳和海楓建設(shè)集團(tuán)有限公司網(wǎng)站百度推廣關(guān)鍵詞