summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/out/bitmap_packer.c11
-rw-r--r--video/out/bitmap_packer.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/video/out/bitmap_packer.c b/video/out/bitmap_packer.c
index 4ea8b0b62a..3f75a72bcb 100644
--- a/video/out/bitmap_packer.c
+++ b/video/out/bitmap_packer.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
+#include <limits.h>
#include <libavutil/common.h>
@@ -170,10 +171,12 @@ int packer_pack(struct bitmap_packer *packer)
}
return packer->w != w_orig || packer->h != h_orig;
}
- if (packer->w <= packer->h && packer->w != packer->w_max)
- packer->w = FFMIN(packer->w * 2, packer->w_max);
- else if (packer->h != packer->h_max)
- packer->h = FFMIN(packer->h * 2, packer->h_max);
+ int w_max = packer->w_max > 0 ? packer->w_max : INT_MAX;
+ int h_max = packer->h_max > 0 ? packer->h_max : INT_MAX;
+ if (packer->w <= packer->h && packer->w != w_max)
+ packer->w = FFMIN(packer->w * 2, w_max);
+ else if (packer->h != h_max)
+ packer->h = FFMIN(packer->h * 2, h_max);
else {
packer->w = w_orig;
packer->h = h_orig;
diff --git a/video/out/bitmap_packer.h b/video/out/bitmap_packer.h
index c9503fe42c..8fd2fce599 100644
--- a/video/out/bitmap_packer.h
+++ b/video/out/bitmap_packer.h
@@ -25,8 +25,6 @@ struct bitmap_packer {
struct sub_bitmaps;
-#define PACKER_MAX_WH 65536
-
// Clear all internal state. Leave the following fields: w_max, h_max
void packer_reset(struct bitmap_packer *packer);