1
在與X265編碼器(https://x265.readthedocs.org/en/default/api.html)編碼過程我想要一個新圖像之後寫入圖像的像素值(Y信道的具體值)轉換成.txt文件進行編碼(未重要的原因)。對於這一點,我使用的是 '飛機' 類x265_picture的變量:X265編碼器:在「平面」數組值的次序
x265_picture* pic_out; # variable where encoded image is to be stored
... # encoding process
uint8_t *plane = (uint8_t*)pic_out->planes[0];
uint32_t pixelCount = x265_picturePlaneSize(pic_out->colorSpace, m_param->sourceWidth, m_param->sourceHeight, 0);
ofstream out_file("out_file.txt");
for (uint32_t j = 0; j < pixelCount; j++) # loop for all pixels
{
int pix_val = plane[j];
out << pix_val;
}
ofstream.close()
但是,當我重建輸出數據轉換成圖像,我得到
,而不是
或另一個例子:
,而不是
(顏色並不重要,「條紋」是關注)
在輸出文件似乎有是在數據的時間間隔(顯然)正確的順序(讓我們說89,90,102,98,...),然後總是相等數量的長序列(如。 235235235235 ...或... 65,65,65,65),即「創造」的條紋。有人能告訴我我錯過了什麼嗎?
你在哪裏得到x265_picturePlaneSize功能?我在標題中看不到它。 – Pescolly
這段時間沒有用過,但它位於x265/source/common/common.cpp – user2208392
其定義:uint32_t x265_picturePlaneSize(int csp,int width,int height,int plane) { uint32_t size =( uint32_t的)(寬度>> x265_cli_csps [CSP] .WIDTH [平面])*(高度>> x265_cli_csps [CSP] .height [平面]); 返回大小; } – user2208392