signature:
public class BlockInterpolator { /** * Chroma ( 0,0) */
private static void getChroma00 ( byte [ ] pic , int picW , int picH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int off = y * picW + x ; for ( int j = 0 ; j < blkH ; j ++ ) { arraycopy ( pic , off , blk , blkOff , blkW ) ; off += picW ; blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Chroma ( X , 0) */
private static void getChroma0X ( byte [ ] pels , int picW , int picH , byte [ ] blk , int blkOff , int blkStride , int fullX , int fullY , int fracY , int blkW , int blkH ) { } }

implementation: int w00 = fullY * picW + fullX ; int w01 = w00 + ( fullY < picH - 1 ? picW : 0 ) ; int eMy = 8 - fracY ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) ( ( eMy * pels [ w00 + i ] + fracY * pels [ w01 + i ] + 4 ) >> 3 ) ; } w00 += picW ; w01 += picW ; blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Chroma ( X , 0) */
private static void getChromaX0 ( byte [ ] pels , int picW , int imgH , byte [ ] blk , int blkOff , int blkStride , int fullX , int fullY , int fracX , int blkW , int blkH ) { } }

implementation: int w00 = fullY * picW + fullX ; int w10 = w00 + ( fullX < picW - 1 ? 1 : 0 ) ; int eMx = 8 - fracX ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) ( ( eMx * pels [ w00 + i ] + fracX * pels [ w10 + i ] + 4 ) >> 3 ) ; } w00 += picW ; w10 += picW ; blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Chroma ( X , X ) */
private static void getChromaXX ( byte [ ] pels , int picW , int picH , byte [ ] blk , int blkOff , int blkStride , int fullX , int fullY , int fracX , int fracY , int blkW , int blkH ) { } }

implementation: int w00 = fullY * picW + fullX ; int w01 = w00 + ( fullY < picH - 1 ? picW : 0 ) ; int w10 = w00 + ( fullX < picW - 1 ? 1 : 0 ) ; int w11 = w10 + w01 - w00 ; int eMx = 8 - fracX ; int eMy = 8 - fracY ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) ( ( eMx * eMy * pels [ w00 + i ] + fracX * eMy * pels [ w10 + i ] + eMx * fracY * pels [ w01 + i ] + fracX * fracY * pels [ w11 + i ] + 32 ) >> 6 ) ; } blkOff += blkStride ; w00 += picW ; w01 += picW ; w10 += picW ; w11 += picW ; }


signature:
public class BlockPCE { /** * Decode an array of 4 bit element IDs , optionally interleaved with a
 * stereo / mono switching bit .
 * @ throws IOException */
private void decodeChannelMap ( ChannelMapping layout_map [ ] , int offset , ChannelPosition type , BitReader _in , int n ) { } }

implementation: while ( n -- > 0 ) { RawDataBlockType syn_ele = null ; switch ( type ) { case AAC_CHANNEL_FRONT : case AAC_CHANNEL_BACK : case AAC_CHANNEL_SIDE : syn_ele = RawDataBlockType . values ( ) [ _in . read1Bit ( ) ] ; break ; case AAC_CHANNEL_CC : _in . read1Bit ( ) ; syn_ele = RawDataBlockType . TYPE_CCE ; break ; case AAC_CHANNEL_LFE : syn_ele = RawDataBlockType . TYPE_LFE ; break ; } layout_map [ offset ] . syn_ele = syn_ele ; layout_map [ offset ] . someInt = ( int ) _in . readNBit ( 4 ) ; layout_map [ offset ] . position = type ; offset ++ ; }


signature:
public class Profile { /** * Returns a profile instance for the given index . If the index is not
 * between 1 and 23 inclusive , UNKNOWN is returned .
 * @ return a profile with the given index */
public static Profile forInt ( int i ) { } }

implementation: Profile p ; if ( i <= 0 || i > ALL . length ) p = UNKNOWN ; else p = ALL [ i - 1 ] ; return p ;


signature:
public class BaseResampler { /** * Converts floating point taps to fixed precision taps .
 * @ param taps
 * The 64 bit double representation
 * @ param precBits
 * Precision bits
 * @ param out
 * Taps converted to fixed precision */
public static void normalizeAndGenerateFixedPrecision ( double [ ] taps , int precBits , short [ ] out ) { } }

implementation: double sum = 0 ; for ( int i = 0 ; i < taps . length ; i ++ ) { sum += taps [ i ] ; } int sumFix = 0 ; int precNum = 1 << precBits ; for ( int i = 0 ; i < taps . length ; i ++ ) { double d = ( taps [ i ] * precNum ) / sum + precNum ; int s = ( int ) d ; taps [ i ] = d - s ; out [ i ] = ( short ) ( s - precNum ) ; sumFix += out [ i ] ; } long tapsTaken = 0 ; while ( sumFix < precNum ) { int maxI = - 1 ; for ( int i = 0 ; i < taps . length ; i ++ ) { if ( ( tapsTaken & ( 1 << i ) ) == 0 && ( maxI == - 1 || taps [ i ] > taps [ maxI ] ) ) maxI = i ; } out [ maxI ] ++ ; sumFix ++ ; tapsTaken |= ( 1 << maxI ) ; } for ( int i = 0 ; i < taps . length ; i ++ ) { taps [ i ] += out [ i ] ; if ( ( tapsTaken & ( 1 << i ) ) != 0 ) taps [ i ] -= 1 ; }


signature:
public class BaseResampler { /** * Wrong usage of Javascript keyword : in */
public void resample ( Picture src , Picture dst ) { } }

implementation:
int [ ] temp = tempBuffers . get ( ) ; int taps = nTaps ( ) ; if ( temp == null ) { temp = new int [ toSize . getWidth ( ) * ( fromSize . getHeight ( ) + taps ) ] ; tempBuffers . set ( temp ) ; } for ( int p = 0 ; p < src . getColor ( ) . nComp ; p ++ ) { // Horizontal pass
for ( int y = 0 ; y < src . getPlaneHeight ( p ) + taps ; y ++ ) { for ( int x = 0 ; x < dst . getPlaneWidth ( p ) ; x ++ ) { short [ ] tapsXs = getTapsX ( x ) ; int srcX = ( int ) ( scaleFactorX * x ) - taps / 2 + 1 ; int sum = 0 ; for ( int i = 0 ; i < taps ; i ++ ) { sum += ( getPel ( src , p , srcX + i , y - taps / 2 + 1 ) + 128 ) * tapsXs [ i ] ; } temp [ y * toSize . getWidth ( ) + x ] = sum ; } } // Vertical pass
for ( int y = 0 ; y < dst . getPlaneHeight ( p ) ; y ++ ) { for ( int x = 0 ; x < dst . getPlaneWidth ( p ) ; x ++ ) { short [ ] tapsYs = getTapsY ( y ) ; int srcY = ( int ) ( scaleFactorY * y ) ; int sum = 0 ; for ( int i = 0 ; i < taps ; i ++ ) { sum += temp [ x + ( srcY + i ) * toSize . getWidth ( ) ] * tapsYs [ i ] ; } dst . getPlaneData ( p ) [ y * dst . getPlaneWidth ( p ) + x ] = ( byte ) ( MathUtil . clip ( ( sum + 8192 ) >> 14 , 0 , 255 ) - 128 ) ; } } }


signature:
public class FBT { /** * / * parameter is also called k0 */
public static int qmf_start_channel ( int bs_start_freq , int bs_samplerate_mode , SampleFrequency sample_rate ) { } }

implementation: int startMin = startMinTable [ sample_rate . getIndex ( ) ] ; int offsetIndex = offsetIndexTable [ sample_rate . getIndex ( ) ] ; if ( bs_samplerate_mode != 0 ) { return startMin + OFFSET [ offsetIndex ] [ bs_start_freq ] ; } else { return startMin + OFFSET [ 6 ] [ bs_start_freq ] ; }


signature:
public class FBT { /** * / * parameter is also called k2 */
public static int qmf_stop_channel ( int bs_stop_freq , SampleFrequency sample_rate , int k0 ) { } }

implementation:
if ( bs_stop_freq == 15 ) { return Math . min ( 64 , k0 * 3 ) ; } else if ( bs_stop_freq == 14 ) { return Math . min ( 64 , k0 * 2 ) ; } else { int stopMin = stopMinTable [ sample_rate . getIndex ( ) ] ; /* bs _ stop _ freq < = 13 */
return Math . min ( 64 , stopMin + STOP_OFFSET_TABLE [ sample_rate . getIndex ( ) ] [ Math . min ( bs_stop_freq , 13 ) ] ) ; }


signature:
public class FBT { /** * / * calculate the master frequency table from k0 , k2 , bs _ freq _ scale
 * and bs _ alter _ scale
 * version for bs _ freq _ scale = 0 */
public static int master_frequency_table_fs0 ( SBR sbr , int k0 , int k2 , boolean bs_alter_scale ) { } }

implementation:
int incr ; int k ; int dk ; int nrBands , k2Achieved ; int k2Diff ; int [ ] vDk = new int [ 64 ] ; /* mft only defined for k2 > k0 */
if ( k2 <= k0 ) { sbr . N_master = 0 ; return 1 ; } dk = bs_alter_scale ? 2 : 1 ; if ( bs_alter_scale ) { nrBands = ( ( ( k2 - k0 + 2 ) >> 2 ) << 1 ) ; } else { nrBands = ( ( ( k2 - k0 ) >> 1 ) << 1 ) ; } nrBands = Math . min ( nrBands , 63 ) ; if ( nrBands <= 0 ) return 1 ; k2Achieved = k0 + nrBands * dk ; k2Diff = k2 - k2Achieved ; for ( k = 0 ; k < nrBands ; k ++ ) { vDk [ k ] = dk ; } if ( k2Diff != 0 ) { incr = ( k2Diff > 0 ) ? - 1 : 1 ; k = ( ( k2Diff > 0 ) ? ( nrBands - 1 ) : 0 ) ; while ( k2Diff != 0 ) { vDk [ k ] -= incr ; k += incr ; k2Diff += incr ; } } sbr . f_master [ 0 ] = k0 ; for ( k = 1 ; k <= nrBands ; k ++ ) { sbr . f_master [ k ] = ( sbr . f_master [ k - 1 ] + vDk [ k - 1 ] ) ; } sbr . N_master = nrBands ; sbr . N_master = Math . min ( sbr . N_master , 64 ) ; return 0 ;


signature:
public class FBT { /** * This function finds the number of bands using this formula :
 * bands * log ( a1 / a0 ) / log ( 2.0 ) + 0.5 */
public static int find_bands ( int warp , int bands , int a0 , int a1 ) { } }

implementation: float div = ( float ) Math . log ( 2.0 ) ; if ( warp != 0 ) div *= 1.3f ; return ( int ) ( bands * Math . log ( ( float ) a1 / ( float ) a0 ) / div + 0.5 ) ;


signature:
public class FBT { /** * version for bs _ freq _ scale > 0 */
public static int master_frequency_table ( SBR sbr , int k0 , int k2 , int bs_freq_scale , boolean bs_alter_scale ) { } }

implementation:
int k , bands ; boolean twoRegions ; int k1 ; int nrBand0 , nrBand1 ; int [ ] vDk0 = new int [ 64 ] , vDk1 = new int [ 64 ] ; int [ ] vk0 = new int [ 64 ] , vk1 = new int [ 64 ] ; int [ ] temp1 = { 6 , 5 , 4 } ; float q , qk ; int A_1 ; /* mft only defined for k2 > k0 */
if ( k2 <= k0 ) { sbr . N_master = 0 ; return 1 ; } bands = temp1 [ bs_freq_scale - 1 ] ; if ( ( float ) k2 / ( float ) k0 > 2.2449 ) { twoRegions = true ; k1 = k0 << 1 ; } else { twoRegions = false ; k1 = k2 ; } nrBand0 = ( 2 * find_bands ( 0 , bands , k0 , k1 ) ) ; nrBand0 = Math . min ( nrBand0 , 63 ) ; if ( nrBand0 <= 0 ) return 1 ; q = find_initial_power ( nrBand0 , k0 , k1 ) ; qk = k0 ; A_1 = ( int ) ( qk + 0.5f ) ; for ( k = 0 ; k <= nrBand0 ; k ++ ) { int A_0 = A_1 ; qk *= q ; A_1 = ( int ) ( qk + 0.5f ) ; vDk0 [ k ] = A_1 - A_0 ; } /* needed ? */
// qsort ( vDk0 , nrBand0 , sizeof ( vDk0[0 ] ) , longcmp ) ;
Arrays . sort ( vDk0 , 0 , nrBand0 ) ; vk0 [ 0 ] = k0 ; for ( k = 1 ; k <= nrBand0 ; k ++ ) { vk0 [ k ] = vk0 [ k - 1 ] + vDk0 [ k - 1 ] ; if ( vDk0 [ k - 1 ] == 0 ) return 1 ; } if ( ! twoRegions ) { for ( k = 0 ; k <= nrBand0 ; k ++ ) { sbr . f_master [ k ] = vk0 [ k ] ; } sbr . N_master = nrBand0 ; sbr . N_master = Math . min ( sbr . N_master , 64 ) ; return 0 ; } nrBand1 = ( 2 * find_bands ( 1 /* warped */
, bands , k1 , k2 ) ) ; nrBand1 = Math . min ( nrBand1 , 63 ) ; q = find_initial_power ( nrBand1 , k1 , k2 ) ; qk = k1 ; A_1 = ( int ) ( qk + 0.5f ) ; for ( k = 0 ; k <= nrBand1 - 1 ; k ++ ) { int A_0 = A_1 ; qk *= q ; A_1 = ( int ) ( qk + 0.5f ) ; vDk1 [ k ] = A_1 - A_0 ; } if ( vDk1 [ 0 ] < vDk0 [ nrBand0 - 1 ] ) { int change ; /* needed ? */
// qsort ( vDk1 , nrBand1 + 1 , sizeof ( vDk1[0 ] ) , longcmp ) ;
Arrays . sort ( vDk1 , 0 , nrBand1 + 1 ) ; change = vDk0 [ nrBand0 - 1 ] - vDk1 [ 0 ] ; vDk1 [ 0 ] = vDk0 [ nrBand0 - 1 ] ; vDk1 [ nrBand1 - 1 ] = vDk1 [ nrBand1 - 1 ] - change ; } /* needed ? */
// qsort ( vDk1 , nrBand1 , sizeof ( vDk1[0 ] ) , longcmp ) ;
Arrays . sort ( vDk1 , 0 , nrBand1 ) ; vk1 [ 0 ] = k1 ; for ( k = 1 ; k <= nrBand1 ; k ++ ) { vk1 [ k ] = vk1 [ k - 1 ] + vDk1 [ k - 1 ] ; if ( vDk1 [ k - 1 ] == 0 ) return 1 ; } sbr . N_master = nrBand0 + nrBand1 ; sbr . N_master = Math . min ( sbr . N_master , 64 ) ; for ( k = 0 ; k <= nrBand0 ; k ++ ) { sbr . f_master [ k ] = vk0 [ k ] ; } for ( k = nrBand0 + 1 ; k <= sbr . N_master ; k ++ ) { sbr . f_master [ k ] = vk1 [ k - nrBand0 ] ; } return 0 ;


signature:
public class FBT { /** * / * calculate the derived frequency border tables from f _ master */
public static int derived_frequency_table ( SBR sbr , int bs_xover_band , int k2 ) { } }

