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

Method cacheStatistics

YUViewLib/src/decoder/decoderHM.cpp:465–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463}
464
465void decoderHM::cacheStatistics(libHMDec_picture *img)
466{
467 if (!internalsSupported)
468 return;
469
470 DEBUG_DECHM("decoderHM::cacheStatistics POC %d", this->lib.libHMDEC_get_POC(img));
471
472 // Conversion from intra prediction mode to vector.
473 // Coordinates are in x,y with the axes going right and down.
474 static const int vectorTable[35][2] = {
475 {0, 0}, {0, 0}, {32, -32}, {32, -26}, {32, -21}, {32, -17}, {32, -13}, {32, -9}, {32, -5},
476 {32, -2}, {32, 0}, {32, 2}, {32, 5}, {32, 9}, {32, 13}, {32, 17}, {32, 21}, {32, 26},
477 {32, 32}, {26, 32}, {21, 32}, {17, 32}, {13, 32}, {9, 32}, {5, 32}, {2, 32}, {0, 32},
478 {-2, 32}, {-5, 32}, {-9, 32}, {-13, 32}, {-17, 32}, {-21, 32}, {-26, 32}, {-32, 32}};
479
480 // Get all the statistics
481 // TODO: Could we only retrieve the statistics that are active/displayed?
482 unsigned int nrTypes = this->lib.libHMDEC_get_internal_type_number();
483 for (unsigned int t = 0; t <= nrTypes; t++)
484 {
485 bool callAgain;
486 do
487 {
488 // Get a pointer to the data values and how many values in this array are valid.
489 unsigned int nrValues;
490 auto stats = this->lib.libHMDEC_get_internal_info(decoder, img, t, nrValues, callAgain);
491
492 auto statType = this->lib.libHMDEC_get_internal_type(t);
493 if (stats != nullptr && nrValues > 0)
494 {
495 for (unsigned int i = 0; i < nrValues; i++)
496 {
497 auto b = stats[i];
498
499 if (statType == LIBHMDEC_TYPE_VECTOR)
500 this->statisticsData->at(t).addBlockVector(b.x, b.y, b.w, b.h, b.value, b.value2);
501 else
502 this->statisticsData->at(t).addBlockValue(b.x, b.y, b.w, b.h, b.value);
503 if (statType == LIBHMDEC_TYPE_INTRA_DIR)
504 {
505 // Also add the vecotr to draw
506 if (b.value >= 0 && b.value < 35)
507 {
508 int vecX = (float)vectorTable[b.value][0] * b.w / 4;
509 int vecY = (float)vectorTable[b.value][1] * b.w / 4;
510 this->statisticsData->at(t).addBlockVector(b.x, b.y, b.w, b.h, vecX, vecY);
511 }
512 }
513 }
514 }
515 } while (callAgain); // Continue until the library returns that there is no more to retrive
516 }
517}
518
519void decoderHM::fillStatisticList(stats::StatisticsData &statisticsData) const
520{

Callers

nothing calls this directly

Calls 3

addBlockVectorMethod · 0.80
addBlockValueMethod · 0.80
atMethod · 0.45

Tested by

no test coverage detected