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

Function parsePixelDataSubBlock

YUViewLib/src/parser/Subtitles/SubtitleDVB.cpp:277–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277unsigned parsePixelDataSubBlock(SubByteReaderLogging &reader)
278{
279 SubByteReaderLoggingSubLevel s(reader, "pixel-data_sub-block()");
280
281 unsigned data_type = reader.readBits("data_type",
282 8,
283 Options()
284 .withMeaningMap({{0x10, "2-bit/pixel code string"},
285 {0x11, "4-bit/pixel code string"},
286 {0x12, "8-bit/pixel code string"},
287 {0x20, "2_to_4-bit_map-table data"},
288 {0x21, "2_to_8-bit_map-table data"},
289 {0x22, "4_to_8-bit_map-table data"},
290 {0xF0, "end of object line code"}})
291 .withMeaning("reserved"));
292
293 auto end = false;
294 auto bitsRead = 0u;
295 if (data_type == 0x10)
296 {
297 while (!end)
298 {
299 auto [pEnd, pBitsRead] = parse_2_bit_pixel_code_string(reader);
300 end = pEnd;
301 bitsRead += pBitsRead;
302 }
303 while (bitsRead % 8 != 0)
304 {
305 reader.readBits("stuff_bits_2", 2);
306 bitsRead += 2;
307 }
308 }
309 else if (data_type == 0x11)
310 {
311 while (!end)
312 {
313 auto [pEnd, pBitsRead] = parse_4_bit_pixel_code_string(reader);
314 end = pEnd;
315 bitsRead += pBitsRead;
316 }
317 while (bitsRead % 8 != 0)
318 {
319 reader.readBits("stuff_bits_4", 4);
320 bitsRead += 4;
321 }
322 }
323 else if (data_type == 0x12)
324 {
325 while (!end)
326 {
327 auto [pEnd, pBitsRead] = parse_8_bit_pixel_code_string(reader);
328 end = pEnd;
329 bitsRead += pBitsRead;
330 }
331 }
332 else if (data_type == 0x20)
333 {
334 for (unsigned i = 0; i < 2; i++)

Callers 1

parseObjectDataSegmentFunction · 0.85

Calls 6

OptionsClass · 0.85
formatArrayFunction · 0.85
readBitsMethod · 0.45

Tested by

no test coverage detected