DtsUtil.smali
.class public final Lcom/google/android/exoplayer2/audio/DtsUtil;
.super Ljava/lang/Object;
.source "DtsUtil.java"
# static fields
.field private static final CHANNELS_BY_AMODE:[I
.field private static final FIRST_BYTE_14B_BE:B = 0x1ft
.field private static final FIRST_BYTE_14B_LE:B = -0x1t
.field private static final FIRST_BYTE_BE:B = 0x7ft
.field private static final FIRST_BYTE_LE:B = -0x2t
.field private static final SAMPLE_RATE_BY_SFREQ:[I
.field private static final SYNC_VALUE_14B_BE:I = 0x1fffe800
.field private static final SYNC_VALUE_14B_LE:I = -0xe0ff18
.field private static final SYNC_VALUE_BE:I = 0x7ffe8001
.field private static final SYNC_VALUE_LE:I = -0x180fe80
.field private static final TWICE_BITRATE_KBPS_BY_RATE:[I
# direct methods
.method static constructor <clinit>()V
.registers 2
.line 42
const/16 v0, 0x10
new-array v1, v0, [I
fill-array-data v1, :array_1a
sput-object v1, Lcom/google/android/exoplayer2/audio/DtsUtil;->CHANNELS_BY_AMODE:[I
.line 48
new-array v0, v0, [I
fill-array-data v0, :array_3e
sput-object v0, Lcom/google/android/exoplayer2/audio/DtsUtil;->SAMPLE_RATE_BY_SFREQ:[I
.line 54
const/16 v0, 0x1d
new-array v0, v0, [I
fill-array-data v0, :array_62
sput-object v0, Lcom/google/android/exoplayer2/audio/DtsUtil;->TWICE_BITRATE_KBPS_BY_RATE:[I
return-void
:array_1a
.array-data 4
0x1
0x2
0x2
0x2
0x2
0x3
0x3
0x4
0x4
0x5
0x6
0x6
0x6
0x7
0x8
0x8
.end array-data
:array_3e
.array-data 4
-0x1
0x1f40
0x3e80
0x7d00
-0x1
-0x1
0x2b11
0x5622
0xac44
-0x1
-0x1
0x2ee0
0x5dc0
0xbb80
-0x1
-0x1
.end array-data
:array_62
.array-data 4
0x40
0x70
0x80
0xc0
0xe0
0x100
0x180
0x1c0
0x200
0x280
0x300
0x380
0x400
0x480
0x500
0x600
0x780
0x800
0x900
0xa00
0xa80
0xb00
0xb07
0xb80
0xc00
0xf00
0x1000
0x1800
0x1e00
.end array-data
.end method
.method private constructor <init>()V
.registers 1
.line 214
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getDtsFrameSize([B)I
.registers 7
.param p0, "data" # [B
.line 160
const/4 v0, 0x0
.line 161
.local v0, "uses14BitPerWord":Z
const/4 v1, 0x0
aget-byte v1, p0, v1
const/4 v2, -0x2
const/4 v3, 0x6
const/4 v4, 0x7
const/4 v5, 0x4
if-eq v1, v2, :cond_59
const/4 v2, -0x1
if-eq v1, v2, :cond_40
const/16 v2, 0x1f
if-eq v1, v2, :cond_27
.line 175
const/4 v1, 0x5
aget-byte v1, p0, v1
and-int/lit8 v1, v1, 0x3
shl-int/lit8 v1, v1, 0xc
aget-byte v2, p0, v3
and-int/lit16 v2, v2, 0xff
shl-int/2addr v2, v5
or-int/2addr v1, v2
aget-byte v2, p0, v4
and-int/lit16 v2, v2, 0xf0
shr-int/2addr v2, v5
or-int/2addr v1, v2
add-int/lit8 v1, v1, 0x1
.local v1, "fsize":I
goto :goto_6e
.line 163
.end local v1 # "fsize":I
:cond_27
aget-byte v1, p0, v3
and-int/lit8 v1, v1, 0x3
shl-int/lit8 v1, v1, 0xc
aget-byte v2, p0, v4
and-int/lit16 v2, v2, 0xff
shl-int/2addr v2, v5
or-int/2addr v1, v2
const/16 v2, 0x8
aget-byte v2, p0, v2
and-int/lit8 v2, v2, 0x3c
shr-int/lit8 v2, v2, 0x2
or-int/2addr v1, v2
add-int/lit8 v1, v1, 0x1
.line 164
.restart local v1 # "fsize":I
const/4 v0, 0x1
.line 165
goto :goto_6e
.line 170
.end local v1 # "fsize":I
:cond_40
aget-byte v1, p0, v4
and-int/lit8 v1, v1, 0x3
shl-int/lit8 v1, v1, 0xc
aget-byte v2, p0, v3
and-int/lit16 v2, v2, 0xff
shl-int/2addr v2, v5
or-int/2addr v1, v2
const/16 v2, 0x9
aget-byte v2, p0, v2
and-int/lit8 v2, v2, 0x3c
shr-int/lit8 v2, v2, 0x2
or-int/2addr v1, v2
add-int/lit8 v1, v1, 0x1
.line 171
.restart local v1 # "fsize":I
const/4 v0, 0x1
.line 172
goto :goto_6e
.line 167
.end local v1 # "fsize":I
:cond_59
aget-byte v1, p0, v5
and-int/lit8 v1, v1, 0x3
shl-int/lit8 v1, v1, 0xc
aget-byte v2, p0, v4
and-int/lit16 v2, v2, 0xff
shl-int/2addr v2, v5
or-int/2addr v1, v2
aget-byte v2, p0, v3
and-int/lit16 v2, v2, 0xf0
shr-int/2addr v2, v5
or-int/2addr v1, v2
add-int/lit8 v1, v1, 0x1
.line 168
.restart local v1 # "fsize":I
nop
.line 179
:goto_6e
if-eqz v0, :cond_75
mul-int/lit8 v2, v1, 0x10
div-int/lit8 v2, v2, 0xe
goto :goto_76
:cond_75
move v2, v1
:goto_76
return v2
.end method
.method private static getNormalizedFrameHeader([B)Lcom/google/android/exoplayer2/util/ParsableBitArray;
.registers 5
.param p0, "frameHeader" # [B
.line 183
const/4 v0, 0x0
aget-byte v1, p0, v0
const/16 v2, 0x7f
if-ne v1, v2, :cond_d
.line 185
new-instance v0, Lcom/google/android/exoplayer2/util/ParsableBitArray;
invoke-direct {v0, p0}, Lcom/google/android/exoplayer2/util/ParsableBitArray;-><init>([B)V
return-object v0
.line 188
:cond_d
array-length v1, p0
invoke-static {p0, v1}, Ljava/util/Arrays;->copyOf([BI)[B
move-result-object p0
.line 189
invoke-static {p0}, Lcom/google/android/exoplayer2/audio/DtsUtil;->isLittleEndianFrameHeader([B)Z
move-result v1
if-eqz v1, :cond_2d
.line 191
const/4 v1, 0x0
.local v1, "i":I
:goto_19
array-length v2, p0
add-int/lit8 v2, v2, -0x1
if-ge v1, v2, :cond_2d
.line 192
aget-byte v2, p0, v1
.line 193
.local v2, "temp":B
add-int/lit8 v3, v1, 0x1
aget-byte v3, p0, v3
aput-byte v3, p0, v1
.line 194
add-int/lit8 v3, v1, 0x1
aput-byte v2, p0, v3
.line 191
.end local v2 # "temp":B
add-int/lit8 v1, v1, 0x2
goto :goto_19
.line 197
.end local v1 # "i":I
:cond_2d
new-instance v1, Lcom/google/android/exoplayer2/util/ParsableBitArray;
invoke-direct {v1, p0}, Lcom/google/android/exoplayer2/util/ParsableBitArray;-><init>([B)V
.line 198
.local v1, "frameBits":Lcom/google/android/exoplayer2/util/ParsableBitArray;
aget-byte v0, p0, v0
const/16 v2, 0x1f
if-ne v0, v2, :cond_53
.line 200
new-instance v0, Lcom/google/android/exoplayer2/util/ParsableBitArray;
invoke-direct {v0, p0}, Lcom/google/android/exoplayer2/util/ParsableBitArray;-><init>([B)V
.line 201
.local v0, "scratchBits":Lcom/google/android/exoplayer2/util/ParsableBitArray;
:goto_3d
invoke-virtual {v0}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->bitsLeft()I
move-result v2
const/16 v3, 0x10
if-lt v2, v3, :cond_53
.line 202
const/4 v2, 0x2
invoke-virtual {v0, v2}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->skipBits(I)V
.line 203
const/16 v2, 0xe
invoke-virtual {v0, v2}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->readBits(I)I
move-result v3
invoke-virtual {v1, v3, v2}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->putInt(II)V
goto :goto_3d
.line 206
.end local v0 # "scratchBits":Lcom/google/android/exoplayer2/util/ParsableBitArray;
:cond_53
invoke-virtual {v1, p0}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->reset([B)V
.line 207
return-object v1
.end method
.method private static isLittleEndianFrameHeader([B)Z
.registers 4
.param p0, "frameHeader" # [B
.line 211
const/4 v0, 0x0
aget-byte v1, p0, v0
const/4 v2, -0x2
if-eq v1, v2, :cond_b
aget-byte v1, p0, v0
const/4 v2, -0x1
if-ne v1, v2, :cond_c
:cond_b
const/4 v0, 0x1
:cond_c
return v0
.end method
.method public static isSyncWord(I)Z
.registers 2
.param p0, "word" # I
.line 66
const v0, 0x7ffe8001
if-eq p0, v0, :cond_17
const v0, -0x180fe80
if-eq p0, v0, :cond_17
const v0, 0x1fffe800
if-eq p0, v0, :cond_17
const v0, -0xe0ff18
if-ne p0, v0, :cond_15
goto :goto_17
:cond_15
const/4 v0, 0x0
goto :goto_18
:cond_17
:goto_17
const/4 v0, 0x1
:goto_18
return v0
.end method
.method public static parseDtsAudioSampleCount(Ljava/nio/ByteBuffer;)I
.registers 4
.param p0, "buffer" # Ljava/nio/ByteBuffer;
.line 133
invoke-virtual {p0}, Ljava/nio/ByteBuffer;->position()I
move-result v0
.line 135
.local v0, "position":I
invoke-virtual {p0, v0}, Ljava/nio/ByteBuffer;->get(I)B
move-result v1
const/4 v2, -0x2
if-eq v1, v2, :cond_54
const/4 v2, -0x1
if-eq v1, v2, :cond_3e
const/16 v2, 0x1f
if-eq v1, v2, :cond_28
.line 147
add-int/lit8 v1, v0, 0x4
invoke-virtual {p0, v1}, Ljava/nio/ByteBuffer;->get(I)B
move-result v1
and-int/lit8 v1, v1, 0x1
shl-int/lit8 v1, v1, 0x6
add-int/lit8 v2, v0, 0x5
invoke-virtual {p0, v2}, Ljava/nio/ByteBuffer;->get(I)B
move-result v2
and-int/lit16 v2, v2, 0xfc
shr-int/lit8 v2, v2, 0x2
or-int/2addr v1, v2
.local v1, "nblks":I
goto :goto_6a
.line 143
.end local v1 # "nblks":I
:cond_28
add-int/lit8 v1, v0, 0x5
invoke-virtual {p0, v1}, Ljava/nio/ByteBuffer;->get(I)B
move-result v1
and-int/lit8 v1, v1, 0x7
shl-int/lit8 v1, v1, 0x4
add-int/lit8 v2, v0, 0x6
invoke-virtual {p0, v2}, Ljava/nio/ByteBuffer;->get(I)B
move-result v2
and-int/lit8 v2, v2, 0x3c
shr-int/lit8 v2, v2, 0x2
or-int/2addr v1, v2
.line 144
.restart local v1 # "nblks":I
goto :goto_6a
.line 140
.end local v1 # "nblks":I
:cond_3e
add-int/lit8 v1, v0, 0x4
invoke-virtual {p0, v1}, Ljava/nio/ByteBuffer;->get(I)B
move-result v1
and-int/lit8 v1, v1, 0x7
shl-int/lit8 v1, v1, 0x4
add-int/lit8 v2, v0, 0x7
invoke-virtual {p0, v2}, Ljava/nio/ByteBuffer;->get(I)B
move-result v2
and-int/lit8 v2, v2, 0x3c
shr-int/lit8 v2, v2, 0x2
or-int/2addr v1, v2
.line 141
.restart local v1 # "nblks":I
goto :goto_6a
.line 137
.end local v1 # "nblks":I
:cond_54
add-int/lit8 v1, v0, 0x5
invoke-virtual {p0, v1}, Ljava/nio/ByteBuffer;->get(I)B
move-result v1
and-int/lit8 v1, v1, 0x1
shl-int/lit8 v1, v1, 0x6
add-int/lit8 v2, v0, 0x4
invoke-virtual {p0, v2}, Ljava/nio/ByteBuffer;->get(I)B
move-result v2
and-int/lit16 v2, v2, 0xfc
shr-int/lit8 v2, v2, 0x2
or-int/2addr v1, v2
.line 138
.restart local v1 # "nblks":I
nop
.line 149
:goto_6a
add-int/lit8 v2, v1, 0x1
mul-int/lit8 v2, v2, 0x20
return v2
.end method
.method public static parseDtsAudioSampleCount([B)I
.registers 7
.param p0, "data" # [B
.line 107
const/4 v0, 0x0
aget-byte v0, p0, v0
const/4 v1, -0x2
const/4 v2, 0x6
const/4 v3, 0x5
const/4 v4, 0x4
if-eq v0, v1, :cond_36
const/4 v1, -0x1
const/4 v5, 0x7
if-eq v0, v1, :cond_2a
const/16 v1, 0x1f
if-eq v0, v1, :cond_1e
.line 119
aget-byte v0, p0, v4
and-int/lit8 v0, v0, 0x1
shl-int/2addr v0, v2
aget-byte v1, p0, v3
and-int/lit16 v1, v1, 0xfc
shr-int/lit8 v1, v1, 0x2
or-int/2addr v0, v1
.local v0, "nblks":I
goto :goto_43
.line 115
.end local v0 # "nblks":I
:cond_1e
aget-byte v0, p0, v3
and-int/2addr v0, v5
shl-int/2addr v0, v4
aget-byte v1, p0, v2
and-int/lit8 v1, v1, 0x3c
shr-int/lit8 v1, v1, 0x2
or-int/2addr v0, v1
.line 116
.restart local v0 # "nblks":I
goto :goto_43
.line 112
.end local v0 # "nblks":I
:cond_2a
aget-byte v0, p0, v4
and-int/2addr v0, v5
shl-int/2addr v0, v4
aget-byte v1, p0, v5
and-int/lit8 v1, v1, 0x3c
shr-int/lit8 v1, v1, 0x2
or-int/2addr v0, v1
.line 113
.restart local v0 # "nblks":I
goto :goto_43
.line 109
.end local v0 # "nblks":I
:cond_36
aget-byte v0, p0, v3
and-int/lit8 v0, v0, 0x1
shl-int/2addr v0, v2
aget-byte v1, p0, v4
and-int/lit16 v1, v1, 0xfc
shr-int/lit8 v1, v1, 0x2
or-int/2addr v0, v1
.line 110
.restart local v0 # "nblks":I
nop
.line 121
:goto_43
add-int/lit8 v1, v0, 0x1
mul-int/lit8 v1, v1, 0x20
return v1
.end method
.method public static parseDtsFormat([BLjava/lang/String;Ljava/lang/String;Lcom/google/android/exoplayer2/drm/DrmInitData;)Lcom/google/android/exoplayer2/Format;
.registers 21
.param p0, "frame" # [B
.param p1, "trackId" # Ljava/lang/String;
.param p2, "language" # Ljava/lang/String;
.param p3, "drmInitData" # Lcom/google/android/exoplayer2/drm/DrmInitData;
.line 84
invoke-static/range {p0 .. p0}, Lcom/google/android/exoplayer2/audio/DtsUtil;->getNormalizedFrameHeader([B)Lcom/google/android/exoplayer2/util/ParsableBitArray;
move-result-object v0
.line 85
.local v0, "frameBits":Lcom/google/android/exoplayer2/util/ParsableBitArray;
const/16 v1, 0x3c
invoke-virtual {v0, v1}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->skipBits(I)V
.line 86
const/4 v1, 0x6
invoke-virtual {v0, v1}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->readBits(I)I
move-result v1
.line 87
.local v1, "amode":I
sget-object v2, Lcom/google/android/exoplayer2/audio/DtsUtil;->CHANNELS_BY_AMODE:[I
aget v2, v2, v1
.line 88
.local v2, "channelCount":I
const/4 v3, 0x4
invoke-virtual {v0, v3}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->readBits(I)I
move-result v3
.line 89
.local v3, "sfreq":I
sget-object v4, Lcom/google/android/exoplayer2/audio/DtsUtil;->SAMPLE_RATE_BY_SFREQ:[I
aget v4, v4, v3
.line 90
.local v4, "sampleRate":I
const/4 v5, 0x5
invoke-virtual {v0, v5}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->readBits(I)I
move-result v15
.line 91
.local v15, "rate":I
sget-object v5, Lcom/google/android/exoplayer2/audio/DtsUtil;->TWICE_BITRATE_KBPS_BY_RATE:[I
array-length v6, v5
const/4 v7, 0x2
if-lt v15, v6, :cond_29
const/4 v5, -0x1
const/4 v8, -0x1
goto :goto_2f
:cond_29
aget v5, v5, v15
mul-int/lit16 v5, v5, 0x3e8
div-int/2addr v5, v7
move v8, v5
.line 93
.local v8, "bitrate":I
:goto_2f
const/16 v5, 0xa
invoke-virtual {v0, v5}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->skipBits(I)V
.line 94
invoke-virtual {v0, v7}, Lcom/google/android/exoplayer2/util/ParsableBitArray;->readBits(I)I
move-result v5
if-lez v5, :cond_3c
const/4 v5, 0x1
goto :goto_3d
:cond_3c
const/4 v5, 0x0
:goto_3d
add-int/2addr v2, v5
.line 95
const/4 v7, 0x0
const/4 v9, -0x1
const/4 v12, 0x0
const/4 v14, 0x0
const-string v6, "audio/vnd.dts"
move-object/from16 v5, p1
move v10, v2
move v11, v4
move-object/from16 v13, p3
move/from16 v16, v15
.end local v15 # "rate":I
.local v16, "rate":I
move-object/from16 v15, p2
invoke-static/range {v5 .. v15}, Lcom/google/android/exoplayer2/Format;->createAudioSampleFormat(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIIILjava/util/List;Lcom/google/android/exoplayer2/drm/DrmInitData;ILjava/lang/String;)Lcom/google/android/exoplayer2/Format;
move-result-object v5
return-object v5
.end method