< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 45,55 **** /* Tables used for A-law decoding */ private static final byte[] ALAW_TABH = new byte[256]; private static final byte[] ALAW_TABL = new byte[256]; ! private static final short seg_end[] = { 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF }; /** * Initializes the decode tables. --- 45,55 ---- /* Tables used for A-law decoding */ private static final byte[] ALAW_TABH = new byte[256]; private static final byte[] ALAW_TABL = new byte[256]; ! private static final short[] seg_end = { 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF }; /** * Initializes the decode tables.
*** 89,110 **** if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED )) { if( sourceFormat.getSampleSizeInBits() == 16 ) { ! AudioFormat.Encoding enc[] = new AudioFormat.Encoding[1]; enc[0] = AudioFormat.Encoding.ALAW; return enc; } else { return new AudioFormat.Encoding[0]; } } else if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.ALAW ) ) { if( sourceFormat.getSampleSizeInBits() == 8 ) { ! AudioFormat.Encoding enc[] = new AudioFormat.Encoding[1]; enc[0] = AudioFormat.Encoding.PCM_SIGNED; return enc; } else { return new AudioFormat.Encoding[0]; --- 89,110 ---- if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED )) { if( sourceFormat.getSampleSizeInBits() == 16 ) { ! AudioFormat.Encoding[] enc = new AudioFormat.Encoding[1]; enc[0] = AudioFormat.Encoding.ALAW; return enc; } else { return new AudioFormat.Encoding[0]; } } else if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.ALAW ) ) { if( sourceFormat.getSampleSizeInBits() == 8 ) { ! AudioFormat.Encoding[] enc = new AudioFormat.Encoding[1]; enc[0] = AudioFormat.Encoding.PCM_SIGNED; return enc; } else { return new AudioFormat.Encoding[0];
*** 244,265 **** private final class AlawCodecStream extends AudioInputStream { // tempBuffer required only for encoding (when encode is true) private static final int tempBufferSize = 64; ! private byte tempBuffer [] = null; /** * True to encode to a-law, false to decode to linear */ boolean encode = false; AudioFormat encodeFormat; AudioFormat decodeFormat; ! byte tabByte1[] = null; ! byte tabByte2[] = null; int highByte = 0; int lowByte = 1; AlawCodecStream(AudioInputStream stream, AudioFormat outputFormat) { --- 244,265 ---- private final class AlawCodecStream extends AudioInputStream { // tempBuffer required only for encoding (when encode is true) private static final int tempBufferSize = 64; ! private byte[] tempBuffer = null; /** * True to encode to a-law, false to decode to linear */ boolean encode = false; AudioFormat encodeFormat; AudioFormat decodeFormat; ! byte[] tabByte1 = null; ! byte[] tabByte2 = null; int highByte = 0; int lowByte = 1; AlawCodecStream(AudioInputStream stream, AudioFormat outputFormat) {
*** 318,328 **** /* * $$jb 2/23/99 * Used to determine segment number in aLaw encoding */ ! private short search(short val, short table[], short size) { for(short i = 0; i < size; i++) { if (val <= table[i]) { return i; } } return size; } --- 318,328 ---- /* * $$jb 2/23/99 * Used to determine segment number in aLaw encoding */ ! private short search(short val, short[] table, short size) { for(short i = 0; i < size; i++) { if (val <= table[i]) { return i; } } return size; }
< prev index next >