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

Method cacheCurStatistics

YUViewLib/src/decoder/decoderFFmpeg.cpp:270–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void decoderFFmpeg::cacheCurStatistics()
271{
272 // Copy the statistics of the current frame to the buffer
273 DEBUG_FFMPEG("decoderFFmpeg::cacheCurStatistics");
274
275 // Try to get the motion information
276 auto sideData = this->ff.getSideData(frame, FFmpeg::AV_FRAME_DATA_MOTION_VECTORS);
277 if (sideData)
278 {
279 const auto nrMVs = sideData.getNumberMotionVectors();
280 for (size_t i = 0; i < nrMVs; i++)
281 {
282 auto mvs = sideData.getMotionVector(unsigned(i));
283
284 // dst marks the center of the current block so the block position is:
285 const int blockX = mvs.dst_x - mvs.w / 2;
286 const int blockY = mvs.dst_y - mvs.h / 2;
287 const int16_t mvX = mvs.dst_x - mvs.src_x;
288 const int16_t mvY = mvs.dst_y - mvs.src_y;
289
290 this->statisticsData->at(mvs.source < 0 ? 0 : 1)
291 .addBlockValue(blockX, blockY, mvs.w, mvs.h, (int)mvs.source);
292 this->statisticsData->at(mvs.source < 0 ? 2 : 3)
293 .addBlockVector(blockX, blockY, mvs.w, mvs.h, mvX, mvY);
294 }
295 }
296}
297
298bool decoderFFmpeg::pushData(QByteArray &data)
299{

Callers 1

getRawFrameDataMethod · 0.95

Calls 6

getSideDataMethod · 0.80
getMotionVectorMethod · 0.80
addBlockValueMethod · 0.80
addBlockVectorMethod · 0.80
atMethod · 0.45

Tested by

no test coverage detected