implementation:
int k , i = 0 ; int minus ; /* The following relation shall be satisfied : bs _ xover _ band < N _ Master */
if ( sbr . N_master <= bs_xover_band ) return 1 ; sbr . N_high = sbr . N_master - bs_xover_band ; sbr . N_low = ( sbr . N_high >> 1 ) + ( sbr . N_high - ( ( sbr . N_high >> 1 ) << 1 ) ) ; sbr . n [ 0 ] = sbr . N_low ; sbr . n [ 1 ] = sbr . N_high ; for ( k = 0 ; k <= sbr . N_high ; k ++ ) { sbr . f_table_res [ HI_RES ] [ k ] = sbr . f_master [ k + bs_xover_band ] ; } sbr . M = sbr . f_table_res [ HI_RES ] [ sbr . N_high ] - sbr . f_table_res [ HI_RES ] [ 0 ] ; sbr . kx = sbr . f_table_res [ HI_RES ] [ 0 ] ; if ( sbr . kx > 32 ) return 1 ; if ( sbr . kx + sbr . M > 64 ) return 1 ; minus = ( ( sbr . N_high & 1 ) != 0 ) ? 1 : 0 ; for ( k = 0 ; k <= sbr . N_low ; k ++ ) { if ( k == 0 ) i = 0 ; else i = ( 2 * k - minus ) ; sbr . f_table_res [ LO_RES ] [ k ] = sbr . f_table_res [ HI_RES ] [ i ] ; } sbr . N_Q = 0 ; if ( sbr . bs_noise_bands == 0 ) { sbr . N_Q = 1 ; } else { sbr . N_Q = ( Math . max ( 1 , find_bands ( 0 , sbr . bs_noise_bands , sbr . kx , k2 ) ) ) ; sbr . N_Q = Math . min ( 5 , sbr . N_Q ) ; } for ( k = 0 ; k <= sbr . N_Q ; k ++ ) { if ( k == 0 ) { i = 0 ; } else { /* i = i + ( int32 _ t ) ( ( sbr . N _ low - i ) / ( sbr . N _ Q + 1 - k ) ) ; */
i += ( sbr . N_low - i ) / ( sbr . N_Q + 1 - k ) ; } sbr . f_table_noise [ k ] = sbr . f_table_res [ LO_RES ] [ i ] ; } /* build table for mapping k to g in hf patching */
for ( k = 0 ; k < 64 ; k ++ ) { int g ; for ( g = 0 ; g < sbr . N_Q ; g ++ ) { if ( ( sbr . f_table_noise [ g ] <= k ) && ( k < sbr . f_table_noise [ g + 1 ] ) ) { sbr . table_map_k_to_g [ k ] = g ; break ; } } } return 0 ;


signature:
public class SegmentReader { /** * Reads one full segment till the next marker . Will read as much data as
 * the provided buffer fits , if the provided buffer doesn ' t fit all data
 * will return MORE _ DATA .
 * @ param out
 * @ return
 * @ throws IOException */
public final State readToNextMarkerPartial ( ByteBuffer out ) throws IOException { } }

implementation: if ( done ) return State . STOP ; int skipOneMarker = curMarker >= 0x100 && curMarker <= 0x1ff ? 1 : 0 ; int written = out . position ( ) ; do { while ( buf . hasRemaining ( ) ) { if ( curMarker >= 0x100 && curMarker <= 0x1ff ) { if ( skipOneMarker == 0 ) { return State . DONE ; } -- skipOneMarker ; } if ( ! out . hasRemaining ( ) ) return State . MORE_DATA ; out . put ( ( byte ) ( curMarker >>> 24 ) ) ; curMarker = ( curMarker << 8 ) | ( buf . get ( ) & 0xff ) ; } buf = NIOUtils . fetchFromChannel ( channel , fetchSize ) ; pos += buf . remaining ( ) ; } while ( buf . hasRemaining ( ) ) ; written = out . position ( ) - written ; if ( written > 0 && curMarker >= 0x100 && curMarker <= 0x1ff ) return State . DONE ; for ( ; bytesInMarker > 0 && out . hasRemaining ( ) ; ) { out . put ( ( byte ) ( curMarker >>> 24 ) ) ; curMarker = ( curMarker << 8 ) ; -- bytesInMarker ; if ( curMarker >= 0x100 && curMarker <= 0x1ff ) return State . DONE ; } if ( bytesInMarker == 0 ) { done = true ; return State . STOP ; } else { return State . MORE_DATA ; }


signature:
public class SegmentReader { /** * Reads one full segment till the next marker . Will allocate the necessary
 * buffer to hold the full segment . Internally uses a growing collection of
 * smaller buffers since the segment size is intitially unkwnown .
 * @ return
 * @ throws IOException */
public ByteBuffer readToNextMarkerNewBuffer ( ) throws IOException { } }

implementation: if ( done ) return null ; List < ByteBuffer > buffers = new ArrayList < ByteBuffer > ( ) ; readToNextMarkerBuffers ( buffers ) ; return NIOUtils . combineBuffers ( buffers ) ;


signature:
public class VPXBooleanDecoder { /** * There is a method in the class ( or one of its parents ) having the same name with the method named [ readTree ] but is less generic */
public int readTree3 ( int [ ] tree , int prob0 , int prob1 ) { } }

implementation: int i = 0 ; if ( ( i = tree [ i + readBit ( prob0 ) ] ) > 0 ) { while ( ( i = tree [ i + readBit ( prob1 ) ] ) > 0 ) ; } return - i ; /* negate the return value */


signature:
public class ImageSequenceDemuxer { /** * Finds maximum frame of a sequence by bisecting the range .
 * Performs at max at max 48 Stat calls ( 2 * log2 ( MAX _ MAX ) ) .
 * @ return */
public int getMaxAvailableFrame ( ) { } }

implementation: if ( maxAvailableFrame == - 1 ) { int firstPoint = 0 ; for ( int i = MAX_MAX ; i > 0 ; i /= 2 ) { if ( new File ( String . format ( namePattern , i ) ) . exists ( ) ) { firstPoint = i ; break ; } } int pos = firstPoint ; for ( int interv = firstPoint / 2 ; interv > 1 ; interv /= 2 ) { if ( new File ( String . format ( namePattern , pos + interv ) ) . exists ( ) ) { pos += interv ; } } maxAvailableFrame = pos ; Logger . info ( "Max frame found: " + maxAvailableFrame ) ; } return Math . min ( maxAvailableFrame , maxFrames ) ;


signature:
public class IntDCT { /** * Pass 2 : process rows from work array , store into output array .
 * Note that we must descale the results by a factor of 8 = = 23 , and also
 * undo the PASS1 _ BITS scaling . */
private static void pass2 ( IntBuffer outptr , IntBuffer wsptr ) { } }

implementation:
for ( int ctr = 0 ; ctr < DCTSIZE ; ctr ++ ) { /* Even part : reverse the even part of the forward DCT . */
/* The rotator is sqrt ( 2 ) c ( - 6 ) . */
int z2 = wsptr . get ( 2 ) ; int z3 = wsptr . get ( 6 ) ; int z1 = MULTIPLY ( z2 + z3 , FIX_0_541196100 ) ; int tmp2 = z1 + MULTIPLY ( z3 , - FIX_1_847759065 ) ; int tmp3 = z1 + MULTIPLY ( z2 , FIX_0_765366865 ) ; int tmp0 = ( ( int ) wsptr . get ( 0 ) + ( int ) wsptr . get ( 4 ) ) << CONST_BITS ; int tmp1 = ( ( int ) wsptr . get ( 0 ) - ( int ) wsptr . get ( 4 ) ) << CONST_BITS ; int tmp10 = tmp0 + tmp3 ; int tmp13 = tmp0 - tmp3 ; int tmp11 = tmp1 + tmp2 ; int tmp12 = tmp1 - tmp2 ; /* * Odd part per figure 8 ; the matrix is unitary and hence its
 * transpose is its inverse . i0 . . i3 are y7 , y5 , y3 , y1 respectively . */
tmp0 = ( int ) wsptr . get ( 7 ) ; tmp1 = ( int ) wsptr . get ( 5 ) ; tmp2 = ( int ) wsptr . get ( 3 ) ; tmp3 = ( int ) wsptr . get ( 1 ) ; z1 = tmp0 + tmp3 ; z2 = tmp1 + tmp2 ; z3 = tmp0 + tmp2 ; int z4 = tmp1 + tmp3 ; int z5 = MULTIPLY ( z3 + z4 , FIX_1_175875602 ) ; /* sqrt ( 2 ) c3 */
tmp0 = MULTIPLY ( tmp0 , FIX_0_298631336 ) ; /* sqrt ( 2 ) ( - c1 + c3 + c5 - c7) */
tmp1 = MULTIPLY ( tmp1 , FIX_2_053119869 ) ; /* sqrt ( 2 ) ( c1 + c3 - c5 + c7) */
tmp2 = MULTIPLY ( tmp2 , FIX_3_072711026 ) ; /* sqrt ( 2 ) ( c1 + c3 + c5 - c7) */
tmp3 = MULTIPLY ( tmp3 , FIX_1_501321110 ) ; /* sqrt ( 2 ) ( c1 + c3 - c5 - c7) */
z1 = MULTIPLY ( z1 , - FIX_0_899976223 ) ; /* sqrt ( 2 ) ( c7 - c3) */
z2 = MULTIPLY ( z2 , - FIX_2_562915447 ) ; /* sqrt ( 2 ) ( - c1 - c3) */
z3 = MULTIPLY ( z3 , - FIX_1_961570560 ) ; /* sqrt ( 2 ) ( - c3 - c5) */
z4 = MULTIPLY ( z4 , - FIX_0_390180644 ) ; /* sqrt ( 2 ) ( c5 - c3) */
z3 += z5 ; z4 += z5 ; tmp0 += z1 + z3 ; tmp1 += z2 + z4 ; tmp2 += z2 + z3 ; tmp3 += z1 + z4 ; /* Final output stage : inputs are tmp10 . . tmp13 , tmp0 . . tmp3 */
int D = CONST_BITS + PASS1_BITS + 3 ; outptr . put ( range_limit ( DESCALE ( tmp10 + tmp3 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp11 + tmp2 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp12 + tmp1 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp13 + tmp0 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp13 - tmp0 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp12 - tmp1 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp11 - tmp2 , D ) & RANGE_MASK ) ) ; outptr . put ( range_limit ( DESCALE ( tmp10 - tmp3 , D ) & RANGE_MASK ) ) ; wsptr = doAdvance ( wsptr , DCTSIZE ) ; /* advance pointer to next row */
}


signature:
public class IntDCT { /** * / * Allocate and fill in the sample _ range _ limit table */
private static void prepare_range_limit_table ( ) { } }

implementation: sample_range_limit . position ( 256 ) ; for ( int i = 0 ; i < 128 ; i ++ ) { sample_range_limit . put ( i ) ; } for ( int i = - 128 ; i < 0 ; i ++ ) { sample_range_limit . put ( i ) ; } for ( int i = 0 ; i < 256 + 128 ; i ++ ) { sample_range_limit . put ( - 1 ) ; } for ( int i = 0 ; i < 256 + 128 ; i ++ ) { sample_range_limit . put ( 0 ) ; } for ( int i = 0 ; i < 128 ; i ++ ) { sample_range_limit . put ( i ) ; } for ( int i = 0 ; i < idct_sample_range_limit . capacity ( ) ; i ++ ) { idct_sample_range_limit . put ( sample_range_limit . get ( i + 128 ) & 0xff ) ; }


signature:
public class InplaceMP4Editor { /** * Tries to modify movie header in place according to what ' s implemented in
 * the edit , the file gets pysically modified if the operation is
 * successful . No temporary file is created .
 * @ param file
 * A file to be modified
 * @ param edit
 * An edit to be carried out on a movie header
 * @ return Whether or not edit was successful , i . e . was there enough place
 * to put the new header
 * @ throws IOException
 * @ throws Exception */
public boolean modify ( File file , MP4Edit edit ) throws IOException { } }

implementation:
SeekableByteChannel fi = null ; try { fi = NIOUtils . rwChannel ( file ) ; List < Tuple . _2 < Atom , ByteBuffer > > fragments = doTheFix ( fi , edit ) ; if ( fragments == null ) return false ; // If everything is clean , only then actually writing stuff to the
// file
for ( Tuple . _2 < Atom , ByteBuffer > fragment : fragments ) { replaceBox ( fi , fragment . v0 , fragment . v1 ) ; } return true ; } finally { NIOUtils . closeQuietly ( fi ) ; }


signature:
public class InplaceMP4Editor { /** * Tries to modify movie header in place according to what ' s implemented in
 * the edit . Copies modified contents to a new file .
 * Note : The header is still edited in - place , so the new file will have
 * all - the - same sample offsets .
 * Note : Still subject to the same limitations as ' modify ' , i . e . the new
 * header must ' fit ' into an old place .
 * This method is useful when you can ' t write to the original file , for ex .
 * you don ' t have permission .
 * @ param src
 * An original file
 * @ param dst
 * A file to store the modified copy
 * @ param edit
 * An edit logic to apply
 * @ return
 * @ throws IOException */
public boolean copy ( File src , File dst , MP4Edit edit ) throws IOException { } }

implementation:
SeekableByteChannel fi = null ; SeekableByteChannel fo = null ; try { fi = NIOUtils . readableChannel ( src ) ; fo = NIOUtils . writableChannel ( dst ) ; List < Tuple . _2 < Atom , ByteBuffer > > fragments = doTheFix ( fi , edit ) ; if ( fragments == null ) return false ; List < _2 < Long , ByteBuffer > > fragOffsets = Tuple . _2map0 ( fragments , new Tuple . Mapper < Atom , Long > ( ) { public Long map ( Atom t ) { return t . getOffset ( ) ; } } ) ; // If everything is clean , only then actually start writing file
Map < Long , ByteBuffer > rewrite = Tuple . asMap ( fragOffsets ) ; for ( Atom atom : MP4Util . getRootAtoms ( fi ) ) { ByteBuffer byteBuffer = rewrite . get ( atom . getOffset ( ) ) ; if ( byteBuffer != null ) fo . write ( byteBuffer ) ; else atom . copy ( fi , fo ) ; } return true ; } finally { NIOUtils . closeQuietly ( fi ) ; NIOUtils . closeQuietly ( fo ) ; }


signature:
public class HFGeneration { /** * / * calculate linear prediction coefficients using the covariance method */
private static void calc_prediction_coef ( SBR sbr , float [ ] [ ] [ ] Xlow , float [ ] [ ] alpha_0 , float [ ] [ ] alpha_1 , int k ) { } }


signature:
public class HFGeneration { /** * / * FIXED POINT : bwArray = COEF */
private static void calc_chirp_factors ( SBR sbr , int ch ) { } }

implementation: int i ; for ( i = 0 ; i < sbr . N_Q ; i ++ ) { sbr . bwArray [ ch ] [ i ] = mapNewBw ( sbr . bs_invf_mode [ ch ] [ i ] , sbr . bs_invf_mode_prev [ ch ] [ i ] ) ; if ( sbr . bwArray [ ch ] [ i ] < sbr . bwArray_prev [ ch ] [ i ] ) sbr . bwArray [ ch ] [ i ] = ( sbr . bwArray [ ch ] [ i ] * 0.75f ) + ( sbr . bwArray_prev [ ch ] [ i ] * 0.25f ) ; else sbr . bwArray [ ch ] [ i ] = ( sbr . bwArray [ ch ] [ i ] * 0.90625f ) + ( sbr . bwArray_prev [ ch ] [ i ] * 0.09375f ) ; if ( sbr . bwArray [ ch ] [ i ] < 0.015625f ) sbr . bwArray [ ch ] [ i ] = 0.0f ; if ( sbr . bwArray [ ch ] [ i ] >= 0.99609375f ) sbr . bwArray [ ch ] [ i ] = 0.99609375f ; sbr . bwArray_prev [ ch ] [ i ] = sbr . bwArray [ ch ] [ i ] ; sbr . bs_invf_mode_prev [ ch ] [ i ] = sbr . bs_invf_mode [ ch ] [ i ] ; }


