Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2014/01/27 00:24:36... | ... |
@@ -217,7 +217,8 @@ static av_cold int encode_init(AVCodecContext *avctx) |
217 | 217 |
ff_huffyuv_common_init(avctx); |
218 | 218 |
|
219 | 219 |
avctx->extradata = av_mallocz(3*MAX_N + 4); |
220 |
- avctx->stats_out = av_mallocz(21*MAX_N*3 + 4); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132 |
|
220 |
+#define STATS_OUT_SIZE 21*MAX_N*3 + 4 |
|
221 |
+ avctx->stats_out = av_mallocz(STATS_OUT_SIZE); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132 |
|
221 | 222 |
if (!avctx->extradata || !avctx->stats_out) { |
222 | 223 |
av_freep(&avctx->stats_out); |
223 | 224 |
return AVERROR(ENOMEM); |
... | ... |
@@ -938,7 +939,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
938 | 938 |
if ((s->flags&CODEC_FLAG_PASS1) && (s->picture_number & 31) == 0) { |
939 | 939 |
int j; |
940 | 940 |
char *p = avctx->stats_out; |
941 |
- char *end = p + 1024*30; |
|
941 |
+ char *end = p + STATS_OUT_SIZE; |
|
942 | 942 |
for (i = 0; i < 4; i++) { |
943 | 943 |
for (j = 0; j < s->vlc_n; j++) { |
944 | 944 |
snprintf(p, end-p, "%"PRIu64" ", s->stats[i][j]); |