comparison flacenc.c @ 9216:64246d9e583a libavcodec

add a function to calculate a more accurate estimate for maximum FLAC frame size and use the function in the FLAC decoder and FLAC encoder
author jbr
date Sat, 21 Mar 2009 01:54:31 +0000
parents 78b55e071bb9
children 0dce4fe6e6f3
comparison
equal deleted inserted replaced
9215:d6b9123556fb 9216:64246d9e583a
343 } 343 }
344 av_log(avctx, AV_LOG_DEBUG, " lpc precision: %d\n", 344 av_log(avctx, AV_LOG_DEBUG, " lpc precision: %d\n",
345 s->options.lpc_coeff_precision); 345 s->options.lpc_coeff_precision);
346 346
347 /* set maximum encoded frame size in verbatim mode */ 347 /* set maximum encoded frame size in verbatim mode */
348 if(s->channels == 2) { 348 s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
349 s->max_framesize = 14 + ((s->avctx->frame_size * 33 + 7) >> 3); 349 s->channels, 16);
350 } else {
351 s->max_framesize = 14 + (s->avctx->frame_size * s->channels * 2);
352 }
353 350
354 /* initialize MD5 context */ 351 /* initialize MD5 context */
355 s->md5ctx = av_malloc(av_md5_size); 352 s->md5ctx = av_malloc(av_md5_size);
356 if(!s->md5ctx) 353 if(!s->md5ctx)
357 return AVERROR_NOMEM; 354 return AVERROR_NOMEM;