signature:
public class ICSInfo { /** * / * = = = = = decoding = = = = = */
public void decode ( IBitStream _in , AACDecoderConfig conf , boolean commonWindow ) throws AACException { } }

implementation:
final SampleFrequency sf = conf . getSampleFrequency ( ) ; if ( sf . equals ( SampleFrequency . SAMPLE_FREQUENCY_NONE ) ) throw new AACException ( "invalid sample frequency" ) ; _in . skipBit ( ) ; // reserved
windowSequence = windowSequenceFromInt ( _in . readBits ( 2 ) ) ; windowShape [ PREVIOUS ] = windowShape [ CURRENT ] ; windowShape [ CURRENT ] = _in . readBit ( ) ; windowGroupCount = 1 ; windowGroupLength [ 0 ] = 1 ; if ( windowSequence . equals ( WindowSequence . EIGHT_SHORT_SEQUENCE ) ) { maxSFB = _in . readBits ( 4 ) ; int i ; for ( i = 0 ; i < 7 ; i ++ ) { if ( _in . readBool ( ) ) windowGroupLength [ windowGroupCount - 1 ] ++ ; else { windowGroupCount ++ ; windowGroupLength [ windowGroupCount - 1 ] = 1 ; } } windowCount = 8 ; swbOffsets = SWB_OFFSET_SHORT_WINDOW [ sf . getIndex ( ) ] ; swbCount = SWB_SHORT_WINDOW_COUNT [ sf . getIndex ( ) ] ; predictionDataPresent = false ; } else { maxSFB = _in . readBits ( 6 ) ; windowCount = 1 ; swbOffsets = SWB_OFFSET_LONG_WINDOW [ sf . getIndex ( ) ] ; swbCount = SWB_LONG_WINDOW_COUNT [ sf . getIndex ( ) ] ; predictionDataPresent = _in . readBool ( ) ; if ( predictionDataPresent ) readPredictionData ( _in , conf . getProfile ( ) , sf , commonWindow ) ; }


signature:
public class QTTimeUtil { /** * Calculates track duration considering edits
 * @ param track
 * @ return */
public static long getEditedDuration ( TrakBox track ) { } }

implementation: List < Edit > edits = track . getEdits ( ) ; if ( edits == null ) return track . getDuration ( ) ; long duration = 0 ; for ( Edit edit : edits ) { duration += edit . getDuration ( ) ; } return duration ;


signature:
public class QTTimeUtil { /** * Finds timevalue of a frame number
 * might be an expensive operation sinse it traverses compressed time to
 * sample table
 * @ param frameNumber
 * @ return */
public static long frameToTimevalue ( TrakBox trak , int frameNumber ) { } }

implementation: TimeToSampleBox stts = NodeBox . findFirstPath ( trak , TimeToSampleBox . class , Box . path ( "mdia.minf.stbl.stts" ) ) ; TimeToSampleEntry [ ] timeToSamples = stts . getEntries ( ) ; long pts = 0 ; int sttsInd = 0 , sttsSubInd = frameNumber ; while ( sttsSubInd >= timeToSamples [ sttsInd ] . getSampleCount ( ) ) { sttsSubInd -= timeToSamples [ sttsInd ] . getSampleCount ( ) ; pts += timeToSamples [ sttsInd ] . getSampleCount ( ) * timeToSamples [ sttsInd ] . getSampleDuration ( ) ; sttsInd ++ ; } return pts + timeToSamples [ sttsInd ] . getSampleDuration ( ) * sttsSubInd ;


signature:
public class QTTimeUtil { /** * Finds frame by timevalue
 * @ param tv
 * @ return */
public static int timevalueToFrame ( TrakBox trak , long tv ) { } }

implementation: TimeToSampleEntry [ ] tts = NodeBox . findFirstPath ( trak , TimeToSampleBox . class , Box . path ( "mdia.minf.stbl.stts" ) ) . getEntries ( ) ; int frame = 0 ; for ( int i = 0 ; tv > 0 && i < tts . length ; i ++ ) { long rem = tv / tts [ i ] . getSampleDuration ( ) ; tv -= tts [ i ] . getSampleCount ( ) * tts [ i ] . getSampleDuration ( ) ; frame += tv > 0 ? tts [ i ] . getSampleCount ( ) : rem ; } return frame ;


signature:
public class QTTimeUtil { /** * Converts media timevalue to edited timevalue
 * @ param trak
 * @ param mediaTv
 * @ param movieTimescale
 * @ return */
public static long mediaToEdited ( TrakBox trak , long mediaTv , int movieTimescale ) { } }

implementation: if ( trak . getEdits ( ) == null ) return mediaTv ; long accum = 0 ; for ( Edit edit : trak . getEdits ( ) ) { if ( mediaTv < edit . getMediaTime ( ) ) return accum ; long duration = trak . rescale ( edit . getDuration ( ) , movieTimescale ) ; if ( edit . getMediaTime ( ) != - 1 && ( mediaTv >= edit . getMediaTime ( ) && mediaTv < edit . getMediaTime ( ) + duration ) ) { accum += mediaTv - edit . getMediaTime ( ) ; break ; } accum += duration ; } return accum ;


signature:
public class QTTimeUtil { /** * Converts edited timevalue to media timevalue
 * @ param trak
 * @ param mediaTv
 * @ param movieTimescale
 * @ return */
public static long editedToMedia ( TrakBox trak , long editedTv , int movieTimescale ) { } }

implementation: if ( trak . getEdits ( ) == null ) return editedTv ; long accum = 0 ; for ( Edit edit : trak . getEdits ( ) ) { long duration = trak . rescale ( edit . getDuration ( ) , movieTimescale ) ; if ( accum + duration > editedTv ) { return edit . getMediaTime ( ) + editedTv - accum ; } accum += duration ; } return accum ;


signature:
public class QTTimeUtil { /** * Calculates frame number as it shows in quicktime player
 * @ param movie
 * @ param mediaFrameNo
 * @ return */
public static int qtPlayerFrameNo ( MovieBox movie , int mediaFrameNo ) { } }

implementation: TrakBox videoTrack = movie . getVideoTrack ( ) ; long editedTv = mediaToEdited ( videoTrack , frameToTimevalue ( videoTrack , mediaFrameNo ) , movie . getTimescale ( ) ) ; return tv2QTFrameNo ( movie , editedTv ) ;


signature:
public class QTTimeUtil { /** * Calculates and formats standard time as in Quicktime player
 * @ param movie
 * @ param mediaFrameNo
 * @ return */
public static String qtPlayerTime ( MovieBox movie , int mediaFrameNo ) { } }

implementation: TrakBox videoTrack = movie . getVideoTrack ( ) ; long editedTv = mediaToEdited ( videoTrack , frameToTimevalue ( videoTrack , mediaFrameNo ) , movie . getTimescale ( ) ) ; int sec = ( int ) ( editedTv / videoTrack . getTimescale ( ) ) ; return String . format ( "%02d" , sec / 3600 ) + "_" + String . format ( "%02d" , ( sec % 3600 ) / 60 ) + "_" + String . format ( "%02d" , sec % 60 ) ;


signature:
public class QTTimeUtil { /** * Calculates and formats tape timecode as in Quicktime player
 * @ param timecodeTrack
 * @ param tv
 * @ param startCounter
 * @ return
 * @ throws IOException */
public static String qtPlayerTimecodeFromMovie ( MovieBox movie , TimecodeMP4DemuxerTrack timecodeTrack , int mediaFrameNo ) throws IOException { } }

implementation: TrakBox videoTrack = movie . getVideoTrack ( ) ; long editedTv = mediaToEdited ( videoTrack , frameToTimevalue ( videoTrack , mediaFrameNo ) , movie . getTimescale ( ) ) ; TrakBox tt = timecodeTrack . getBox ( ) ; int ttTimescale = tt . getTimescale ( ) ; long ttTv = editedToMedia ( tt , editedTv * ttTimescale / videoTrack . getTimescale ( ) , movie . getTimescale ( ) ) ; return formatTimecode ( timecodeTrack . getBox ( ) , timecodeTrack . getStartTimecode ( ) + timevalueToTimecodeFrame ( timecodeTrack . getBox ( ) , new RationalLarge ( ttTv , ttTimescale ) , movie . getTimescale ( ) ) ) ;


signature:
public class QTTimeUtil { /** * Calculates and formats tape timecode as in Quicktime player
 * @ param timecodeTrack
 * @ param tv
 * @ param startCounter
 * @ return
 * @ throws IOException */
public static String qtPlayerTimecode ( TimecodeMP4DemuxerTrack timecodeTrack , RationalLarge tv , int movieTimescale ) throws IOException { } }

implementation: TrakBox tt = timecodeTrack . getBox ( ) ; int ttTimescale = tt . getTimescale ( ) ; long ttTv = editedToMedia ( tt , tv . multiplyS ( ttTimescale ) , movieTimescale ) ; return formatTimecode ( timecodeTrack . getBox ( ) , timecodeTrack . getStartTimecode ( ) + timevalueToTimecodeFrame ( timecodeTrack . getBox ( ) , new RationalLarge ( ttTv , ttTimescale ) , movieTimescale ) ) ;


signature:
public class QTTimeUtil { /** * Converts timevalue to frame number based on timecode track
 * @ param timecodeTrack
 * @ param tv
 * @ return */
public static int timevalueToTimecodeFrame ( TrakBox timecodeTrack , RationalLarge tv , int movieTimescale ) { } }

implementation: TimecodeSampleEntry se = ( TimecodeSampleEntry ) timecodeTrack . getSampleEntries ( ) [ 0 ] ; return ( int ) ( ( 2 * tv . multiplyS ( se . getTimescale ( ) ) / se . getFrameDuration ( ) ) + 1 ) / 2 ;


signature:
public class QTTimeUtil { /** * Formats tape timecode based on frame counter
 * @ param timecodeTrack
 * @ param counter
 * @ return */
public static String formatTimecode ( TrakBox timecodeTrack , int counter ) { } }

implementation: TimecodeSampleEntry tmcd = NodeBox . findFirstPath ( timecodeTrack , TimecodeSampleEntry . class , Box . path ( "mdia.minf.stbl.stsd.tmcd" ) ) ; byte nf = tmcd . getNumFrames ( ) ; String tc = String . format ( "%02d" , counter % nf ) ; counter /= nf ; tc = String . format ( "%02d" , counter % 60 ) + ":" + tc ; counter /= 60 ; tc = String . format ( "%02d" , counter % 60 ) + ":" + tc ; counter /= 60 ; tc = String . format ( "%02d" , counter ) + ":" + tc ; return tc ;


signature:
public class Packed4BitList { /** * Creates packed 4bit list with 7 values in it
 * @ return */
public static int _7 ( int val0 , int val1 , int val2 , int val3 , int val4 , int val5 , int val6 ) { } }


signature:
public class Packed4BitList { /** * Sets a 4 bit value into the list
 * @ param list
 * @ param val
 * @ param n
 * @ return */
public static int set ( int list , int val , int n ) { } }

implementation: int cnt = ( list >> 28 ) & 0xf ; int newc = n + 1 ; cnt = newc > cnt ? newc : cnt ; return ( list & CLEAR_MASK [ n ] ) | ( ( val & 0xff ) << ( n << 2 ) ) | ( cnt << 28 ) ;


signature:
public class ColorSpace { /** * Determines if two colors match . Aside from simply comparing the objects
 * this function also takes into account lables ANY , ANY _ INTERLEAVED , ANY
 * PLANAR .
 * @ param inputColor
 * @ return True if the color is the same or matches the label . */
public boolean matches ( ColorSpace inputColor ) { } }

implementation: if ( inputColor == this ) return true ; if ( inputColor == ANY || this == ANY ) return true ; if ( ( inputColor == ANY_INTERLEAVED || this == ANY_INTERLEAVED || inputColor == ANY_PLANAR || this == ANY_PLANAR ) && inputColor . planar == this . planar ) return true ; return false ;


signature:
public class ColorSpace { /** * Calculates the component size based on the fullt size and color subsampling of the given component index .
 * @ param size
 * @ return Component size */
public Size compSize ( Size size , int comp ) { } }

implementation: if ( compWidth [ comp ] == 0 && compHeight [ comp ] == 0 ) return size ; return new Size ( size . getWidth ( ) >> compWidth [ comp ] , size . getHeight ( ) >> compHeight [ comp ] ) ;


signature:
public class FrameGrab { /** * Get frame at current position in JCodec native image
 * @ return A decoded picture with metadata .
 * @ throws IOException */
public PictureWithMetadata getNativeFrameWithMetadata ( ) throws IOException { } }

implementation: Packet frame = videoTrack . nextFrame ( ) ; if ( frame == null ) return null ; Picture picture = decoder . decodeFrame ( frame , getBuffer ( ) ) ; return new PictureWithMetadata ( picture , frame . getPtsD ( ) , frame . getDurationD ( ) , videoTrack . getMeta ( ) . getOrientation ( ) ) ;


signature:
public class FrameGrab { /** * Get frame at current position in JCodec native image
 * @ return
 * @ throws IOException */
public Picture getNativeFrame ( ) throws IOException { } }

implementation: Packet frame = videoTrack . nextFrame ( ) ; if ( frame == null ) return null ; return decoder . decodeFrame ( frame , getBuffer ( ) ) ;


