MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / dvbsub_parse_pixel_data_block

Function dvbsub_parse_pixel_data_block

libavcodec/dvbsubdec.c:717–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715
716
717static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDisplay *display,
718 const uint8_t *buf, int buf_size, int top_bottom, int non_mod)
719{
720 DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
721
722 DVBSubRegion *region = get_region(ctx, display->region_id);
723 const uint8_t *buf_end = buf + buf_size;
724 uint8_t *pbuf;
725 int x_pos, y_pos;
726 int i;
727
728 uint8_t map2to4[] = { 0x0, 0x7, 0x8, 0xf};
729 uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff};
730 uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
731 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
732 uint8_t *map_table;
733
734 dprintf(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
735 top_bottom ? "bottom" : "top");
736
737#ifdef DEBUG_PACKET_CONTENTS
738 for (i = 0; i < buf_size; i++) {
739 if (i % 16 == 0)
740 av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i);
741
742 av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
743 if (i % 16 == 15)
744 av_log(avctx, AV_LOG_INFO, "\n");
745 }
746
747 if (i % 16)
748 av_log(avctx, AV_LOG_INFO, "\n");
749
750#endif
751
752 if (region == 0)
753 return;
754
755 pbuf = region->pbuf;
756
757 x_pos = display->x_pos;
758 y_pos = display->y_pos;
759
760 if ((y_pos & 1) != top_bottom)
761 y_pos++;
762
763 while (buf < buf_end) {
764 if (x_pos > region->width || y_pos > region->height) {
765 av_log(avctx, AV_LOG_ERROR, "Invalid object location!\n");
766 return;
767 }
768
769 switch (*buf++) {
770 case 0x10:
771 if (region->depth == 8)
772 map_table = map2to8;
773 else if (region->depth == 4)
774 map_table = map2to4;

Callers 1

Calls 5

get_regionFunction · 0.85
av_logFunction · 0.85
dvbsub_read_2bit_stringFunction · 0.85
dvbsub_read_4bit_stringFunction · 0.85
dvbsub_read_8bit_stringFunction · 0.85

Tested by

no test coverage detected