~ubuntu-branches/debian/sid/gstreamer0.10-ffmpeg/sid

« back to all changes in this revision

Viewing changes to gst-libs/ext/ffmpeg/libavcodec/ac3enc.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-02-22 12:24:07 UTC
  • mfrom: (1.1.24 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090222122407-nubojphrd84klmee
Tags: 0.10.6-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * The simplest AC3 encoder
 
2
 * The simplest AC-3 encoder
3
3
 * Copyright (c) 2000 Fabrice Bellard.
4
4
 *
5
5
 * This file is part of FFmpeg.
21
21
 
22
22
/**
23
23
 * @file ac3enc.c
24
 
 * The simplest AC3 encoder.
 
24
 * The simplest AC-3 encoder.
25
25
 */
26
26
//#define DEBUG
27
27
//#define DEBUG_BITALLOC
 
28
#include "libavutil/crc.h"
28
29
#include "avcodec.h"
29
30
#include "bitstream.h"
30
 
#include "crc.h"
31
31
#include "ac3.h"
32
32
 
33
33
typedef struct AC3EncodeContext {
463
463
        for(ch=0;ch<s->nb_all_channels;ch++) {
464
464
            ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0,
465
465
                                      s->nb_coefs[ch], snr_offset,
466
 
                                      s->bit_alloc.floor, bap[i][ch]);
 
466
                                      s->bit_alloc.floor, ff_ac3_bap_tab,
 
467
                                      bap[i][ch]);
467
468
            frame_bits += compute_mantissa_size(s, bap[i][ch],
468
469
                                                 s->nb_coefs[ch]);
469
470
        }
489
490
    uint8_t bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
490
491
    int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
491
492
    int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50];
492
 
    static int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 };
 
493
    static const int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 };
493
494
 
494
495
    /* init default parameters */
495
496
    s->slow_decay_code = 2;
704
705
    return 0;
705
706
}
706
707
 
707
 
/* output the AC3 frame header */
 
708
/* output the AC-3 frame header */
708
709
static void output_frame_header(AC3EncodeContext *s, unsigned char *frame)
709
710
{
710
711
    init_put_bits(&s->pb, frame, AC3_MAX_CODED_FRAME_SIZE);
771
772
    return v & ((1 << qbits)-1);
772
773
}
773
774
 
774
 
/* Output one audio block. There are NB_BLOCKS audio blocks in one AC3
 
775
/* Output one audio block. There are NB_BLOCKS audio blocks in one AC-3
775
776
   frame */
776
777
static void output_audio_block(AC3EncodeContext *s,
777
778
                               uint8_t exp_strategy[AC3_MAX_CHANNELS],
1363
1364
    AC3_encode_frame,
1364
1365
    AC3_encode_close,
1365
1366
    NULL,
1366
 
    .long_name = "ATSC A/52 / AC-3",
 
1367
    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
 
1368
    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
1367
1369
};