[FFmpeg-soc] extension of ac3 parser
Michael Niedermayer
michaelni at gmx.at
Sun Apr 20 19:15:19 CEST 2008
On Sun, Apr 20, 2008 at 05:55:17PM +0200, Bartlomiej Wolowiec wrote:
> On niedziela, 20 kwietnia 2008, Michael Niedermayer wrote:
> > Please send seperate patches for seperate things.
> >
> > * adding ff_ac3_parse_channels_info()
> > * adding read_channel_map to ff_ac3_parse_header()
> > * adding parse_header()
> >
> > PS: yes i will not review them unless they are split. Ive tried this
> > with your previous patch as you refused to properly split it but it
> > didnt work out it just got more buggy in each iteration.
> >
> > [...]
>
> Ok, I will split patch. This is the first part:
> adding read_channel_map to ff_ac3_parse_header()
[...]
> Index: libavcodec/ac3tab.c
> ===================================================================
> --- libavcodec/ac3tab.c (wersja 12910)
> +++ libavcodec/ac3tab.c (kopia robocza)
> @@ -247,3 +247,20 @@
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
> 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
> };
> +
> +/**
> + * Default channel map for a dependent substream defined by acmod
> + */
> +const uint16_t ff_eac3_default_chmap[8] = {
> + AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT, // FIXME Ch1+Ch2
> + AC3_CHMAP_CENTER,
> + AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT,
> + AC3_CHMAP_LEFT | AC3_CHMAP_CENTER | AC3_CHMAP_RIGHT,
vertical align (yes ignore 80chars per line)
AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT, // FIXME Ch1+Ch2
AC3_CHMAP_CENTER,
AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT,
AC3_CHMAP_LEFT | AC3_CHMAP_CENTER | AC3_CHMAP_RIGHT,
[...]
> +/** Custom channel map locations bitmask
> + * Other channels described in documentation:
> + * Lc/Rc pair, Lrs/Rrs pair, Ts, Lsd/Rsd pair,
> + * Lw/Rw pair, Lvh/Rvh pair, Cvh, Reserved, LFE2
> + */
> +enum CustomChannelMapLocation{
> + AC3_CHMAP_LEFT = 1<<(15-0),
> + AC3_CHMAP_CENTER = 1<<(15-1),
> + AC3_CHMAP_RIGHT = 1<<(15-2),
> + AC3_CHMAP_LEFT_SURROUND = 1<<(15-3),
> + AC3_CHMAP_RIGHT_SURROUND = 1<<(15-4),
> + AC3_CHMAP_CENTER_SURROUND = 1<<(15-7),
> + AC3_CHMAP_LFE = 1<<(15-15)
> +};
abbreviate these a little please
..._L
..._R
..._C
..._L_SUR
..._R_SUR
..._LFE
are clear IMHO
[...]
> @@ -118,6 +123,30 @@
> hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
> (num_blocks * 256.0));
> hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
> +
> + if(read_channel_map){
> + int i;
> + skip_bits(&gbc, 5); // skip bitstream id
> +
> + /* skip dialog normalization and compression gain */
> + for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
> + skip_bits(&gbc, 5); // skip dialog normalization
> + if (get_bits1(&gbc)) {
> + skip_bits(&gbc, 8); //skip Compression gain word
> + }
> + }
> + /* dependent stream channel map */
> + if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(&gbc)) {
> + uint16_t tmp;
useless variable
> + tmp = get_bits(&gbc, 16); //custom channel map
> + hdr->channel_map = tmp;
[...]
> Index: libavcodec/ac3_parser.h
> ===================================================================
> --- libavcodec/ac3_parser.h (wersja 12910)
> +++ libavcodec/ac3_parser.h (kopia robocza)
> @@ -35,14 +35,15 @@
>
> /**
> * Parses AC-3 frame header.
> - * Parses the header up to the lfeon element, which is the first 52 or 54 bits
> - * depending on the audio coding mode.
> + * Parses the header up to the lfeon element, which is the first 52, 54, or 104 bits
> + * depending on the audio coding mode and read_channel_map.
> * @param buf[in] Array containing the first 7 bytes of the frame.
^^^^^^^
7 bytes and 104 bits ?
> * @param hdr[out] Pointer to struct where header info is written.
> + * @param read_channel_map[in] Determines whether channel_map is to be set
why is this conditional and not always done?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080420/445233ba/attachment.pgp>
More information about the FFmpeg-soc
mailing list