signature:
public class FrameGrab { /** * Get frame at a specified second as JCodec image
 * @ param file
 * @ param second
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getFrameAtSec ( File file , double second ) throws IOException , JCodecException { } }

implementation: FileChannelWrapper ch = null ; try { ch = NIOUtils . readableChannel ( file ) ; return createFrameGrab ( ch ) . seekToSecondPrecise ( second ) . getNativeFrame ( ) ; } finally { NIOUtils . closeQuietly ( ch ) ; }


signature:
public class FrameGrab { /** * Get frame at a specified second as JCodec image
 * @ param file
 * @ param second
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getFrameFromChannelAtSec ( SeekableByteChannel file , double second ) throws JCodecException , IOException { } }

implementation: return createFrameGrab ( file ) . seekToSecondPrecise ( second ) . getNativeFrame ( ) ;


signature:
public class FrameGrab { /** * Get frame at a specified frame number as JCodec image
 * @ param file
 * @ param second
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getFrameFromFile ( File file , int frameNumber ) throws IOException , JCodecException { } }

implementation: FileChannelWrapper ch = null ; try { ch = NIOUtils . readableChannel ( file ) ; return createFrameGrab ( ch ) . seekToFramePrecise ( frameNumber ) . getNativeFrame ( ) ; } finally { NIOUtils . closeQuietly ( ch ) ; }


signature:
public class FrameGrab { /** * Get frame at a specified frame number as JCodec image
 * @ param file
 * @ param second
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getFrameFromChannel ( SeekableByteChannel file , int frameNumber ) throws JCodecException , IOException { } }

implementation: return createFrameGrab ( file ) . seekToFramePrecise ( frameNumber ) . getNativeFrame ( ) ;


signature:
public class FrameGrab { /** * Get a specified frame by number from an already open demuxer track
 * @ param vt
 * @ param decoder
 * @ param frameNumber
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getNativeFrameAtFrame ( SeekableDemuxerTrack vt , ContainerAdaptor decoder , int frameNumber ) throws IOException , JCodecException { } }

implementation: return new FrameGrab ( vt , decoder ) . seekToFramePrecise ( frameNumber ) . getNativeFrame ( ) ;


signature:
public class FrameGrab { /** * Get a specified frame by second from an already open demuxer track
 * @ param vt
 * @ param decoder
 * @ param frameNumber
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getNativeFrameAtSec ( SeekableDemuxerTrack vt , ContainerAdaptor decoder , double second ) throws IOException , JCodecException { } }

implementation: return new FrameGrab ( vt , decoder ) . seekToSecondPrecise ( second ) . getNativeFrame ( ) ;


signature:
public class FrameGrab { /** * Get a specified frame by number from an already open demuxer track (
 * sloppy mode , i . e . nearest keyframe )
 * @ param vt
 * @ param decoder
 * @ param frameNumber
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getNativeFrameSloppy ( SeekableDemuxerTrack vt , ContainerAdaptor decoder , int frameNumber ) throws IOException , JCodecException { } }

implementation: return new FrameGrab ( vt , decoder ) . seekToFrameSloppy ( frameNumber ) . getNativeFrame ( ) ;


signature:
public class FrameGrab { /** * Get a specified frame by second from an already open demuxer track (
 * sloppy mode , i . e . nearest keyframe )
 * @ param vt
 * @ param decoder
 * @ param frameNumber
 * @ return
 * @ throws IOException
 * @ throws JCodecException */
public static Picture getNativeFrameAtSecSloppy ( SeekableDemuxerTrack vt , ContainerAdaptor decoder , double second ) throws IOException , JCodecException { } }

implementation: return new FrameGrab ( vt , decoder ) . seekToSecondSloppy ( second ) . getNativeFrame ( ) ;


signature:
public class MP4Demuxer { /** * does not modify packets */
public static MP4Demuxer createRawMP4Demuxer ( SeekableByteChannel input ) throws IOException { } }

implementation: return new MP4Demuxer ( input ) { @ Override protected AbstractMP4DemuxerTrack newTrack ( TrakBox trak ) { return new MP4DemuxerTrack ( movie , trak , this . input ) ; } } ;


signature:
public class FilterBank { /** * only for LTP : no overlapping , no short blocks */
public void processLTP ( WindowSequence windowSequence , int windowShape , int windowShapePrev , float [ ] _in , float [ ] out ) { } }

implementation: int i ; switch ( windowSequence ) { case ONLY_LONG_SEQUENCE : for ( i = length - 1 ; i >= 0 ; i -- ) { buf [ i ] = _in [ i ] * LONG_WINDOWS [ windowShapePrev ] [ i ] ; buf [ i + length ] = _in [ i + length ] * LONG_WINDOWS [ windowShape ] [ length - 1 - i ] ; } break ; case LONG_START_SEQUENCE : for ( i = 0 ; i < length ; i ++ ) { buf [ i ] = _in [ i ] * LONG_WINDOWS [ windowShapePrev ] [ i ] ; } for ( i = 0 ; i < mid ; i ++ ) { buf [ i + length ] = _in [ i + length ] ; } for ( i = 0 ; i < shortLen ; i ++ ) { buf [ i + length + mid ] = _in [ i + length + mid ] * SHORT_WINDOWS [ windowShape ] [ shortLen - 1 - i ] ; } for ( i = 0 ; i < mid ; i ++ ) { buf [ i + length + mid + shortLen ] = 0 ; } break ; case LONG_STOP_SEQUENCE : for ( i = 0 ; i < mid ; i ++ ) { buf [ i ] = 0 ; } for ( i = 0 ; i < shortLen ; i ++ ) { buf [ i + mid ] = _in [ i + mid ] * SHORT_WINDOWS [ windowShapePrev ] [ i ] ; } for ( i = 0 ; i < mid ; i ++ ) { buf [ i + mid + shortLen ] = _in [ i + mid + shortLen ] ; } for ( i = 0 ; i < length ; i ++ ) { buf [ i + length ] = _in [ i + length ] * LONG_WINDOWS [ windowShape ] [ length - 1 - i ] ; } break ; } mdctLong . processForward ( buf , out ) ;


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # setData ( byte [ ] ) */
@ Override public final void setData ( byte [ ] data ) { } }

implementation:
// make the buffer size an integer number of words
final int size = WORD_BYTES * ( ( data . length + WORD_BYTES - 1 ) / WORD_BYTES ) ; // only reallocate if needed
if ( buffer == null || buffer . length != size ) buffer = new byte [ size ] ; arraycopy ( data , 0 , buffer , 0 , data . length ) ; reset ( ) ;


signature:
public class BitStream { /** * Reads the next four bytes .
 * @ param peek if true , the stream pointer will not be increased */
protected int readCache ( boolean peek ) throws AACException { } }

implementation: int i ; if ( pos > buffer . length - WORD_BYTES ) throw AACException . endOfStream ( ) ; else i = ( ( buffer [ pos ] & BYTE_MASK ) << 24 ) | ( ( buffer [ pos + 1 ] & BYTE_MASK ) << 16 ) | ( ( buffer [ pos + 2 ] & BYTE_MASK ) << 8 ) | ( buffer [ pos + 3 ] & BYTE_MASK ) ; if ( ! peek ) pos += WORD_BYTES ; return i ;


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # readBits ( int ) */
@ Override public int readBits ( int n ) throws AACException { } }

implementation: int result ; if ( bitsCached >= n ) { bitsCached -= n ; result = ( cache >> bitsCached ) & maskBits ( n ) ; position += n ; } else { position += n ; final int c = cache & maskBits ( bitsCached ) ; final int left = n - bitsCached ; cache = readCache ( false ) ; bitsCached = WORD_BITS - left ; result = ( ( cache >> bitsCached ) & maskBits ( left ) ) | ( c << left ) ; } return result ;


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # readBit ( ) */
@ Override public int readBit ( ) throws AACException { } }

implementation: int i ; if ( bitsCached > 0 ) { bitsCached -- ; i = ( cache >> ( bitsCached ) ) & 1 ; position ++ ; } else { cache = readCache ( false ) ; bitsCached = WORD_BITS - 1 ; position ++ ; i = ( cache >> bitsCached ) & 1 ; } return i ;


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # peekBits ( int ) */
@ Override public int peekBits ( int n ) throws AACException { } }

implementation:
int ret ; if ( bitsCached >= n ) { ret = ( cache >> ( bitsCached - n ) ) & maskBits ( n ) ; } else { // old cache
final int c = cache & maskBits ( bitsCached ) ; n -= bitsCached ; // read next & combine
ret = ( ( readCache ( true ) >> WORD_BITS - n ) & maskBits ( n ) ) | ( c << n ) ; } return ret ;


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # peekBit ( ) */
@ Override public int peekBit ( ) throws AACException { } }

implementation: int ret ; if ( bitsCached > 0 ) { ret = ( cache >> ( bitsCached - 1 ) ) & 1 ; } else { final int word = readCache ( true ) ; ret = ( word >> WORD_BITS - 1 ) & 1 ; } return ret ;


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # skipBits ( int ) */
@ Override public void skipBits ( int n ) throws AACException { } }

implementation: position += n ; if ( n <= bitsCached ) { bitsCached -= n ; } else { n -= bitsCached ; while ( n >= WORD_BITS ) { n -= WORD_BITS ; readCache ( false ) ; } if ( n > 0 ) { cache = readCache ( false ) ; bitsCached = WORD_BITS - n ; } else { cache = 0 ; bitsCached = 0 ; } }


signature:
public class BitStream { /** * / * ( non - Javadoc )
 * @ see net . sourceforge . jaad . aac . syntax . IBitStream # skipBit ( ) */
@ Override public void skipBit ( ) throws AACException { } }

implementation: position ++ ; if ( bitsCached > 0 ) { bitsCached -- ; } else { cache = readCache ( false ) ; bitsCached = WORD_BITS - 1 ; }


signature:
public class Frame { /** * Creates a cropped clone of this picture .
 * @ return */
public Frame cloneCropped ( ) { } }

implementation: if ( cropNeeded ( ) ) { return cropped ( ) ; } else { Frame clone = createFrame ( this ) ; clone . copyFrom ( this ) ; return clone ; }


signature:
public class DCT { /** * 6*16*2 + 10*8 + 4*16*2 = 192 + 80 + 128 = 400 additions */
private static void fft_dif ( float [ ] Real , float [ ] Imag ) { } }

implementation:
float w_real , w_imag ; // For faster access
float point1_real , point1_imag , point2_real , point2_imag ; // For faster access
int j , i , i2 , w_index ; // Counters
// First 2 stages of 32 point FFT decimation in frequency
// 4*16*2 = 64*2 = 128 multiplications
// 6*16*2 = 96*2 = 192 additions
// Stage 1 of 32 point FFT decimation in frequency
for ( i = 0 ; i < 16 ; i ++ ) { point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; i2 = i + 16 ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; w_real = w_array_real [ i ] ; w_imag = w_array_imag [ i ] ; // temp1 = x [ i ] - x [ i2]
point1_real -= point2_real ; point1_imag -= point2_imag ; // x [ i1 ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * w
Real [ i2 ] = ( ( point1_real * w_real ) - ( point1_imag * w_imag ) ) ; Imag [ i2 ] = ( ( point1_real * w_imag ) + ( point1_imag * w_real ) ) ; } // Stage 2 of 32 point FFT decimation in frequency
for ( j = 0 , w_index = 0 ; j < 8 ; j ++ , w_index += 2 ) { w_real = w_array_real [ w_index ] ; w_imag = w_array_imag [ w_index ] ; i = j ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; i2 = i + 8 ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // temp1 = x [ i ] - x [ i2]
point1_real -= point2_real ; point1_imag -= point2_imag ; // x [ i1 ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * w
Real [ i2 ] = ( ( point1_real * w_real ) - ( point1_imag * w_imag ) ) ; Imag [ i2 ] = ( ( point1_real * w_imag ) + ( point1_imag * w_real ) ) ; i = j + 16 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; i2 = i + 8 ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // temp1 = x [ i ] - x [ i2]
point1_real -= point2_real ; point1_imag -= point2_imag ; // x [ i1 ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * w
Real [ i2 ] = ( ( point1_real * w_real ) - ( point1_imag * w_imag ) ) ; Imag [ i2 ] = ( ( point1_real * w_imag ) + ( point1_imag * w_real ) ) ; } // Stage 3 of 32 point FFT decimation in frequency
// 2*4*2 = 16 multiplications
// 4*4*2 + 6*4*2 = 10*8 = 80 additions
for ( i = 0 ; i < n ; i += 8 ) { i2 = i + 4 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // out [ i1 ] = point1 + point2
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // out [ i2 ] = point1 - point2
Real [ i2 ] = point1_real - point2_real ; Imag [ i2 ] = point1_imag - point2_imag ; } w_real = w_array_real [ 4 ] ; // = sqrt ( 2 ) / 2
// w _ imag = - w _ real ; / / = w _ array _ imag [ 4 ] ; / / = - sqrt ( 2 ) / 2
for ( i = 1 ; i < n ; i += 8 ) { i2 = i + 4 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // temp1 = x [ i ] - x [ i2]
point1_real -= point2_real ; point1_imag -= point2_imag ; // x [ i1 ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * w
Real [ i2 ] = ( point1_real + point1_imag ) * w_real ; Imag [ i2 ] = ( point1_imag - point1_real ) * w_real ; } for ( i = 2 ; i < n ; i += 8 ) { i2 = i + 4 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // x [ i ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * ( - i )
Real [ i2 ] = point1_imag - point2_imag ; Imag [ i2 ] = point2_real - point1_real ; } w_real = w_array_real [ 12 ] ; // = - sqrt ( 2 ) / 2
// w _ imag = w _ real ; / / = w _ array _ imag [ 12 ] ; / / = - sqrt ( 2 ) / 2
for ( i = 3 ; i < n ; i += 8 ) { i2 = i + 4 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // temp1 = x [ i ] - x [ i2]
point1_real -= point2_real ; point1_imag -= point2_imag ; // x [ i1 ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * w
Real [ i2 ] = ( point1_real - point1_imag ) * w_real ; Imag [ i2 ] = ( point1_real + point1_imag ) * w_real ; } // Stage 4 of 32 point FFT decimation in frequency ( no multiplications )
// 16*4 = 64 additions
for ( i = 0 ; i < n ; i += 4 ) { i2 = i + 2 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // x [ i1 ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = x [ i ] - x [ i2]
Real [ i2 ] = point1_real - point2_real ; Imag [ i2 ] = point1_imag - point2_imag ; } for ( i = 1 ; i < n ; i += 4 ) { i2 = i + 2 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // x [ i ] = x [ i ] + x [ i2]
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // x [ i2 ] = ( x [ i ] - x [ i2 ] ) * ( - i )
Real [ i2 ] = point1_imag - point2_imag ; Imag [ i2 ] = point2_real - point1_real ; } // Stage 5 of 32 point FFT decimation in frequency ( no multiplications )
// 16*4 = 64 additions
for ( i = 0 ; i < n ; i += 2 ) { i2 = i + 1 ; point1_real = Real [ i ] ; point1_imag = Imag [ i ] ; point2_real = Real [ i2 ] ; point2_imag = Imag [ i2 ] ; // out [ i1 ] = point1 + point2
Real [ i ] += point2_real ; Imag [ i ] += point2_imag ; // out [ i2 ] = point1 - point2
Real [ i2 ] = point1_real - point2_real ; Imag [ i2 ] = point1_imag - point2_imag ; } // FFTReorder ( Real , Imag ) ;


signature:
public class DCT { /** * / * size 64 only ! */
public static void dct4_kernel ( float [ ] in_real , float [ ] in_imag , float [ ] out_real , float [ ] out_imag ) { } }

implementation:
// Tables with bit reverse values for 5 bits , bit reverse of i at i - th position
int i , i_rev ; /* Step 2 : modulate */
// 3*32 = 96 multiplications
// 3*32 = 96 additions
for ( i = 0 ; i < 32 ; i ++ ) { float x_re , x_im , tmp ; x_re = in_real [ i ] ; x_im = in_imag [ i ] ; tmp = ( x_re + x_im ) * dct4_64_tab [ i ] ; in_real [ i ] = ( x_im * dct4_64_tab [ i + 64 ] ) + tmp ; in_imag [ i ] = ( x_re * dct4_64_tab [ i + 32 ] ) + tmp ; } /* Step 3 : FFT , but with output in bit reverse order */
fft_dif ( in_real , in_imag ) ; /* Step 4 : modulate + bitreverse reordering */
// 3*31 + 2 = 95 multiplications
// 3*31 + 2 = 95 additions
for ( i = 0 ; i < 16 ; i ++ ) { float x_re , x_im , tmp ; i_rev = bit_rev_tab [ i ] ; x_re = in_real [ i_rev ] ; x_im = in_imag [ i_rev ] ; tmp = ( x_re + x_im ) * dct4_64_tab [ i + 3 * 32 ] ; out_real [ i ] = ( x_im * dct4_64_tab [ i + 5 * 32 ] ) + tmp ; out_imag [ i ] = ( x_re * dct4_64_tab [ i + 4 * 32 ] ) + tmp ; } // i = 16 , i _ rev = 1 = rev ( 16 ) ;
out_imag [ 16 ] = ( in_imag [ 1 ] - in_real [ 1 ] ) * dct4_64_tab [ 16 + 3 * 32 ] ; out_real [ 16 ] = ( in_real [ 1 ] + in_imag [ 1 ] ) * dct4_64_tab [ 16 + 3 * 32 ] ; for ( i = 17 ; i < 32 ; i ++ ) { float x_re , x_im , tmp ; i_rev = bit_rev_tab [ i ] ; x_re = in_real [ i_rev ] ; x_im = in_imag [ i_rev ] ; tmp = ( x_re + x_im ) * dct4_64_tab [ i + 3 * 32 ] ; out_real [ i ] = ( x_im * dct4_64_tab [ i + 5 * 32 ] ) + tmp ; out_imag [ i ] = ( x_re * dct4_64_tab [ i + 4 * 32 ] ) + tmp ; }


