Skip to content

Commit

Permalink
Merge pull request #8 from umjammer/0.8.11
Browse files Browse the repository at this point in the history
0.8.11
  • Loading branch information
umjammer authored Feb 28, 2024
2 parents 2f2d248 + c7b529e commit 32e08f3
Show file tree
Hide file tree
Showing 25 changed files with 109 additions and 184 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
Expand All @@ -34,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -48,8 +52,15 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -63,4 +74,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
10 changes: 5 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: Java CI

on:
push:
Expand All @@ -16,16 +16,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check w/o SNAPSHOT when "bump version"
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT

- name: Set up JDK 8
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
cache: maven

Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[![Release](https://jitpack.io/v/umjammer/vavi-sound-aac.svg)](https://jitpack.io/#umjammer/vavi-sound-aac)
[![Java CI with Maven](https://github.com/umjammer/vavi-sound-aac/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound-aac/actions/workflows/maven.yml)
[![Java CI](https://github.com/umjammer/vavi-sound-aac/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound-aac/actions/workflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-sound-aac/actions/workflows/codeql.yml/badge.svg)](https://github.com/umjammer/vavi-sound-aac/actions/workflows/codeql.yml)
![Java](https://img.shields.io/badge/Java-8-b07219)
![Java](https://img.shields.io/badge/Java-17-b07219)
[![Parent](https://img.shields.io/badge/Parent-vavi--sound--sandbox-pink)](https://github.com/umjammer/vavi-sound-sandbox)

# vavi-sound-aac

Pure Java AAC decoder (Java Sound SPI)
<img src="https://github.com/umjammer/vavi-image-avif/assets/493908/58a132fd-ba3d-4309-9481-2b86fc885f14" width="120" alt="AAC logo"/><sub><a href="https://www.dolby.com/">© Dolby Laboratories, Inc.</a></sub>

<img src="https://github.com/umjammer/vavi-image-avif/assets/493908/58a132fd-ba3d-4309-9481-2b86fc885f14" width="160" alt="AAC logo"/><sub><a href="https://www.dolby.com/">© Dolby Laboratories, Inc.</a></sub>
Pure Java AAC decoder (Java Sound SPI) powered by [JAADec](https://github.com/DV8FromTheWorld/JAADec).

## Install

Expand All @@ -23,6 +23,10 @@ Pure Java AAC decoder (Java Sound SPI)
clip.loop(Clip.LOOP_CONTINUOUSLY);
```

## References

* [jpcsp](https://github.com/jpcsp/jpcsp/tree/master/src/jpcsp/media/codec/aac)

## TODO

* ~~rename project into vavi-sound-aac~~
Expand All @@ -36,7 +40,7 @@ Pure Java AAC decoder (Java Sound SPI)

# JAADec

**This is a fork of https://sourceforge.net/projects/vavi-sound-aac/
**This is a fork of https://sourceforge.net/projects/jaadec/
containing fixes to make it play nice with other Java Sound Providers.**

The original project was licensed under Public Domain
Expand Down
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
31 changes: 12 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>vavi</groupId>
<artifactId>vavi-sound-aac</artifactId>
<version>0.8.10</version>
<version>0.8.11</version>

<description>vavi-sound-aac is an AAC decoder and MP4 demultiplexer library written completely in Java. It uses no native libraries, is platform-independent and portable. It can read MP4 container from almost every input-stream (files, network sockets etc.) and decode AAC-LC (Low Complexity) and HE-AAC (High Efficiency/AAC+).</description>
<url>https://github.com/umjammer/vavi-sound-aac</url>
Expand Down Expand Up @@ -43,23 +43,21 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0</version>
<configuration>
<source>8</source>
<target>8</target>
<encoding>UTF-8</encoding>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.2.2</version>
<configuration>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
</argLine>
<trimStackTrace>false</trimStackTrace>
<forkMode>always</forkMode>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
Expand All @@ -77,7 +75,7 @@
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.3</version>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -87,18 +85,13 @@
<dependencies>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId> <!-- vavi / com.github.umjammer -->
<artifactId>vavi-sound</artifactId>
<version>1.0.15</version>
<exclusions>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
<version>1.0.16</version>
</dependency>

<dependency>
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/net/sourceforge/jaad/MP4Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void main(String[] args) {
}

List<Protection> protections = movie.getProtections();
if (protections.size() > 0) {
if (!protections.isEmpty()) {
System.out.println("\tprotections:");
for (Protection p : protections) {
System.out.println("\t\t" + p.getScheme());
Expand Down Expand Up @@ -84,9 +84,7 @@ private static void printUsage() {

private static void printBox(Box box, int level) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < level; i++) {
sb.append(" ");
}
sb.append(" ".repeat(Math.max(0, level)));
sb.append(box.toString());
System.out.println(sb);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sourceforge/jaad/Radio.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static void decode(String arg) throws Exception {
// send HTTP request
PrintStream out = new PrintStream(sock.getOutputStream());
String path = uri.getPath();
if (path == null || path.equals(""))
if (path == null || path.isEmpty())
path = "/";
if (uri.getQuery() != null)
path += "?" + uri.getQuery();
Expand All @@ -64,7 +64,7 @@ private static void decode(String arg) throws Exception {
String x;
do {
x = in.readLine();
} while (x != null && !x.trim().equals(""));
} while (x != null && !x.trim().isEmpty());

ADTSDemultiplexer adts = new ADTSDemultiplexer(in);
AudioFormat aufmt = new AudioFormat(adts.getSampleFrequency(), 16, adts.getChannelCount(), true, true);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/sourceforge/jaad/aac/error/RVLC.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void decode(BitStream in, ICStream ics, int[][] scaleFactors) {
if (in.readBool()) decodeEscapes(in, ics, scaleFactors);
}

private void decodeEscapes(BitStream in, ICStream ics, int[][] scaleFactors) {
private static void decodeEscapes(BitStream in, ICStream ics, int[][] scaleFactors) {
ICSInfo info = ics.getInfo();
int windowGroupCount = info.getWindowGroupCount();
int maxSFB = info.getMaxSFB();
Expand All @@ -89,7 +89,7 @@ else if (Math.abs(sfbCB[g][sfb]) == ESCAPE_FLAG) {
}
}

private int decodeHuffman(BitStream in) {
private static int decodeHuffman(BitStream in) {
int off = 0;
int i = RVLC_BOOK[off][1];
int cw = in.readBits(i);
Expand All @@ -106,7 +106,7 @@ private int decodeHuffman(BitStream in) {
return RVLC_BOOK[off][0];
}

private int decodeHuffmanEscape(BitStream in) {
private static int decodeHuffmanEscape(BitStream in) {
int off = 0;
int i = ESCAPE_BOOK[off][1];
int cw = in.readBits(i);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sourceforge/jaad/aac/gain/GainControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private float calculateFMD(int bd, int wd, boolean prev, int maxLocGain, int sam
* transforms the exponent value of the gain to the id of the gain change
* point
*/
private int getGainChangePointID(int lngain) {
private static int getGainChangePointID(int lngain) {
for (int i = 0; i < ID_GAIN; i++) {
if (lngain == LN_GAIN[i]) return i;
}
Expand All @@ -282,7 +282,7 @@ private int getGainChangePointID(int lngain) {
* positions is calculated by the formula:
* f(a,b,j) = 2^(((8-j)log2(a)+j*log2(b))/8)
*/
private float interpolateGain(float alev0, float alev1, int iloc) {
private static float interpolateGain(float alev0, float alev1, int iloc) {
float a0 = (float) (Math.log(alev0) / Math.log(2));
float a1 = (float) (Math.log(alev1) / Math.log(2));
return (float) Math.pow(2.0f, (((8 - iloc) * a0 + iloc * a1) / 8));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sourceforge/jaad/aac/gain/IMDCT.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void process2(float[] in, float[] out, WindowSequence winSeq, int winSha
}
}

private void imdct(float[] in, float[] out, float[] window, int n) throws AACException {
private static void imdct(float[] in, float[] out, float[] window, int n) throws AACException {
int n2 = n / 2;
float[][] table, table2;
if (n == 256) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sourceforge/jaad/aac/sbr/HFAdjustment.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void hf_adjustment(SBR sbr, float[][][] Xsbr, Channel ch) {
ch.l_A = ch.L_E + 1 - ch.bs_pointer;
}

adj.estimate_current_envelope(sbr, Xsbr, ch);
HFAdjustment.estimate_current_envelope(sbr, Xsbr, ch);

adj.calculate_gain(sbr, ch);

Expand Down Expand Up @@ -75,7 +75,7 @@ private static int get_S_mapped(SBR sbr, Channel ch, int l, int current_band) {
return 0;
}

private void estimate_current_envelope(SBR sbr, float[][][] Xsbr, Channel ch) {
private static void estimate_current_envelope(SBR sbr, float[][][] Xsbr, Channel ch) {
float nrg, div;

if (sbr.hdr.bs_interpol_freq) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void synthesis(int numTimeSlotsRate, float[][][] X, float[] output) {
}
}

private void DCT4_32(float[] y, float[] x) {
private static void DCT4_32(float[] y, float[] x) {
float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
float f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
float f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
Expand Down Expand Up @@ -534,7 +534,7 @@ private void DCT4_32(float[] y, float[] x) {
y[1] = f397 - f396;
}

private void DST4_32(float[] y, float[] x) {
private static void DST4_32(float[] y, float[] x) {
float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
float f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
float f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sourceforge/jaad/aac/syntax/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String toString() {

static <T extends InstanceTag> List<T>
createTagList(int count, IntFunction<T> newTag) {
List<T> tags = new AbstractList<T>() {
List<T> tags = new AbstractList<>() {

@Override
public int size() {
Expand Down
24 changes: 7 additions & 17 deletions src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,13 @@ public enum WindowSequence {
LONG_STOP_SEQUENCE;

public static WindowSequence forInt(int i) throws AACException {
WindowSequence w;
switch (i) {
case 0:
w = ONLY_LONG_SEQUENCE;
break;
case 1:
w = LONG_START_SEQUENCE;
break;
case 2:
w = EIGHT_SHORT_SEQUENCE;
break;
case 3:
w = LONG_STOP_SEQUENCE;
break;
default:
throw new AACException("unknown window sequence type");
}
WindowSequence w = switch (i) {
case 0 -> ONLY_LONG_SEQUENCE;
case 1 -> LONG_START_SEQUENCE;
case 2 -> EIGHT_SHORT_SEQUENCE;
case 3 -> LONG_STOP_SEQUENCE;
default -> throw new AACException("unknown window sequence type");
};
return w;
}
}
Expand Down
Loading

0 comments on commit 32e08f3

Please sign in to comment.