Commit 678a3abf authored by changsheng gao's avatar changsheng gao
Browse files

seperate_compress_encode

parent 48a73ee6
......@@ -12,20 +12,26 @@ Void CodingUnit::destroy() //free memory
}
Void CodingUnit::initCu(ComponentID componentId, UInt row, UInt col, CommonPic* pic)
Void CodingUnit::initCu(ComponentID ch, UInt row, UInt col, CommonPic* pic)
{
m_ComponentId = componentId;
m_ComponentId = ch;
m_uiRow = row;
m_uiCol = col;
m_pPic = pic;
}
Void CodingUnit::compressCu()
{
//input: uiCuYuvBuf
//output: m_puiCuQuanCoeff
transform();
quantize();
}
Void CodingUnit::encodeCu()
{
//input: uiCuYuvBuf
//input: m_puiCuQuanCoeff
//output: bitstream
transform();
quantize();
huffman();
}
......@@ -36,14 +42,21 @@ Void CodingUnit::transform() //
//scan order, scale
}
Void CodingUnit::quantize() //
Void CodingUnit::quantize() // quantize dct coeff and copy quantized coeff to pic
{
//input: uiCuDctCoeff
//output: uiQuanDctCoeff
//copy quantized coeff to pic
}
void CodingUnit::huffman() // quaDctCoeff>bitstream
{
//input:uiQuaDctCoeff
//output:pic.bitstream
}
Void CodingUnit::copyPartToPic()
{
//input: cu information
//output: pic information
}
\ No newline at end of file
......@@ -25,11 +25,12 @@ class CodingUnit
TCoeff* getDctCoeffAddr() { return m_puiCuDctCoeff; } //start address of dct
TCoeff* getQuanCoeffAddr() { return m_puiCuQuanCoeff; } //start address of quan
Void encodeCu();
Void compressCu();
Void encodeCu();
Void transform();
Void quantize();
Void huffman();// quaDctCoeff>bitstream
Void copyPartToPic(); //copy cu to pic, including m_puiCuQuanCoeff
};
......
......@@ -3,6 +3,23 @@
#include "CommonPic.h"
#include "CodingUnit.h"
Void CommonPic::compressPic()
{
for (UInt ch = COMPONENT_Y; ch < MAX_NUM_COMPONENT; ch++)
{
for (UInt row = 0; row < m_uiPicWidth / CUSIZE; row++)
{
for (UInt col = 0; col < m_uiPicWidth / CUSIZE; col++)
{
CodingUnit rcCu;
rcCu.create();
rcCu.initCu((ComponentID)ch, row, col, this);
rcCu.compressCu();
rcCu.destroy();
}
}
}
}
Void CommonPic::encodePic()
{
......
......@@ -51,6 +51,7 @@ class CommonPic
Bool readRgb(); //read yuv to uiOrgPicYuv
Bool colorSpaceConvert(); // color space convert, subsample
Bool preProcessing(); // padding,
Void compressPic();
Void encodePic();
Void writeHead(); // write header to bitstream
Void saveBitStream(); // save bitstream to file
......
......@@ -12,6 +12,7 @@ int main ()
rcPic.init(cfg);
rcPic.writeHead();
rcPic.compressPic();
rcPic.encodePic();
rcPic.saveBitStream();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment