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

Method getPixelFormat

YUViewLib/src/parser/VVC/ParserAnnexBVVC.cpp:114–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114video::yuv::PixelFormatYUV ParserAnnexBVVC::getPixelFormat() const
115{
116 using Subsampling = video::yuv::Subsampling;
117
118 // Get the subsampling and bit-depth from the sps
119 int bitDepthY = -1;
120 int bitDepthC = -1;
121 auto subsampling = Subsampling::UNKNOWN;
122 for (const auto &nal : this->nalUnitsForSeeking)
123 {
124 if (nal->header.nal_unit_type == vvc::NalType::SPS_NUT)
125 {
126 auto sps = std::dynamic_pointer_cast<seq_parameter_set_rbsp>(nal->rbsp);
127 if (sps->sps_chroma_format_idc == 0)
128 subsampling = Subsampling::YUV_400;
129 else if (sps->sps_chroma_format_idc == 1)
130 subsampling = Subsampling::YUV_420;
131 else if (sps->sps_chroma_format_idc == 2)
132 subsampling = Subsampling::YUV_422;
133 else if (sps->sps_chroma_format_idc == 3)
134 subsampling = Subsampling::YUV_444;
135
136 bitDepthY = sps->sps_bitdepth_minus8 + 8;
137 bitDepthC = sps->sps_bitdepth_minus8 + 8;
138 }
139
140 if (bitDepthY != -1 && bitDepthC != -1 && subsampling != Subsampling::UNKNOWN)
141 {
142 if (bitDepthY != bitDepthC)
143 {
144 // Different luma and chroma bit depths currently not supported
145 return {};
146 }
147 return video::yuv::PixelFormatYUV(subsampling, bitDepthY);
148 }
149 }
150
151 return {};
152}
153
154std::optional<ParserAnnexB::SeekData> ParserAnnexBVVC::getSeekData(int iFrameNr)
155{

Callers 2

allocateDecoderMethod · 0.45

Calls 1

PixelFormatYUVClass · 0.85

Tested by

no test coverage detected