| 268 | } |
| 269 | |
| 270 | void 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 | |
| 298 | bool decoderFFmpeg::pushData(QByteArray &data) |
| 299 | { |
no test coverage detected