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

Method parseBlockPartition

YUViewLib/src/decoder/decoderDav1d.cpp:900–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898}
899
900void decoderDav1d::parseBlockPartition(Av1Block * blockData,
901 unsigned x,
902 unsigned y,
903 unsigned blockWidth4,
904 unsigned blockHeight4,
905 dav1dFrameInfo &frameInfo)
906{
907 if (y >= frameInfo.sizeInBlocks.height || x >= frameInfo.sizeInBlocks.width)
908 return;
909
910 Av1Block b = blockData[y * frameInfo.b4_stride + x];
911
912 const auto cbPosX = x * 4;
913 const auto cbPosY = y * 4;
914 const auto cbWidth = blockWidth4 * 4;
915 const auto cbHeight = blockHeight4 * 4;
916
917 // Set prediction mode (ID 0)
918 const bool isIntra = (b.intra != 0);
919 const int predMode = isIntra ? 0 : 1;
920 this->statisticsData->at(0).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, predMode);
921
922 bool FrameIsIntra = (frameInfo.frameType == DAV1D_FRAME_TYPE_KEY ||
923 frameInfo.frameType == DAV1D_FRAME_TYPE_INTRA);
924 if (FrameIsIntra)
925 {
926 // Set the segment ID (ID 1)
927 this->statisticsData->at(1).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.seg_id);
928 }
929
930 // Set the skip "flag" (ID 2)
931 this->statisticsData->at(2).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.skip);
932
933 // Set the skip_mode (ID 3)
934 this->statisticsData->at(3).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.skip_mode);
935
936 if (isIntra)
937 {
938 // Set the intra pred mode luma/chrmoa (ID 4, 5)
939 this->statisticsData->at(4).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.y_mode);
940 this->statisticsData->at(5).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.uv_mode);
941
942 // Set the palette size Y/UV (ID 6, 7)
943 this->statisticsData->at(6).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.pal_sz[0]);
944 this->statisticsData->at(7).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.pal_sz[1]);
945
946 // Set the intra angle delta luma/chroma (ID 8, 9)
947 this->statisticsData->at(8).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.y_angle);
948 this->statisticsData->at(9).addBlockValue(cbPosX, cbPosY, cbWidth, cbHeight, b.uv_angle);
949
950 // Calculate and set the intra prediction direction luma/chroma (ID 10, 11)
951 for (int yc = 0; yc < 2; yc++)
952 {
953 int angleDelta = (yc == 0) ? b.y_angle : b.uv_angle;
954 IntraPredMode predMode = (yc == 0) ? (IntraPredMode)b.y_mode : (IntraPredMode)b.uv_mode;
955 auto vec = calculateIntraPredDirection(predMode, angleDelta);
956 if (vec.first == 0 && vec.second == 0)
957 continue;

Callers

nothing calls this directly

Calls 4

TxfmSizeEnum · 0.85
addBlockValueMethod · 0.80
addBlockVectorMethod · 0.80
atMethod · 0.45

Tested by

no test coverage detected