27#include <libavcodec/avcodec.h>
66 for (i = 0; i <
m_pAvpkt->size; i++) {
82 int frameCropLeftOffset = 0;
83 int frameCropRightOffset = 0;
84 int frameCropTopOffset = 0;
85 int frameCropBottomOffset = 0;
86 int chromaFormatIdc = 0;
87 int separateColorPlaneFlag = 0;
93 if (profileIdc == 100 || profileIdc == 110 ||
94 profileIdc == 122 || profileIdc == 244 ||
95 profileIdc == 44 || profileIdc == 83 ||
96 profileIdc == 86 || profileIdc == 118) {
99 if (chromaFormatIdc == 3)
100 separateColorPlaneFlag =
ReadBit();
104 int seqScalingMatrixPresentFlag =
ReadBit();
105 if (seqScalingMatrixPresentFlag) {
106 for (
int i = 0; i < 8; i++) {
107 int seqScalingListPresentFlag =
ReadBit();
108 if (seqScalingListPresentFlag) {
109 int sizeOfScalingList = (i < 6) ? 16 : 64;
112 for (
int j = 0; j < sizeOfScalingList; j++) {
113 if (nextScale != 0) {
114 int delta_scale =
ReadSE();
115 nextScale = (lastScale + delta_scale + 256) % 256;
117 lastScale = (nextScale == 0) ? lastScale : nextScale;
125 if (picOrderCntType == 0) {
127 }
else if (picOrderCntType == 1) {
132 for (
int i = 0; i < numRefFramesInPicOrderCntCycle; i++ ) {
140 int frameMbsOnlyFlag =
ReadBit();
141 if (!frameMbsOnlyFlag) {
145 int frameCroppingFlag =
ReadBit();
146 if (frameCroppingFlag) {
156 if (chromaFormatIdc == 0 && separateColorPlaneFlag == 0) {
157 subWidthC = subHeightC = 2;
158 }
else if (chromaFormatIdc == 1 && separateColorPlaneFlag == 0) {
159 subWidthC = subHeightC = 2;
160 }
else if (chromaFormatIdc == 2 && separateColorPlaneFlag == 0) {
163 }
else if (chromaFormatIdc == 3) {
164 if (separateColorPlaneFlag == 0) {
165 subWidthC = subHeightC = 1;
166 }
else if (separateColorPlaneFlag == 1) {
167 subWidthC = subHeightC = 0;
171 *width = ((picWidthInMbsMinusOne + 1) * 16) -
172 subWidthC * (frameCropRightOffset + frameCropLeftOffset);
174 *height = ((2 - frameMbsOnlyFlag)* (picHeightInMapUnitsMinusOne +1) * 16) -
175 subHeightC * ((frameCropBottomOffset * 2) + (frameCropTopOffset * 2));
188 return (
m_pStart[nIndex] >> (8-nOffset)) & 0x01;
195 for (
int i = 0; i < n; i++) {
196 r |= (
ReadBit() << ( n - i - 1 ) );
206 while((
ReadBit() == 0) && (i < 32)) {
Some helper functions header file.
unsigned int ReadSE(void)
unsigned int ReadBit(void)
unsigned int ReadBits(int)
virtual ~cH264Parser(void)
cH264Parser destructor
const unsigned char * m_pStart
void GetDimensions(int *, int *)
Get width and height from stream.
unsigned int ReadExponentialGolombCode(void)
cH264Parser(AVPacket *)
cH264Parser constructor
Logger class header file.