summaryrefslogtreecommitdiff
path: root/libavcodec/dvbsubdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/dvbsubdec.c')
-rw-r--r--libavcodec/dvbsubdec.c169
1 files changed, 0 insertions, 169 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 6e510d12c7..4d4007ffd9 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1381,172 +1381,6 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx,
return 0;
}
-
-#ifdef DEBUG
-static void png_save(DVBSubContext *ctx, const char *filename, uint32_t *bitmap, int w, int h)
-{
- int x, y, v;
- FILE *f;
- char fname[40], fname2[40];
- char command[1024];
-
- snprintf(fname, sizeof(fname), "%s.ppm", filename);
-
- f = fopen(fname, "w");
- if (!f) {
- perror(fname);
- return;
- }
- fprintf(f, "P6\n"
- "%d %d\n"
- "%d\n",
- w, h, 255);
- for(y = 0; y < h; y++) {
- for(x = 0; x < w; x++) {
- v = bitmap[y * w + x];
- putc((v >> 16) & 0xff, f);
- putc((v >> 8) & 0xff, f);
- putc((v >> 0) & 0xff, f);
- }
- }
- fclose(f);
-
-
- snprintf(fname2, sizeof(fname2), "%s-a.pgm", filename);
-
- f = fopen(fname2, "w");
- if (!f) {
- perror(fname2);
- return;
- }
- fprintf(f, "P5\n"
- "%d %d\n"
- "%d\n",
- w, h, 255);
- for(y = 0; y < h; y++) {
- for(x = 0; x < w; x++) {
- v = bitmap[y * w + x];
- putc((v >> 24) & 0xff, f);
- }
- }
- fclose(f);
-
- snprintf(command, sizeof(command), "pnmtopng -alpha %s %s > %s.png 2> /dev/null", fname2, fname, filename);
- if (system(command) != 0) {
- av_log(ctx, AV_LOG_ERROR, "Error running pnmtopng\n");
- return;
- }
-
- snprintf(command, sizeof(command), "rm %s %s", fname, fname2);
- if (system(command) != 0) {
- av_log(ctx, AV_LOG_ERROR, "Error removing %s and %s\n", fname, fname2);
- return;
- }
-}
-
-static int save_display_set(DVBSubContext *ctx)
-{
- DVBSubRegion *region;
- DVBSubRegionDisplay *display;
- const DVBSubCLUT *clut;
- const uint32_t *clut_table;
- int x_pos, y_pos, width, height;
- int x, y, y_off, x_off;
- uint32_t *pbuf;
- char filename[32];
- static int fileno_index = 0;
-
- x_pos = -1;
- y_pos = -1;
- width = 0;
- height = 0;
-
- for (display = ctx->display_list; display; display = display->next) {
- region = get_region(ctx, display->region_id);
-
- if (!region)
- return -1;
-
- if (x_pos == -1) {
- x_pos = display->x_pos;
- y_pos = display->y_pos;
- width = region->width;
- height = region->height;
- } else {
- if (display->x_pos < x_pos) {
- width += (x_pos - display->x_pos);
- x_pos = display->x_pos;
- }
-
- if (display->y_pos < y_pos) {
- height += (y_pos - display->y_pos);
- y_pos = display->y_pos;
- }
-
- if (display->x_pos + region->width > x_pos + width) {
- width = display->x_pos + region->width - x_pos;
- }
-
- if (display->y_pos + region->height > y_pos + height) {
- height = display->y_pos + region->height - y_pos;
- }
- }
- }
-
- if (x_pos >= 0) {
-
- pbuf = av_malloc(width * height * 4);
- if (!pbuf)
- return -1;
-
- for (display = ctx->display_list; display; display = display->next) {
- region = get_region(ctx, display->region_id);
-
- if (!region)
- return -1;
-
- x_off = display->x_pos - x_pos;
- y_off = display->y_pos - y_pos;
-
- clut = get_clut(ctx, region->clut);
-
- if (!clut)
- clut = &default_clut;
-
- switch (region->depth) {
- case 2:
- clut_table = clut->clut4;
- break;
- case 8:
- clut_table = clut->clut256;
- break;
- case 4:
- default:
- clut_table = clut->clut16;
- break;
- }
-
- for (y = 0; y < region->height; y++) {
- for (x = 0; x < region->width; x++) {
- pbuf[((y + y_off) * width) + x_off + x] =
- clut_table[region->pbuf[y * region->width + x]];
- }
- }
-
- }
-
- snprintf(filename, sizeof(filename), "dvbs.%d", fileno_index);
-
- png_save(ctx, filename, pbuf, width, height);
-
- av_freep(&pbuf);
- }
-
- fileno_index++;
- return 0;
-}
-#endif /* DEBUG */
-
static int dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
const uint8_t *buf,
int buf_size)
@@ -1601,9 +1435,6 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
if (ctx->compute_edt == 0)
save_subtitle_set(avctx, sub, got_output);
-#ifdef DEBUG
- save_display_set(ctx);
-#endif
return 0;
}