signature:
public class WavHeader { /** * Creates wav header for the specified audio format
 * @ param format
 * @ param samples */
public static WavHeader createWavHeader ( AudioFormat format , int samples ) { } }

implementation: WavHeader w = new WavHeader ( "RIFF" , 40 , "WAVE" , new FmtChunk ( ( short ) 1 , ( short ) format . getChannels ( ) , format . getSampleRate ( ) , format . getSampleRate ( ) * format . getChannels ( ) * ( format . getSampleSizeInBits ( ) >> 3 ) , ( short ) ( format . getChannels ( ) * ( format . getSampleSizeInBits ( ) >> 3 ) ) , ( short ) format . getSampleSizeInBits ( ) ) , 44 , calcDataSize ( format . getChannels ( ) , format . getSampleSizeInBits ( ) >> 3 , samples ) ) ; return w ;


signature:
public class WavHeader { /** * Takes single channel wavs as input produces multi channel wav */
public static WavHeader multiChannelWav ( WavHeader [ ] headers ) { } }

implementation: WavHeader w = emptyWavHeader ( ) ; int totalSize = 0 ; for ( int i = 0 ; i < headers . length ; i ++ ) { WavHeader wavHeader = headers [ i ] ; totalSize += wavHeader . dataSize ; } w . dataSize = totalSize ; FmtChunk fmt = headers [ 0 ] . fmt ; int bitsPerSample = fmt . bitsPerSample ; int bytesPerSample = bitsPerSample / 8 ; int sampleRate = ( int ) fmt . sampleRate ; w . fmt . bitsPerSample = ( short ) bitsPerSample ; w . fmt . blockAlign = ( short ) ( headers . length * bytesPerSample ) ; w . fmt . byteRate = headers . length * bytesPerSample * sampleRate ; w . fmt . numChannels = ( short ) headers . length ; w . fmt . sampleRate = sampleRate ; return w ;


signature:
public class DummyBitstreamReader { /** * ( non - Javadoc )
 * @ see ua . org . jplayer . javcodec . h264 . RBSPInputStream # readNBit ( int ) */
public int readNBit ( int n ) throws IOException { } }

implementation: if ( n > 32 ) throw new IllegalArgumentException ( "Can not read more then 32 bit" ) ; int val = 0 ; for ( int i = 0 ; i < n ; i ++ ) { val <<= 1 ; val |= read1BitInt ( ) ; } return val ;


signature:
public class DummyBitstreamReader { /** * ( non - Javadoc )
 * @ see ua . org . jplayer . javcodec . h264 . RBSPInputStream # moreRBSPData ( ) */
public boolean moreRBSPData ( ) throws IOException { } }

implementation: if ( nBit == 8 ) { advance ( ) ; } int tail = 1 << ( 8 - nBit - 1 ) ; int mask = ( ( tail << 1 ) - 1 ) ; boolean hasTail = ( curByte & mask ) == tail ; return ! ( curByte == - 1 || ( nextByte == - 1 && hasTail ) ) ;


signature:
public class DummyBitstreamReader { /** * ( non - Javadoc )
 * @ see ua . org . jplayer . javcodec . h264 . RBSPInputStream # next _ bits ( int ) */
public int peakNextBits ( int n ) throws IOException { } }

implementation: if ( n > 8 ) throw new IllegalArgumentException ( "N should be less then 8" ) ; if ( nBit == 8 ) { advance ( ) ; if ( curByte == - 1 ) { return - 1 ; } } int [ ] bits = new int [ 16 - nBit ] ; int cnt = 0 ; for ( int i = nBit ; i < 8 ; i ++ ) { bits [ cnt ++ ] = ( curByte >> ( 7 - i ) ) & 0x1 ; } for ( int i = 0 ; i < 8 ; i ++ ) { bits [ cnt ++ ] = ( nextByte >> ( 7 - i ) ) & 0x1 ; } int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { result <<= 1 ; result |= bits [ i ] ; } return result ;


signature:
public class Mp3Bitstream { /** * Wrong usage of Javascript keyword : in */
static MP3SideInfo readSideInfo ( MpaHeader header , ByteBuffer src , int channels ) { } }

implementation: MP3SideInfo si = new MP3SideInfo ( ) ; BitReader stream = BitReader . createBitReader ( src ) ; if ( header . version == MPEG1 ) { si . mainDataBegin = stream . readNBit ( 9 ) ; if ( channels == 1 ) si . privateBits = stream . readNBit ( 5 ) ; else si . privateBits = stream . readNBit ( 3 ) ; for ( int ch = 0 ; ch < channels ; ch ++ ) { si . scfsi [ ch ] [ 0 ] = stream . read1Bit ( ) == 0 ; si . scfsi [ ch ] [ 1 ] = stream . read1Bit ( ) == 0 ; si . scfsi [ ch ] [ 2 ] = stream . read1Bit ( ) == 0 ; si . scfsi [ ch ] [ 3 ] = stream . read1Bit ( ) == 0 ; } for ( int gr = 0 ; gr < 2 ; gr ++ ) { for ( int ch = 0 ; ch < channels ; ch ++ ) { Granule granule = si . granule [ ch ] [ gr ] ; granule . part23Length = stream . readNBit ( 12 ) ; granule . bigValues = stream . readNBit ( 9 ) ; granule . globalGain = stream . readNBit ( 8 ) ; granule . scalefacCompress = stream . readNBit ( 4 ) ; granule . windowSwitchingFlag = stream . readNBit ( 1 ) != 0 ; if ( granule . windowSwitchingFlag ) { granule . blockType = stream . readNBit ( 2 ) ; granule . mixedBlockFlag = stream . readNBit ( 1 ) != 0 ; granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . subblockGain [ 0 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 1 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 2 ] = stream . readNBit ( 3 ) ; if ( granule . blockType == 0 ) { return null ; } else if ( granule . blockType == 2 && ! granule . mixedBlockFlag ) { granule . region0Count = 8 ; } else { granule . region0Count = 7 ; } granule . region1Count = 20 - granule . region0Count ; } else { granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 2 ] = stream . readNBit ( 5 ) ; granule . region0Count = stream . readNBit ( 4 ) ; granule . region1Count = stream . readNBit ( 3 ) ; granule . blockType = 0 ; } granule . preflag = stream . readNBit ( 1 ) != 0 ; granule . scalefacScale = stream . readNBit ( 1 ) ; granule . count1tableSelect = stream . readNBit ( 1 ) ; } } } else { si . mainDataBegin = stream . readNBit ( 8 ) ; if ( channels == 1 ) si . privateBits = stream . readNBit ( 1 ) ; else si . privateBits = stream . readNBit ( 2 ) ; for ( int ch = 0 ; ch < channels ; ch ++ ) { Granule granule = si . granule [ ch ] [ 0 ] ; granule . part23Length = stream . readNBit ( 12 ) ; granule . bigValues = stream . readNBit ( 9 ) ; granule . globalGain = stream . readNBit ( 8 ) ; granule . scalefacCompress = stream . readNBit ( 9 ) ; granule . windowSwitchingFlag = stream . readNBit ( 1 ) != 0 ; if ( granule . windowSwitchingFlag ) { granule . blockType = stream . readNBit ( 2 ) ; granule . mixedBlockFlag = stream . readNBit ( 1 ) != 0 ; granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . subblockGain [ 0 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 1 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 2 ] = stream . readNBit ( 3 ) ; if ( granule . blockType == 0 ) { return null ; } else if ( granule . blockType == 2 && ! granule . mixedBlockFlag ) { granule . region0Count = 8 ; } else { granule . region0Count = 7 ; granule . region1Count = 20 - granule . region0Count ; } } else { granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 2 ] = stream . readNBit ( 5 ) ; granule . region0Count = stream . readNBit ( 4 ) ; granule . region1Count = stream . readNBit ( 3 ) ; granule . blockType = 0 ; } granule . scalefacScale = stream . readNBit ( 1 ) ; granule . count1tableSelect = stream . readNBit ( 1 ) ; } } stream . terminate ( ) ; return si ;


signature:
public class MPEGES { /** * Reads one MPEG1/2 video frame from MPEG1/2 elementary stream into a
 * provided buffer .
 * @ param buffer
 * A buffer to use for the data .
 * @ return A packet with a video frame or null at for end of the stream . The
 * data buffer inside the packet will be a sub - buffer of a ' buffer '
 * provided as an argument .
 * @ throws IOException */
public MPEGPacket frame ( ByteBuffer buffer ) throws IOException { } }

implementation: ByteBuffer dup = buffer . duplicate ( ) ; while ( curMarker != 0x100 && curMarker != 0x1b3 && skipToMarker ( ) ) ; while ( curMarker != 0x100 && readToNextMarker ( dup ) ) ; readToNextMarker ( dup ) ; while ( curMarker != 0x100 && curMarker != 0x1b3 && readToNextMarker ( dup ) ) ; dup . flip ( ) ; PictureHeader ph = MPEGDecoder . getPictureHeader ( dup . duplicate ( ) ) ; return dup . hasRemaining ( ) ? new MPEGPacket ( dup , 0 , 90000 , 0 , frameNo ++ , ph . picture_coding_type <= MPEGConst . IntraCoded ? FrameType . KEY : FrameType . INTER , null ) : null ;


signature:
public class MPEGES { /** * Reads one MPEG1/2 video frame from MPEG1/2 elementary stream .
 * @ return A packet with a video frame or null at the end of stream .
 * @ throws IOException */
public MPEGPacket getFrame ( ) throws IOException { } }

implementation:
while ( curMarker != 0x100 && curMarker != 0x1b3 && skipToMarker ( ) ) ; List < ByteBuffer > buffers = new ArrayList < ByteBuffer > ( ) ; // Reading to the frame header , sequence header , sequence header
// extensions and group header go in here
while ( curMarker != 0x100 && ! done ) readToNextMarkerBuffers ( buffers ) ; // Reading the frame header
readToNextMarkerBuffers ( buffers ) ; // Reading the slices , will stop on encounter of a frame header of the
// next frame or a sequence header
while ( curMarker != 0x100 && curMarker != 0x1b3 && ! done ) readToNextMarkerBuffers ( buffers ) ; ByteBuffer dup = NIOUtils . combineBuffers ( buffers ) ; PictureHeader ph = MPEGDecoder . getPictureHeader ( dup . duplicate ( ) ) ; return dup . hasRemaining ( ) ? new MPEGPacket ( dup , 0 , 90000 , 0 , frameNo ++ , ph . picture_coding_type <= MPEGConst . IntraCoded ? FrameType . KEY : FrameType . INTER , null ) : null ;


signature:
public class AACDecoderConfig { /** * Parses the input arrays as a DecoderSpecificInfo , as used in MP4
 * containers .
 * @ return a AACDecoderConfig */
public static AACDecoderConfig parseMP4DecoderSpecificInfo ( byte [ ] data ) throws AACException { } }

implementation:
final IBitStream _in = BitStream . createBitStream ( data ) ; final AACDecoderConfig config = new AACDecoderConfig ( ) ; try { config . profile = readProfile ( _in ) ; int sf = _in . readBits ( 4 ) ; if ( sf == 0xF ) config . sampleFrequency = SampleFrequency . forFrequency ( _in . readBits ( 24 ) ) ; else config . sampleFrequency = SampleFrequency . forInt ( sf ) ; config . channelConfiguration = ChannelConfiguration . forInt ( _in . readBits ( 4 ) ) ; Profile cp = config . profile ; if ( AAC_SBR == cp ) { config . extProfile = cp ; config . sbrPresent = true ; sf = _in . readBits ( 4 ) ; // TODO : 24 bits already read ; read again ?
// if ( sf = = 0xF ) config . sampleFrequency = SampleFrequency . forFrequency ( _ in . readBits ( 24 ) ) ;
// if sample frequencies are the same : downsample SBR
config . downSampledSBR = config . sampleFrequency . getIndex ( ) == sf ; config . sampleFrequency = SampleFrequency . forInt ( sf ) ; config . profile = readProfile ( _in ) ; } else if ( AAC_MAIN == cp || AAC_LC == cp || AAC_SSR == cp || AAC_LTP == cp || ER_AAC_LC == cp || ER_AAC_LTP == cp || ER_AAC_LD == cp ) { // ga - specific info :
config . frameLengthFlag = _in . readBool ( ) ; if ( config . frameLengthFlag ) throw new AACException ( "config uses 960-sample frames, not yet supported" ) ; // TODO : are 960 - frames working yet ?
config . dependsOnCoreCoder = _in . readBool ( ) ; if ( config . dependsOnCoreCoder ) config . coreCoderDelay = _in . readBits ( 14 ) ; else config . coreCoderDelay = 0 ; config . extensionFlag = _in . readBool ( ) ; if ( config . extensionFlag ) { if ( cp . isErrorResilientProfile ( ) ) { config . sectionDataResilience = _in . readBool ( ) ; config . scalefactorResilience = _in . readBool ( ) ; config . spectralDataResilience = _in . readBool ( ) ; } // extensionFlag3
_in . skipBit ( ) ; } if ( config . channelConfiguration == ChannelConfiguration . CHANNEL_CONFIG_NONE ) { // TODO : is this working correct ? - > ISO 14496-3 part 1 : 1 . A . 4.3
_in . skipBits ( 3 ) ; // PCE
PCE pce = new PCE ( ) ; pce . decode ( _in ) ; config . profile = pce . getProfile ( ) ; config . sampleFrequency = pce . getSampleFrequency ( ) ; config . channelConfiguration = ChannelConfiguration . forInt ( pce . getChannelCount ( ) ) ; } if ( _in . getBitsLeft ( ) > 10 ) readSyncExtension ( _in , config ) ; } else { throw new AACException ( "profile not supported: " + cp . getIndex ( ) ) ; } return config ; } finally { _in . destroy ( ) ; }


signature:
public class MQEncoder { /** * Encodes one symbol either 0 or 1
 * @ param symbol
 * @ throws IOException */
public void encode ( int symbol , Context cm ) throws IOException { } }

implementation: int rangeLps = MQConst . pLps [ cm . getState ( ) ] ; if ( symbol == cm . getMps ( ) ) { range -= rangeLps ; offset += rangeLps ; if ( range < 0x8000 ) { while ( range < 0x8000 ) renormalize ( ) ; cm . setState ( MQConst . transitMPS [ cm . getState ( ) ] ) ; } } else { range = rangeLps ; while ( range < 0x8000 ) renormalize ( ) ; if ( MQConst . mpsSwitch [ cm . getState ( ) ] != 0 ) cm . setMps ( 1 - cm . getMps ( ) ) ; cm . setState ( MQConst . transitLPS [ cm . getState ( ) ] ) ; }


