MCPcopy Create free account
hub / github.com/cisco/openh264 / TestOneSimulcastAVC

Method TestOneSimulcastAVC

test/api/encode_decode_api_test.cpp:124–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124bool EncodeDecodeTestAPIBase::TestOneSimulcastAVC (SEncParamExt* pParam, ISVCDecoder** decoder, unsigned char** pBsBuf,
125 int iSpatialLayerNum,
126 int iEncFrameNum,
127 int iSaveFileIdx) {
128 int aLen[MAX_SPATIAL_LAYER_NUM] = {0, 0, 0, 0};
129
130 FILE* fEnc[MAX_SPATIAL_LAYER_NUM];
131 if (iSaveFileIdx == 1) {
132 fEnc[0] = fopen ("enc00.264", "wb");
133 fEnc[1] = fopen ("enc01.264", "wb");
134 fEnc[2] = fopen ("enc02.264", "wb");
135 fEnc[3] = fopen ("enc03.264", "wb");
136 } else if (iSaveFileIdx > 1) {
137 fEnc[0] = fopen ("enc10.264", "wb");
138 fEnc[1] = fopen ("enc11.264", "wb");
139 fEnc[2] = fopen ("enc12.264", "wb");
140 fEnc[3] = fopen ("enc13.264", "wb");
141 }
142
143 int rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParam);
144 if (rv != cmResultSuccess) {
145 printf ("SetOption Failed, rv = %d\n", rv);
146 return false;
147 }
148
149 int iIdx;
150 //begin testing
151 for (int iFrame = 0; iFrame < iEncFrameNum; iFrame++) {
152 int iResult;
153 int iLayerLen = 0;
154 unsigned char* pData[3] = { NULL };
155
156 if (!InitialEncDec (pParam->iPicWidth, pParam->iPicHeight))
157 return false;
158 EncodeOneFrame (0);
159
160 // init
161 for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
162 aLen[iIdx] = 0;
163 }
164 for (int iLayer = 0; iLayer < info.iLayerNum; ++iLayer) {
165 iLayerLen = 0;
166 const SLayerBSInfo& layerInfo = info.sLayerInfo[iLayer];
167 for (int iNal = 0; iNal < layerInfo.iNalCount; ++iNal) {
168 iLayerLen += layerInfo.pNalLengthInByte[iNal];
169 }
170
171 iIdx = layerInfo.uiSpatialId;
172 EXPECT_TRUE (iIdx < iSpatialLayerNum) << "iIdx = " << iIdx << ", iSpatialLayerNum = " << iSpatialLayerNum;
173 memcpy ((pBsBuf[iIdx] + aLen[iIdx]), layerInfo.pBsBuf, iLayerLen * sizeof (unsigned char));
174 aLen[iIdx] += iLayerLen;
175 }
176
177 for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
178 pData[0] = pData[1] = pData[2] = 0;
179 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
180
181 if (iSaveFileIdx > 0) {

Callers

nothing calls this directly

Calls 2

SetOptionMethod · 0.45
DecodeFrame2Method · 0.45

Tested by

no test coverage detected