[FFmpeg-cvslog] Merge commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec'
Clément Bœsch
git at videolan.org
Mon Apr 3 22:03:50 EEST 2017
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Mon Apr 3 21:02:54 2017 +0200| [7650bccdb1f608545919216915c385b963bac156] | committer: Clément Bœsch
Merge commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec'
* commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec':
dvbsub: cosmetics: Group all debug code together
Merged-by: Clément Bœsch <u at pkh.me>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7650bccdb1f608545919216915c385b963bac156
---
libavcodec/dvbsubdec.c | 126 ++++++++++++++++++++++++-------------------------
1 file changed, 62 insertions(+), 64 deletions(-)
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 26985dd..b22c7ca 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -35,69 +35,6 @@
#define cm (ff_crop_tab + MAX_NEG_CROP)
-#ifdef DEBUG
-static void png_save(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) {
- fprintf(stderr, "Error running pnmtopng\n");
- return;
- }
-
- snprintf(command, sizeof(command), "rm %s %s", fname, fname2);
- if (system(command) != 0) {
- fprintf(stderr, "Error removing %s and %s\n", fname, fname2);
- return;
- }
-}
-#endif
-
#define RGBA(r,g,b,a) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
typedef struct DVBSubCLUT {
@@ -1395,6 +1332,67 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx,
#ifdef DEBUG
+static void png_save(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) {
+ fprintf(stderr, "Error running pnmtopng\n");
+ return;
+ }
+
+ snprintf(command, sizeof(command), "rm %s %s", fname, fname2);
+ if (system(command) != 0) {
+ fprintf(stderr, "Error removing %s and %s\n", fname, fname2);
+ return;
+ }
+}
+
static int save_display_set(DVBSubContext *ctx)
{
DVBSubRegion *region;
@@ -1496,7 +1494,7 @@ static int save_display_set(DVBSubContext *ctx)
fileno_index++;
return 0;
}
-#endif
+#endif /* DEBUG */
static int dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
const uint8_t *buf,
======================================================================
diff --cc libavcodec/dvbsubdec.c
index 26985dd,c3248c9..b22c7ca
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@@ -1395,6 -1060,67 +1332,67 @@@ static int dvbsub_parse_page_segment(AV
#ifdef DEBUG
+ static void png_save(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) {
- printf("Error running pnmtopng\n");
++ fprintf(stderr, "Error running pnmtopng\n");
+ return;
+ }
+
+ snprintf(command, sizeof(command), "rm %s %s", fname, fname2);
+ if (system(command) != 0) {
- printf("Error removing %s and %s\n", fname, fname2);
++ fprintf(stderr, "Error removing %s and %s\n", fname, fname2);
+ return;
+ }
+ }
+
static int save_display_set(DVBSubContext *ctx)
{
DVBSubRegion *region;
More information about the ffmpeg-cvslog
mailing list