signature:
public class SliceHeaderReader { /** * static int i = 0; */
private static void readDecoderPicMarking ( NALUnit nalUnit , SliceHeader sh , BitReader _in ) { } }

implementation: if ( nalUnit . type == NALUnitType . IDR_SLICE ) { boolean noOutputOfPriorPicsFlag = readBool ( _in , "SH: no_output_of_prior_pics_flag" ) ; boolean longTermReferenceFlag = readBool ( _in , "SH: long_term_reference_flag" ) ; sh . refPicMarkingIDR = new RefPicMarkingIDR ( noOutputOfPriorPicsFlag , longTermReferenceFlag ) ; } else { boolean adaptiveRefPicMarkingModeFlag = readBool ( _in , "SH: adaptive_ref_pic_marking_mode_flag" ) ; if ( adaptiveRefPicMarkingModeFlag ) { ArrayList < Instruction > mmops = new ArrayList < Instruction > ( ) ; int memoryManagementControlOperation ; do { memoryManagementControlOperation = readUEtrace ( _in , "SH: memory_management_control_operation" ) ; Instruction instr = null ; switch ( memoryManagementControlOperation ) { case 1 : instr = new RefPicMarking . Instruction ( InstrType . REMOVE_SHORT , readUEtrace ( _in , "SH: difference_of_pic_nums_minus1" ) + 1 , 0 ) ; break ; case 2 : instr = new RefPicMarking . Instruction ( InstrType . REMOVE_LONG , readUEtrace ( _in , "SH: long_term_pic_num" ) , 0 ) ; break ; case 3 : instr = new RefPicMarking . Instruction ( InstrType . CONVERT_INTO_LONG , readUEtrace ( _in , "SH: difference_of_pic_nums_minus1" ) + 1 , readUEtrace ( _in , "SH: long_term_frame_idx" ) ) ; break ; case 4 : instr = new RefPicMarking . Instruction ( InstrType . TRUNK_LONG , readUEtrace ( _in , "SH: max_long_term_frame_idx_plus1" ) - 1 , 0 ) ; break ; case 5 : instr = new RefPicMarking . Instruction ( InstrType . CLEAR , 0 , 0 ) ; break ; case 6 : instr = new RefPicMarking . Instruction ( InstrType . MARK_LONG , readUEtrace ( _in , "SH: long_term_frame_idx" ) , 0 ) ; break ; } if ( instr != null ) mmops . add ( instr ) ; } while ( memoryManagementControlOperation != 0 ) ; sh . refPicMarkingNonIDR = new RefPicMarking ( mmops . toArray ( new Instruction [ ] { } ) ) ; } }


signature: public class Stepper { private void show ( Frame frame ) { } }

implementation: pts = frame . getPts ( ) ; fireTimeEvent ( frame ) ; Picture src = frame . getPic ( ) ; if ( src . getColor ( ) != vo . getColorSpace ( ) ) { if ( dst == null || dst . getWidth ( ) != src . getWidth ( ) || dst . getHeight ( ) != src . getHeight ( ) ) dst = Picture . create ( src . getWidth ( ) , src . getHeight ( ) , vo . getColorSpace ( ) ) ; ColorUtil . getTransform ( src . getColor ( ) , vo . getColorSpace ( ) ) . transform ( src , dst ) ; vo . show ( dst , frame . getPixelAspect ( ) ) ; } else { vo . show ( src , frame . getPixelAspect ( ) ) ; }


signature:
public class Util { /** * Splits track on the timevalue specified
 * @ param movie
 * @ param track
 * @ param tvMv
 * @ return */
public static Pair < List < Edit > > split ( MovieBox movie , TrakBox track , long tvMv ) { } }

implementation: return splitEdits ( track . getEdits ( ) , new Rational ( track . getTimescale ( ) , movie . getTimescale ( ) ) , tvMv ) ;


signature:
public class Decoder { /** * Decodes one frame of AAC data in frame mode and returns the raw PCM data .
 * @ param frame
 * the AAC frame
 * @ param buffer
 * a buffer to hold the decoded PCM data
 * @ throws AACException
 * if decoding fails */
public void decodeFrame ( byte [ ] frame , SampleBuffer buffer ) throws AACException { } }

implementation: if ( frame != null ) _in . setData ( frame ) ; Logger . debug ( "bits left " + _in . getBitsLeft ( ) ) ; try { decode ( buffer ) ; } catch ( AACException e ) { if ( ! e . isEndOfStream ( ) ) throw e ; else Logger . warn ( "unexpected end of frame" ) ; }


signature:
public class SampleBuffer { /** * Sets the endianness for the data .
 * @ param bigEndian if true the data will be in big endian , else in little
 * endian */
public void setBigEndian ( boolean bigEndian ) { } }

implementation: if ( bigEndian != this . bigEndian ) { byte tmp ; for ( int i = 0 ; i < data . length ; i += 2 ) { tmp = data [ i ] ; data [ i ] = data [ i + 1 ] ; data [ i + 1 ] = tmp ; } this . bigEndian = bigEndian ; }


signature:
public class MBDeblocker { /** * Deblocks bottom edge of topOutMB , right edge of leftOutMB and left / top
 * and inner block edges of outMB
 * @ param curPix
 * Pixels of the current MB
 * @ param leftPix
 * Pixels of the leftMB
 * @ param topPix
 * Pixels of the tipMB
 * @ param vertStrength
 * Border strengths for vertical edges ( filtered first )
 * @ param horizStrength
 * Border strengths for the horizontal edges
 * @ param curQp
 * Current MB ' s qp
 * @ param leftQp
 * Left MB ' s qp
 * @ param topQp
 * Top MB ' s qp */
public void deblockMBGeneric ( EncodedMB curMB , EncodedMB leftMB , EncodedMB topMB , int [ ] [ ] vertStrength , int horizStrength [ ] [ ] ) { } }

