MCPcopy Create free account
hub / github.com/IENT/YUView / getNextFrameFromDecoder

Method getNextFrameFromDecoder

YUViewLib/src/decoder/decoderHM.cpp:266–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266bool decoderHM::getNextFrameFromDecoder()
267{
268 DEBUG_DECHM("decoderHM::getNextFrameFromDecoder");
269
270 currentHMPic = this->lib.libHMDec_get_picture(decoder);
271 if (currentHMPic == nullptr)
272 {
273 decoderState = DecoderState::NeedsMoreData;
274 return false;
275 }
276
277 // Check the validity of the picture
278 auto picSize = Size(this->lib.libHMDEC_get_picture_width(currentHMPic, LIBHMDEC_LUMA),
279 this->lib.libHMDEC_get_picture_height(currentHMPic, LIBHMDEC_LUMA));
280 if (!picSize.isValid())
281 DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got invalid size");
282 auto subsampling =
283 convertFromInternalSubsampling(this->lib.libHMDEC_get_chroma_format(currentHMPic));
284 if (subsampling == video::yuv::Subsampling::UNKNOWN)
285 DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got invalid chroma format");
286 auto bitDepth = functions::clipToUnsigned(
287 this->lib.libHMDEC_get_internal_bit_depth(currentHMPic, LIBHMDEC_LUMA));
288 if (bitDepth < 8 || bitDepth > 16)
289 DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got invalid bit depth");
290
291 if (!frameSize.isValid() && !formatYUV.isValid())
292 {
293 // Set the values
294 frameSize = picSize;
295 formatYUV = video::yuv::PixelFormatYUV(subsampling, bitDepth);
296 }
297 else
298 {
299 // Check the values against the previously set values
300 if (frameSize != picSize)
301 return setErrorB("Received a frame of different size");
302 if (formatYUV.getSubsampling() != subsampling)
303 return setErrorB("Received a frame with different subsampling");
304 if (formatYUV.getBitsPerSample() != bitDepth)
305 return setErrorB("Received a frame with different bit depth");
306 }
307
308 DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got a valid frame");
309 return true;
310}
311
312bool decoderHM::pushData(QByteArray &data)
313{

Callers

nothing calls this directly

Calls 7

SizeClass · 0.85
clipToUnsignedFunction · 0.85
PixelFormatYUVClass · 0.85
isValidMethod · 0.45
getSubsamplingMethod · 0.45
getBitsPerSampleMethod · 0.45

Tested by

no test coverage detected