[FFmpeg-devel] dca.c: are 16384-byte frames valid?

Alexander E. Patrakov patrakov
Sat Aug 23 11:08:01 CEST 2008


Hello,

consider a 48 kHz DTS stream encoded at 6144000 bps (the highest 
officially-allowed bitrate in the spec). Since each DTS subframe contains 32 
samples for 32 subbands, it expands to 1024 PCM samples. A frame contains at 
least one subframe, let's assume it contains exactly one subframe. 1024 
samples per frame  = 1024 / 48000 seconds per frame. Now let's calculate the 
frame size.

6144000 bps * ((1024 / 48000) seconds per frame = 131072 bits per frame, or 
16384 bytes per frame. So it looks like 16384-byte frames are, in fact, valid 
(otherwise, it is impossible to reach 6144000 bps), and ffmpeg should not 
reject them.

Index: libavcodec/dca.c
===================================================================
--- libavcodec/dca.c	(revision 14913)
+++ libavcodec/dca.c	(working copy)
@@ -69,7 +69,7 @@
 #define HEADER_SIZE 14
 #define CONVERT_BIAS 384
 
-#define DCA_MAX_FRAME_SIZE 16383
+#define DCA_MAX_FRAME_SIZE 16384
 
 /** Bit allocation */
 typedef struct {

OTOH, I have no 6144000 bps DTS files except those produced with my own (known 
buggy) encoder. Also, even at the highest ABITS value (i.e., 26) in each 
channel and subband, it is not possible to fill a frame with 131072 bits 
using just linear independent quantization of each subband sample (i.e., no 
ADPCM, transitions, joint channel coding or extensions). Without such 
advanced things, the achievable maximum is 120493 bits per frame, and the 
rest should be padded by zeros.

-- 
Alexander E. Patrakov




More information about the ffmpeg-devel mailing list