Magic numbers?

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
saintdev
Regular User
Posts: 146
Joined: Wed Dec 20, 2006 4:17 am

Magic numbers?

Post by saintdev »

I'm looking at encoding with 6 channel aac, and am attempting to figure out what's going on first. Can anyone help me figure out what the following magic numbers are for.

From deca52.c:178-181

Code: Select all

    /* 6 blocks per frame, 256 samples per block, 2 channels */
    buf        = hb_buffer_init( 3072 * sizeof( float ) );
    buf->start = pts + ( pos / pv->size ) * 6 * 256 * 90000 / pv->rate;
    buf->stop  = buf->start + 6 * 256 * 90000 / pv->rate;
I understand the 3072 is the 6 blocks * 256 samples * 2 ch.
I assume the 6 and 256 below that are the blocks and samples. What is the 90000 about, though?

Again a52dec.c:190

Code: Select all

        samples_out = ((float *) buf->data) + 512 * i;
I think the 512 is 2ch * 256 samples. Yes/no?

This time encfaac.c:121-122, again we have the 90000.

Code: Select all

    buf->start = pts + 90000 * pos / 2 / sizeof( float ) / pv->job->arate;
    buf->stop  = buf->start + 90000 * pv->input_samples / pv->job->arate / 2;
The 2 I assume is for 2ch, but once again I am unsure what the 90000 is for.

jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

I believe, after some late-night googling, that 90000 represents 90khz, the base frequency of MPEG-2 streams.
Presentation Time Stamps (PTS) of 32 bits with an accuracy of 90 kHz shall be carried in the fixed RTP header. All packets that make up a audio or video frame shall have the same time stamp.
RFC 2250: http://rfc.net/rfc2250.html

It relates to the system clock reference--I think that's the way video players always display frames at a given rate per second, no matter how many megahertz or gigahertz any given processor operates at.

I don't really know what I'm talking about, but some useful search terms will be: PTS, DTS, SCR, 90khz.

Post Reply