implementation: Picture curPix = curMB . getPixels ( ) ; if ( leftMB != null ) { Picture leftPix = leftMB . getPixels ( ) ; int avgQp = MathUtil . clip ( ( leftMB . getQp ( ) + curMB . getQp ( ) + 1 ) >> 1 , 0 , 51 ) ; deblockBorder ( vertStrength [ 0 ] , avgQp , leftPix . getPlaneData ( 0 ) , 3 , curPix . getPlaneData ( 0 ) , 0 , P_POS_V , Q_POS_V , false ) ; deblockBorderChroma ( vertStrength [ 0 ] , avgQp , leftPix . getPlaneData ( 1 ) , 3 , curPix . getPlaneData ( 1 ) , 0 , P_POS_V_CHR , Q_POS_V_CHR , false ) ; deblockBorderChroma ( vertStrength [ 0 ] , avgQp , leftPix . getPlaneData ( 2 ) , 3 , curPix . getPlaneData ( 2 ) , 0 , P_POS_V_CHR , Q_POS_V_CHR , false ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { deblockBorder ( vertStrength [ i + 1 ] , curMB . getQp ( ) , curPix . getPlaneData ( 0 ) , i , curPix . getPlaneData ( 0 ) , i + 1 , P_POS_V , Q_POS_V , false ) ; deblockBorderChroma ( vertStrength [ i + 1 ] , curMB . getQp ( ) , curPix . getPlaneData ( 1 ) , i , curPix . getPlaneData ( 1 ) , i + 1 , P_POS_V_CHR , Q_POS_V_CHR , false ) ; deblockBorderChroma ( vertStrength [ i + 1 ] , curMB . getQp ( ) , curPix . getPlaneData ( 2 ) , i , curPix . getPlaneData ( 2 ) , i + 1 , P_POS_V_CHR , Q_POS_V_CHR , false ) ; } if ( topMB != null ) { Picture topPix = topMB . getPixels ( ) ; int avgQp = MathUtil . clip ( ( topMB . getQp ( ) + curMB . getQp ( ) + 1 ) >> 1 , 0 , 51 ) ; deblockBorder ( horizStrength [ 0 ] , avgQp , topPix . getPlaneData ( 0 ) , 3 , curPix . getPlaneData ( 0 ) , 0 , P_POS_H , Q_POS_H , true ) ; deblockBorderChroma ( horizStrength [ 0 ] , avgQp , topPix . getPlaneData ( 1 ) , 3 , curPix . getPlaneData ( 1 ) , 0 , P_POS_H_CHR , Q_POS_H_CHR , true ) ; deblockBorderChroma ( horizStrength [ 0 ] , avgQp , topPix . getPlaneData ( 2 ) , 3 , curPix . getPlaneData ( 2 ) , 0 , P_POS_H_CHR , Q_POS_H_CHR , true ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { deblockBorder ( horizStrength [ i + 1 ] , curMB . getQp ( ) , curPix . getPlaneData ( 0 ) , i , curPix . getPlaneData ( 0 ) , i + 1 , P_POS_H , Q_POS_H , true ) ; deblockBorderChroma ( horizStrength [ i + 1 ] , curMB . getQp ( ) , curPix . getPlaneData ( 1 ) , i , curPix . getPlaneData ( 1 ) , i + 1 , P_POS_H_CHR , Q_POS_H_CHR , true ) ; deblockBorderChroma ( horizStrength [ i + 1 ] , curMB . getQp ( ) , curPix . getPlaneData ( 2 ) , i , curPix . getPlaneData ( 2 ) , i + 1 , P_POS_H_CHR , Q_POS_H_CHR , true ) ; }


signature:
public class MBDeblocker { /** * Deblocks P - macroblock
 * @ param cur
 * Pixels and parameters of encoded and reconstructed current
 * macroblock
 * @ param left
 * Pixels and parameters of encoded and reconstructed left
 * macroblock
 * @ param top
 * Pixels and parameters of encoded and reconstructed top
 * macroblock */
public void deblockMBP ( EncodedMB cur , EncodedMB left , EncodedMB top ) { } }

implementation: int [ ] [ ] vertStrength = new int [ 4 ] [ 4 ] ; int [ ] [ ] horizStrength = new int [ 4 ] [ 4 ] ; calcStrengthForBlocks ( cur , left , vertStrength , LOOKUP_IDX_P_V , LOOKUP_IDX_Q_V ) ; calcStrengthForBlocks ( cur , top , horizStrength , LOOKUP_IDX_P_H , LOOKUP_IDX_Q_H ) ; deblockMBGeneric ( cur , left , top , vertStrength , horizStrength ) ;


signature:
public class SequenceEncoder { /** * Encodes a frame into a movie .
 * @ param pic
 * @ throws IOException */
public void encodeNativeFrame ( Picture pic ) throws IOException { } }

implementation: if ( pic . getColor ( ) != ColorSpace . RGB ) throw new IllegalArgumentException ( "The input images is expected in RGB color." ) ; ColorSpace sinkColor = sink . getInputColor ( ) ; LoanerPicture toEncode ; if ( sinkColor != null ) { toEncode = pixelStore . getPicture ( pic . getWidth ( ) , pic . getHeight ( ) , sinkColor ) ; transform . transform ( pic , toEncode . getPicture ( ) ) ; } else { toEncode = new LoanerPicture ( pic , 0 ) ; } Packet pkt = Packet . createPacket ( null , timestamp , fps . getNum ( ) , fps . getDen ( ) , frameNo , FrameType . KEY , null ) ; sink . outputVideoFrame ( new VideoFrameWithPacket ( pkt , toEncode ) ) ; if ( sinkColor != null ) pixelStore . putBack ( toEncode ) ; timestamp += fps . getDen ( ) ; frameNo ++ ;


signature:
public class EbmlUtil { /** * Encodes unsigned integer with given length
 * @ param value
 * unsigned integer to be encoded
 * @ param length
 * ebml sequence length
 * @ return */
public static byte [ ] ebmlEncodeLen ( long value , int length ) { } }

implementation:
byte [ ] b = new byte [ length ] ; for ( int idx = 0 ; idx < length ; idx ++ ) { // Rightmost bytes should go to end of array to preserve big - endian notation
b [ length - idx - 1 ] = ( byte ) ( ( value >>> ( 8 * idx ) ) & 0xFFL ) ; } b [ 0 ] |= 0x80 >>> ( length - 1 ) ; return b ;


signature:
public class EbmlUtil { /** * This method is used mostly during reading EBML bitstream . It asnwers the question " What is the length of an integer ( signed / unsigned ) encountered in the bitstream "
 * @ param b
 * @ return */
static public int computeLength ( byte b ) { } }

implementation: if ( b == 0x00 ) throw new RuntimeException ( "Invalid head element for ebml sequence" ) ; int i = 1 ; while ( ( b & lengthOptions [ i ] ) == 0 ) i ++ ; return i ;


signature:
public class EbmlUtil { /** * This method is used mostly during writing EBML bitstream . It answers the following question " How many bytes should be used to encode unsigned integer value "
 * @ param v
 * unsigned integer to be encoded
 * @ return */
public static int ebmlLength ( long v ) { } }

implementation: if ( v == 0 ) return 1 ; int length = 8 ; while ( length > 0 && ( v & ebmlLengthMasks [ length ] ) == 0 ) length -- ; return length ;


signature:
public class Mp3Mdct { /** * Wrong usage of Javascript keyword : in */
static void oneLong ( float [ ] src , float [ ] dst ) { } }

implementation: for ( int i = 17 ; i > 0 ; i -- ) src [ i ] += src [ i - 1 ] ; for ( int i = 17 ; i > 2 ; i -= 2 ) src [ i ] += src [ i - 2 ] ; for ( int i = 0 , k = 0 ; i < 2 ; i ++ , k += 8 ) { float tmp0 = src [ i ] + src [ i ] ; float tmp1 = tmp0 + src [ 12 + i ] ; float tmp2 = src [ 6 + i ] * factor36pt3 ; tmp [ k + 0 ] = tmp1 + src [ 4 + i ] * factor36pt2 + src [ 8 + i ] * factor36pt1 + src [ 16 + i ] * factor36pt0 ; tmp [ k + 1 ] = tmp0 + src [ 4 + i ] - src [ 8 + i ] - src [ 12 + i ] - src [ 12 + i ] - src [ 16 + i ] ; tmp [ k + 2 ] = tmp1 - src [ 4 + i ] * factor36pt0 - src [ 8 + i ] * factor36pt2 + src [ 16 + i ] * factor36pt1 ; tmp [ k + 3 ] = tmp1 - src [ 4 + i ] * factor36pt1 + src [ 8 + i ] * factor36pt0 - src [ 16 + i ] * factor36pt2 ; tmp [ k + 4 ] = src [ 2 + i ] * factor36pt4 + tmp2 + src [ 10 + i ] * factor36pt5 + src [ 14 + i ] * factor36pt6 ; tmp [ k + 5 ] = ( src [ 2 + i ] - src [ 10 + i ] - src [ 14 + i ] ) * factor36pt3 ; tmp [ k + 6 ] = src [ 2 + i ] * factor36pt5 - tmp2 - src [ 10 + i ] * factor36pt6 + src [ 14 + i ] * factor36pt4 ; tmp [ k + 7 ] = src [ 2 + i ] * factor36pt6 - tmp2 + src [ 10 + i ] * factor36pt4 - src [ 14 + i ] * factor36pt5 ; } for ( int i = 0 , j = 4 , k = 8 , l = 12 ; i < 4 ; i ++ , j ++ , k ++ , l ++ ) { float q1 = tmp [ i ] ; float q2 = tmp [ k ] ; tmp [ i ] += tmp [ j ] ; tmp [ j ] = q1 - tmp [ j ] ; tmp [ k ] = ( tmp [ k ] + tmp [ l ] ) * factor36 [ i ] ; tmp [ l ] = ( q2 - tmp [ l ] ) * factor36 [ 7 - i ] ; } for ( int i = 0 ; i < 4 ; i ++ ) { dst [ 26 - i ] = tmp [ i ] + tmp [ 8 + i ] ; dst [ 8 - i ] = tmp [ 8 + i ] - tmp [ i ] ; dst [ 27 + i ] = dst [ 26 - i ] ; dst [ 9 + i ] = - dst [ 8 - i ] ; } for ( int i = 0 ; i < 4 ; i ++ ) { dst [ 21 - i ] = tmp [ 7 - i ] + tmp [ 15 - i ] ; dst [ 3 - i ] = tmp [ 15 - i ] - tmp [ 7 - i ] ; dst [ 32 + i ] = dst [ 21 - i ] ; dst [ 14 + i ] = - dst [ 3 - i ] ; } float tmp0 = src [ 0 ] - src [ 4 ] + src [ 8 ] - src [ 12 ] + src [ 16 ] ; float tmp1 = ( src [ 1 ] - src [ 5 ] + src [ 9 ] - src [ 13 ] + src [ 17 ] ) * cos450 ; dst [ 4 ] = tmp1 - tmp0 ; dst [ 13 ] = - dst [ 4 ] ; dst [ 31 ] = dst [ 22 ] = tmp0 + tmp1 ;


signature:
public class Mp3Mdct { /** * Wrong usage of Javascript keyword : in */
static void threeShort ( float [ ] src , float [ ] dst ) { } }

implementation: Arrays . fill ( dst , 0.0f ) ; for ( int i = 0 , outOff = 0 ; i < 3 ; i ++ , outOff += 6 ) { imdct12 ( src , dst , outOff , i ) ; }


signature:
public class Mp3Mdct { /** * Wrong usage of Javascript keyword : in */
private static void imdct12 ( float [ ] src , float [ ] dst , int outOff , int wndIdx ) { } }

implementation: for ( int j = 15 + wndIdx , k = 12 + wndIdx ; j >= 3 + wndIdx ; j -= 3 , k -= 3 ) src [ j ] += src [ k ] ; src [ 15 + wndIdx ] += src [ 9 + wndIdx ] ; src [ 9 + wndIdx ] += src [ 3 + wndIdx ] ; float pp2 = src [ 12 + wndIdx ] * cos600 ; float pp1 = src [ 6 + wndIdx ] * cos300 ; float sum = src [ 0 + wndIdx ] + pp2 ; tmp [ 1 ] = src [ wndIdx ] - src [ 12 + wndIdx ] ; tmp [ 0 ] = sum + pp1 ; tmp [ 2 ] = sum - pp1 ; pp2 = src [ 15 + wndIdx ] * cos600 ; pp1 = src [ 9 + wndIdx ] * cos300 ; sum = src [ 3 + wndIdx ] + pp2 ; tmp [ 4 ] = src [ 3 + wndIdx ] - src [ 15 + wndIdx ] ; tmp [ 5 ] = sum + pp1 ; tmp [ 3 ] = sum - pp1 ; tmp [ 3 ] *= factor12pt0 ; tmp [ 4 ] *= cos450 ; tmp [ 5 ] *= factor12pt1 ; float t = tmp [ 0 ] ; tmp [ 0 ] += tmp [ 5 ] ; tmp [ 5 ] = t - tmp [ 5 ] ; t = tmp [ 1 ] ; tmp [ 1 ] += tmp [ 4 ] ; tmp [ 4 ] = t - tmp [ 4 ] ; t = tmp [ 2 ] ; tmp [ 2 ] += tmp [ 3 ] ; tmp [ 3 ] = t - tmp [ 3 ] ; for ( int j = 0 ; j < 6 ; j ++ ) tmp [ j ] *= factor12 [ j ] ; tmp [ 8 ] = - tmp [ 0 ] * cos375 ; tmp [ 9 ] = - tmp [ 0 ] * cos525 ; tmp [ 7 ] = - tmp [ 1 ] * cos225 ; tmp [ 10 ] = - tmp [ 1 ] * cos675 ; tmp [ 6 ] = - tmp [ 2 ] * cos075 ; tmp [ 11 ] = - tmp [ 2 ] * cos825 ; tmp [ 0 ] = tmp [ 3 ] ; tmp [ 1 ] = tmp [ 4 ] * cos675 ; tmp [ 2 ] = tmp [ 5 ] * cos525 ; tmp [ 3 ] = - tmp [ 5 ] * cos375 ; tmp [ 4 ] = - tmp [ 4 ] * cos225 ; tmp [ 5 ] = - tmp [ 0 ] * cos075 ; tmp [ 0 ] *= cos825 ; for ( int i = 0 , j = outOff + 6 ; i < 12 ; i ++ , j ++ ) { dst [ j ] += tmp [ i ] ; }


signature:
public class SBR { /** * / * table 2 */
public int decode ( IBitStream ld , int cnt ) throws AACException { } }

implementation:
int result = 0 ; int num_align_bits = 0 ; long num_sbr_bits1 = ld . getPosition ( ) ; int num_sbr_bits2 ; int saved_start_freq , saved_samplerate_mode ; int saved_stop_freq , saved_freq_scale ; int saved_xover_band ; boolean saved_alter_scale ; int bs_extension_type = ld . readBits ( 4 ) ; if ( bs_extension_type == EXT_SBR_DATA_CRC ) { this . bs_sbr_crc_bits = ld . readBits ( 10 ) ; } /* save old header values , in case the new ones are corrupted */
saved_start_freq = this . bs_start_freq ; saved_samplerate_mode = this . bs_samplerate_mode ; saved_stop_freq = this . bs_stop_freq ; saved_freq_scale = this . bs_freq_scale ; saved_alter_scale = this . bs_alter_scale ; saved_xover_band = this . bs_xover_band ; this . bs_header_flag = ld . readBool ( ) ; if ( this . bs_header_flag ) sbr_header ( ld ) ; /* Reset ? */
sbr_reset ( ) ; /* first frame should have a header */
// if ( ! ( sbr . frame = = 0 & & sbr . bs _ header _ flag = = 0 ) )
if ( this . header_count != 0 ) { if ( this . Reset || ( this . bs_header_flag && this . just_seeked ) ) { int rt = calc_sbr_tables ( this . bs_start_freq , this . bs_stop_freq , this . bs_samplerate_mode , this . bs_freq_scale , this . bs_alter_scale , this . bs_xover_band ) ; /* if an error occured with the new header values revert to the old ones */
if ( rt > 0 ) { calc_sbr_tables ( saved_start_freq , saved_stop_freq , saved_samplerate_mode , saved_freq_scale , saved_alter_scale , saved_xover_band ) ; } } if ( result == 0 ) { result = sbr_data ( ld ) ; /* sbr _ data ( ) returning an error means that there was an error in
 envelope _ time _ border _ vector ( ) .
 In this case the old time border vector is saved and all the previous
 data normally read after sbr _ grid ( ) is saved . */
/* to be on the safe side , calculate old sbr tables in case of error */
if ( ( result > 0 ) && ( this . Reset || ( this . bs_header_flag && this . just_seeked ) ) ) { calc_sbr_tables ( saved_start_freq , saved_stop_freq , saved_samplerate_mode , saved_freq_scale , saved_alter_scale , saved_xover_band ) ; } /* we should be able to safely set result to 0 now , */
/* but practise indicates this doesn ' t work well */
} } else { result = 1 ; } num_sbr_bits2 = ( int ) ( ld . getPosition ( ) - num_sbr_bits1 ) ; /* check if we read more bits then were available for sbr */
if ( 8 * cnt < num_sbr_bits2 ) { throw new AACException ( "frame overread" ) ; // faad _ resetbits ( ld , num _ sbr _ bits1 + 8 * cnt ) ;
// num _ sbr _ bits2 = 8 * cnt ;
/* turn off PS for the unfortunate case that we randomly read some
 * PS data that looks correct */
// this . ps _ used = 0;
/* Make sure it doesn ' t decode SBR in this frame , or we ' ll get glitches */
// return 1;
} { /* -4 does not apply , bs _ extension _ type is re - read in this function */
num_align_bits = 8 * cnt - num_sbr_bits2 ; while ( num_align_bits > 7 ) { ld . readBits ( 8 ) ; num_align_bits -= 8 ; } ld . readBits ( num_align_bits ) ; } return result ;


signature:
public class SBR { /** * / * table 3 */
private void sbr_header ( IBitStream ld ) throws AACException { } }

implementation:
boolean bs_header_extra_1 , bs_header_extra_2 ; this . header_count ++ ; this . bs_amp_res = ld . readBool ( ) ; /* bs _ start _ freq and bs _ stop _ freq must define a fequency band that does
 not exceed 48 channels */
this . bs_start_freq = ld . readBits ( 4 ) ; this . bs_stop_freq = ld . readBits ( 4 ) ; this . bs_xover_band = ld . readBits ( 3 ) ; ld . readBits ( 2 ) ; // reserved
bs_header_extra_1 = ld . readBool ( ) ; bs_header_extra_2 = ld . readBool ( ) ; if ( bs_header_extra_1 ) { this . bs_freq_scale = ld . readBits ( 2 ) ; this . bs_alter_scale = ld . readBool ( ) ; this . bs_noise_bands = ld . readBits ( 2 ) ; } else { /* Default values */
this . bs_freq_scale = 2 ; this . bs_alter_scale = true ; this . bs_noise_bands = 2 ; } if ( bs_header_extra_2 ) { this . bs_limiter_bands = ld . readBits ( 2 ) ; this . bs_limiter_gains = ld . readBits ( 2 ) ; this . bs_interpol_freq = ld . readBool ( ) ; this . bs_smoothing_mode = ld . readBool ( ) ; } else { /* Default values */
this . bs_limiter_bands = 2 ; this . bs_limiter_gains = 2 ; this . bs_interpol_freq = true ; this . bs_smoothing_mode = true ; }


signature:
public class SBR { /** * / * table 4 */
private int sbr_data ( IBitStream ld ) throws AACException { } }

implementation: int result ; this . rate = ( this . bs_samplerate_mode != 0 ) ? 2 : 1 ; if ( stereo ) { if ( ( result = sbr_channel_pair_element ( ld ) ) > 0 ) return result ; } else { if ( ( result = sbr_single_channel_element ( ld ) ) > 0 ) return result ; } return 0 ;


signature:
public class SBR { /** * / * table 5 */
private int sbr_single_channel_element ( IBitStream ld ) throws AACException { } }

implementation:
int result ; if ( ld . readBool ( ) ) { ld . readBits ( 4 ) ; // reserved
} if ( ( result = sbr_grid ( ld , 0 ) ) > 0 ) return result ; sbr_dtdf ( ld , 0 ) ; invf_mode ( ld , 0 ) ; sbr_envelope ( ld , 0 ) ; sbr_noise ( ld , 0 ) ; NoiseEnvelope . dequantChannel ( this , 0 ) ; Arrays . fill ( bs_add_harmonic [ 0 ] , 0 , 64 , 0 ) ; Arrays . fill ( bs_add_harmonic [ 1 ] , 0 , 64 , 0 ) ; this . bs_add_harmonic_flag [ 0 ] = ld . readBool ( ) ; if ( this . bs_add_harmonic_flag [ 0 ] ) sinusoidal_coding ( ld , 0 ) ; this . bs_extended_data = ld . readBool ( ) ; if ( this . bs_extended_data ) { int nr_bits_left ; int ps_ext_read = 0 ; int cnt = ld . readBits ( 4 ) ; if ( cnt == 15 ) { cnt += ld . readBits ( 8 ) ; } nr_bits_left = 8 * cnt ; while ( nr_bits_left > 7 ) { int tmp_nr_bits = 0 ; this . bs_extension_id = ld . readBits ( 2 ) ; tmp_nr_bits += 2 ; /* allow only 1 PS extension element per extension data */
if ( this . bs_extension_id == EXTENSION_ID_PS ) { if ( ps_ext_read == 0 ) { ps_ext_read = 1 ; } else { /* to be safe make it 3 , will switch to " default "
 * in sbr _ extension ( ) */
this . bs_extension_id = 3 ; } } tmp_nr_bits += sbr_extension ( ld , this . bs_extension_id , nr_bits_left ) ; /* check if the data read is bigger than the number of available bits */
if ( tmp_nr_bits > nr_bits_left ) return 1 ; nr_bits_left -= tmp_nr_bits ; } /* Corrigendum */
if ( nr_bits_left > 0 ) { ld . readBits ( nr_bits_left ) ; } } return 0 ;


signature:
public class SBR { /** * / * table 6 */
private int sbr_channel_pair_element ( IBitStream ld ) throws AACException { } }

implementation:
int n , result ; if ( ld . readBool ( ) ) { // reserved
ld . readBits ( 4 ) ; ld . readBits ( 4 ) ; } this . bs_coupling = ld . readBool ( ) ; if ( this . bs_coupling ) { if ( ( result = sbr_grid ( ld , 0 ) ) > 0 ) return result ; /* need to copy some data from left to right */
this . bs_frame_class [ 1 ] = this . bs_frame_class [ 0 ] ; this . L_E [ 1 ] = this . L_E [ 0 ] ; this . L_Q [ 1 ] = this . L_Q [ 0 ] ; this . bs_pointer [ 1 ] = this . bs_pointer [ 0 ] ; for ( n = 0 ; n <= this . L_E [ 0 ] ; n ++ ) { this . t_E [ 1 ] [ n ] = this . t_E [ 0 ] [ n ] ; this . f [ 1 ] [ n ] = this . f [ 0 ] [ n ] ; } for ( n = 0 ; n <= this . L_Q [ 0 ] ; n ++ ) { this . t_Q [ 1 ] [ n ] = this . t_Q [ 0 ] [ n ] ; } sbr_dtdf ( ld , 0 ) ; sbr_dtdf ( ld , 1 ) ; invf_mode ( ld , 0 ) ; /* more copying */
for ( n = 0 ; n < this . N_Q ; n ++ ) { this . bs_invf_mode [ 1 ] [ n ] = this . bs_invf_mode [ 0 ] [ n ] ; } sbr_envelope ( ld , 0 ) ; sbr_noise ( ld , 0 ) ; sbr_envelope ( ld , 1 ) ; sbr_noise ( ld , 1 ) ; Arrays . fill ( bs_add_harmonic [ 0 ] , 0 , 64 , 0 ) ; Arrays . fill ( bs_add_harmonic [ 1 ] , 0 , 64 , 0 ) ; this . bs_add_harmonic_flag [ 0 ] = ld . readBool ( ) ; if ( this . bs_add_harmonic_flag [ 0 ] ) sinusoidal_coding ( ld , 0 ) ; this . bs_add_harmonic_flag [ 1 ] = ld . readBool ( ) ; if ( this . bs_add_harmonic_flag [ 1 ] ) sinusoidal_coding ( ld , 1 ) ; } else { int [ ] saved_t_E = new int [ 6 ] , saved_t_Q = new int [ 3 ] ; int saved_L_E = this . L_E [ 0 ] ; int saved_L_Q = this . L_Q [ 0 ] ; int saved_frame_class = this . bs_frame_class [ 0 ] ; for ( n = 0 ; n < saved_L_E ; n ++ ) { saved_t_E [ n ] = this . t_E [ 0 ] [ n ] ; } for ( n = 0 ; n < saved_L_Q ; n ++ ) { saved_t_Q [ n ] = this . t_Q [ 0 ] [ n ] ; } if ( ( result = sbr_grid ( ld , 0 ) ) > 0 ) return result ; if ( ( result = sbr_grid ( ld , 1 ) ) > 0 ) { /* restore first channel data as well */
this . bs_frame_class [ 0 ] = saved_frame_class ; this . L_E [ 0 ] = saved_L_E ; this . L_Q [ 0 ] = saved_L_Q ; for ( n = 0 ; n < 6 ; n ++ ) { this . t_E [ 0 ] [ n ] = saved_t_E [ n ] ; } for ( n = 0 ; n < 3 ; n ++ ) { this . t_Q [ 0 ] [ n ] = saved_t_Q [ n ] ; } return result ; } sbr_dtdf ( ld , 0 ) ; sbr_dtdf ( ld , 1 ) ; invf_mode ( ld , 0 ) ; invf_mode ( ld , 1 ) ; sbr_envelope ( ld , 0 ) ; sbr_envelope ( ld , 1 ) ; sbr_noise ( ld , 0 ) ; sbr_noise ( ld , 1 ) ; Arrays . fill ( bs_add_harmonic [ 0 ] , 0 , 64 , 0 ) ; Arrays . fill ( bs_add_harmonic [ 1 ] , 0 , 64 , 0 ) ; this . bs_add_harmonic_flag [ 0 ] = ld . readBool ( ) ; if ( this . bs_add_harmonic_flag [ 0 ] ) sinusoidal_coding ( ld , 0 ) ; this . bs_add_harmonic_flag [ 1 ] = ld . readBool ( ) ; if ( this . bs_add_harmonic_flag [ 1 ] ) sinusoidal_coding ( ld , 1 ) ; } NoiseEnvelope . dequantChannel ( this , 0 ) ; NoiseEnvelope . dequantChannel ( this , 1 ) ; if ( this . bs_coupling ) NoiseEnvelope . unmap ( this ) ; this . bs_extended_data = ld . readBool ( ) ; if ( this . bs_extended_data ) { int nr_bits_left ; int cnt = ld . readBits ( 4 ) ; if ( cnt == 15 ) { cnt += ld . readBits ( 8 ) ; } nr_bits_left = 8 * cnt ; while ( nr_bits_left > 7 ) { int tmp_nr_bits = 0 ; this . bs_extension_id = ld . readBits ( 2 ) ; tmp_nr_bits += 2 ; tmp_nr_bits += sbr_extension ( ld , this . bs_extension_id , nr_bits_left ) ; /* check if the data read is bigger than the number of available bits */
if ( tmp_nr_bits > nr_bits_left ) return 1 ; nr_bits_left -= tmp_nr_bits ; } /* Corrigendum */
if ( nr_bits_left > 0 ) { ld . readBits ( nr_bits_left ) ; } } return 0 ;


signature:
public class SBR { /** * / * table 7 */
private int sbr_grid ( IBitStream ld , int ch ) throws AACException { } }

implementation:
int i , env , rel , result ; int bs_abs_bord , bs_abs_bord_1 ; int bs_num_env = 0 ; int saved_L_E = this . L_E [ ch ] ; int saved_L_Q = this . L_Q [ ch ] ; int saved_frame_class = this . bs_frame_class [ ch ] ; this . bs_frame_class [ ch ] = ld . readBits ( 2 ) ; switch ( this . bs_frame_class [ ch ] ) { case FIXFIX : i = ld . readBits ( 2 ) ; bs_num_env = Math . min ( 1 << i , 5 ) ; i = ld . readBit ( ) ; for ( env = 0 ; env < bs_num_env ; env ++ ) { this . f [ ch ] [ env ] = i ; } this . abs_bord_lead [ ch ] = 0 ; this . abs_bord_trail [ ch ] = this . numTimeSlots ; this . n_rel_lead [ ch ] = bs_num_env - 1 ; this . n_rel_trail [ ch ] = 0 ; break ; case FIXVAR : bs_abs_bord = ld . readBits ( 2 ) + this . numTimeSlots ; bs_num_env = ld . readBits ( 2 ) + 1 ; for ( rel = 0 ; rel < bs_num_env - 1 ; rel ++ ) { this . bs_rel_bord [ ch ] [ rel ] = 2 * ld . readBits ( 2 ) + 2 ; } i = sbr_log2 ( bs_num_env + 1 ) ; this . bs_pointer [ ch ] = ld . readBits ( i ) ; for ( env = 0 ; env < bs_num_env ; env ++ ) { this . f [ ch ] [ bs_num_env - env - 1 ] = ld . readBit ( ) ; } this . abs_bord_lead [ ch ] = 0 ; this . abs_bord_trail [ ch ] = bs_abs_bord ; this . n_rel_lead [ ch ] = 0 ; this . n_rel_trail [ ch ] = bs_num_env - 1 ; break ; case VARFIX : bs_abs_bord = ld . readBits ( 2 ) ; bs_num_env = ld . readBits ( 2 ) + 1 ; for ( rel = 0 ; rel < bs_num_env - 1 ; rel ++ ) { this . bs_rel_bord [ ch ] [ rel ] = 2 * ld . readBits ( 2 ) + 2 ; } i = sbr_log2 ( bs_num_env + 1 ) ; this . bs_pointer [ ch ] = ld . readBits ( i ) ; for ( env = 0 ; env < bs_num_env ; env ++ ) { this . f [ ch ] [ env ] = ld . readBit ( ) ; } this . abs_bord_lead [ ch ] = bs_abs_bord ; this . abs_bord_trail [ ch ] = this . numTimeSlots ; this . n_rel_lead [ ch ] = bs_num_env - 1 ; this . n_rel_trail [ ch ] = 0 ; break ; case VARVAR : bs_abs_bord = ld . readBits ( 2 ) ; bs_abs_bord_1 = ld . readBits ( 2 ) + this . numTimeSlots ; this . bs_num_rel_0 [ ch ] = ld . readBits ( 2 ) ; this . bs_num_rel_1 [ ch ] = ld . readBits ( 2 ) ; bs_num_env = Math . min ( 5 , this . bs_num_rel_0 [ ch ] + this . bs_num_rel_1 [ ch ] + 1 ) ; for ( rel = 0 ; rel < this . bs_num_rel_0 [ ch ] ; rel ++ ) { this . bs_rel_bord_0 [ ch ] [ rel ] = 2 * ld . readBits ( 2 ) + 2 ; } for ( rel = 0 ; rel < this . bs_num_rel_1 [ ch ] ; rel ++ ) { this . bs_rel_bord_1 [ ch ] [ rel ] = 2 * ld . readBits ( 2 ) + 2 ; } i = sbr_log2 ( this . bs_num_rel_0 [ ch ] + this . bs_num_rel_1 [ ch ] + 2 ) ; this . bs_pointer [ ch ] = ld . readBits ( i ) ; for ( env = 0 ; env < bs_num_env ; env ++ ) { this . f [ ch ] [ env ] = ld . readBit ( ) ; } this . abs_bord_lead [ ch ] = bs_abs_bord ; this . abs_bord_trail [ ch ] = bs_abs_bord_1 ; this . n_rel_lead [ ch ] = this . bs_num_rel_0 [ ch ] ; this . n_rel_trail [ ch ] = this . bs_num_rel_1 [ ch ] ; break ; } if ( this . bs_frame_class [ ch ] == VARVAR ) this . L_E [ ch ] = Math . min ( bs_num_env , 5 ) ; else this . L_E [ ch ] = Math . min ( bs_num_env , 4 ) ; if ( this . L_E [ ch ] <= 0 ) return 1 ; if ( this . L_E [ ch ] > 1 ) this . L_Q [ ch ] = 2 ; else this . L_Q [ ch ] = 1 ; /* TODO : this code can probably be integrated into the code above ! */
if ( ( result = TFGrid . envelope_time_border_vector ( this , ch ) ) > 0 ) { this . bs_frame_class [ ch ] = saved_frame_class ; this . L_E [ ch ] = saved_L_E ; this . L_Q [ ch ] = saved_L_Q ; return result ; } TFGrid . noise_floor_time_border_vector ( this , ch ) ; return 0 ;


signature:
public class SBR { /** * / * table 8 */
private void sbr_dtdf ( IBitStream ld , int ch ) throws AACException { } }

implementation: int i ; for ( i = 0 ; i < this . L_E [ ch ] ; i ++ ) { this . bs_df_env [ ch ] [ i ] = ld . readBit ( ) ; } for ( i = 0 ; i < this . L_Q [ ch ] ; i ++ ) { this . bs_df_noise [ ch ] [ i ] = ld . readBit ( ) ; }


signature:
public class SBR { /** * / * table 9 */
private void invf_mode ( IBitStream ld , int ch ) throws AACException { } }

implementation: int n ; for ( n = 0 ; n < this . N_Q ; n ++ ) { this . bs_invf_mode [ ch ] [ n ] = ld . readBits ( 2 ) ; }


signature:
public class SBR { /** * / * table 12 */
private void sinusoidal_coding ( IBitStream ld , int ch ) throws AACException { } }

implementation: int n ; for ( n = 0 ; n < this . N_high ; n ++ ) { this . bs_add_harmonic [ ch ] [ n ] = ld . readBit ( ) ; }


signature:
public class SBR { /** * / * table 10 */
private void sbr_envelope ( IBitStream ld , int ch ) throws AACException { } }

implementation: int env , band ; int delta = 0 ; int [ ] [ ] t_huff , f_huff ; if ( ( this . L_E [ ch ] == 1 ) && ( this . bs_frame_class [ ch ] == FIXFIX ) ) this . amp_res [ ch ] = false ; else this . amp_res [ ch ] = this . bs_amp_res ; if ( ( this . bs_coupling ) && ( ch == 1 ) ) { delta = 1 ; if ( this . amp_res [ ch ] ) { t_huff = T_HUFFMAN_ENV_BAL_3_0DB ; f_huff = F_HUFFMAN_ENV_BAL_3_0DB ; } else { t_huff = T_HUFFMAN_ENV_BAL_1_5DB ; f_huff = F_HUFFMAN_ENV_BAL_1_5DB ; } } else { delta = 0 ; if ( this . amp_res [ ch ] ) { t_huff = T_HUFFMAN_ENV_3_0DB ; f_huff = F_HUFFMAN_ENV_3_0DB ; } else { t_huff = T_HUFFMAN_ENV_1_5DB ; f_huff = F_HUFFMAN_ENV_1_5DB ; } } for ( env = 0 ; env < this . L_E [ ch ] ; env ++ ) { if ( this . bs_df_env [ ch ] [ env ] == 0 ) { if ( this . bs_coupling && ( ch == 1 ) ) { if ( this . amp_res [ ch ] ) { this . E [ ch ] [ 0 ] [ env ] = ld . readBits ( 5 ) << delta ; } else { this . E [ ch ] [ 0 ] [ env ] = ld . readBits ( 6 ) << delta ; } } else { if ( this . amp_res [ ch ] ) { this . E [ ch ] [ 0 ] [ env ] = ld . readBits ( 6 ) << delta ; } else { this . E [ ch ] [ 0 ] [ env ] = ld . readBits ( 7 ) << delta ; } } for ( band = 1 ; band < this . n [ this . f [ ch ] [ env ] ] ; band ++ ) { this . E [ ch ] [ band ] [ env ] = ( decodeHuffman ( ld , f_huff ) << delta ) ; } } else { for ( band = 0 ; band < this . n [ this . f [ ch ] [ env ] ] ; band ++ ) { this . E [ ch ] [ band ] [ env ] = ( decodeHuffman ( ld , t_huff ) << delta ) ; } } } NoiseEnvelope . extract_envelope_data ( this , ch ) ;


signature:
public class SBR { /** * / * table 11 */
private void sbr_noise ( IBitStream ld , int ch ) throws AACException { } }

implementation: int noise , band ; int delta = 0 ; int [ ] [ ] t_huff , f_huff ; if ( this . bs_coupling && ( ch == 1 ) ) { delta = 1 ; t_huff = T_HUFFMAN_NOISE_BAL_3_0DB ; f_huff = F_HUFFMAN_ENV_BAL_3_0DB ; } else { delta = 0 ; t_huff = T_HUFFMAN_NOISE_3_0DB ; f_huff = F_HUFFMAN_ENV_3_0DB ; } for ( noise = 0 ; noise < this . L_Q [ ch ] ; noise ++ ) { if ( this . bs_df_noise [ ch ] [ noise ] == 0 ) { if ( this . bs_coupling && ( ch == 1 ) ) { this . Q [ ch ] [ 0 ] [ noise ] = ld . readBits ( 5 ) << delta ; } else { this . Q [ ch ] [ 0 ] [ noise ] = ld . readBits ( 5 ) << delta ; } for ( band = 1 ; band < this . N_Q ; band ++ ) { this . Q [ ch ] [ band ] [ noise ] = ( decodeHuffman ( ld , f_huff ) << delta ) ; } } else { for ( band = 0 ; band < this . N_Q ; band ++ ) { this . Q [ ch ] [ band ] [ noise ] = ( decodeHuffman ( ld , t_huff ) << delta ) ; } } } NoiseEnvelope . extract_noise_floor_data ( this , ch ) ;


signature:
public class MTSUtils { /** * Parses PAT ( Program Association Table )
 * @ param data
 * @ deprecated Use org . jcodec . containers . mps . psi . PAT . parse method instead ,
 * this method will not work correctly for streams with multiple
 * programs
 * @ return Pid of the first PMT found in the PAT */
@ Deprecated public static int parsePAT ( ByteBuffer data ) { } }

implementation: PATSection pat = PATSection . parsePAT ( data ) ; if ( pat . getPrograms ( ) . size ( ) > 0 ) return pat . getPrograms ( ) . values ( ) [ 0 ] ; else return - 1 ;


signature:
public class FLVWriter { /** * Add a packet to the underlying file
 * @ param pkt
 * @ throws IOException */
public void addPacket ( FLVTag pkt ) throws IOException { } }

implementation: if ( ! writePacket ( writeBuf , pkt ) ) { writeBuf . flip ( ) ; startOfLastPacket -= out . write ( writeBuf ) ; writeBuf . clear ( ) ; if ( ! writePacket ( writeBuf , pkt ) ) throw new RuntimeException ( "Unexpected" ) ; }


signature:
public class MKVParser { /** * Reads an EBML id from the channel . EBML ids have length encoded inside of them For instance , all one - byte ids have first byte set to ' 1 ' , like 0xA3 or 0xE7 , whereas the two - byte ids have first
 * byte set to ' 0 ' and second byte set to ' 1 ' , thus : 0x42 0x86 or 0x42 0xF7
 * @ return byte array filled with the ebml id
 * @ throws IOException */
static public byte [ ] readEbmlId ( SeekableByteChannel source ) throws IOException { } }

implementation: if ( source . position ( ) == source . size ( ) ) return null ; ByteBuffer buffer = ByteBuffer . allocate ( 8 ) ; buffer . limit ( 1 ) ; source . read ( buffer ) ; buffer . flip ( ) ; byte firstByte = buffer . get ( ) ; int numBytes = EbmlUtil . computeLength ( firstByte ) ; if ( numBytes == 0 ) return null ; if ( numBytes > 1 ) { buffer . limit ( numBytes ) ; source . read ( buffer ) ; } buffer . flip ( ) ; ByteBuffer val = ByteBuffer . allocate ( buffer . remaining ( ) ) ; val . put ( buffer ) ; return val . array ( ) ;