[FFmpeg-devel] [PATCH 1/2] Decode DTS XXCH extension

Benjamin Larsson benjamin at southpole.se
Tue Jun 26 13:03:04 CEST 2012


On 06/25/2012 08:55 AM, Nick Brereton wrote:

> Attached is an updated version of the patch which also takes care of the
> formatting nits you had, moves all variable declarations to the top of
> functions and expands the comment about XXCH headers differing slightly
> from XCH and core subframe headers.
>
> I'll resend the second patch to take account of this update & clean up
> formatting.
>
> Nick
>


> @@ -1727,6 +1766,58 @@ static int dca_xbr_parse_frame(DCAContext *s)
>      return 0;
>  }
>
> +/* parse initial header for XXCH and dump details */
> +static int dca_xxch_parse_header(DCAContext *s)
> +{
> +    int hdr_size, chhdr_crc, spkmsk_bits, num_chsets, core_spk, hdr_pos;
> +    int i, chset, base_channel, chstart, fsize[8];
> +
> +    /* assume header work has already been parsed */
> +    hdr_pos     = get_bits_count(&s->gb) - 32;
> +    hdr_size    = get_bits(&s->gb, 6) + 1;
> +    chhdr_crc   = get_bits1(&s->gb);
> +    spkmsk_bits = get_bits(&s->gb, 5) + 1;
> +    num_chsets  = get_bits(&s->gb, 2) + 1;
> +
> +    for (i = 0; i < num_chsets; i++)
> +        fsize[i] = get_bits(&s->gb, 14) + 1;
> +
> +    core_spk = get_bits(&s->gb, spkmsk_bits);
> +
> +    s->xxch_spk_layout     = core_spk;
> +    s->xxch_nbits_spk_mask = spkmsk_bits;
> +
> +    /* skip to the end of the header */
> +    i = get_bits_count(&s->gb);
> +    if (hdr_pos + hdr_size * 8 > i)
> +        skip_bits_long(&s->gb, hdr_pos + hdr_size * 8 - i);
> +
> +    for (chset = 0; chset < num_chsets; chset++) {
> +        chstart      = get_bits_count(&s->gb);
> +        base_channel = s->prim_channels;
> +
> +        /* XXCH and Core headers differ, see 6.4.2 "XXCH Channel Set Header" vs.
> +           5.3.2 "Primary Audio Coding Header", DTS Spec 1.3.1 */
> +        dca_parse_audio_coding_header(s, base_channel, 1);
> +
> +        /* decode channel data */
> +        for (i = 0; i < (s->sample_blocks / 8); i++) {
> +            if (dca_decode_block(s, base_channel, i)) {


Here you decode data in a function that is named *_parse_header. Rename 
the function or split out the decode part.

Rest LGTM.

MvH
Benjamin Larsson


More information about the ffmpeg-devel mailing list