package com.applovin.impl; /* loaded from: classes.dex */ final class jg { public int a; public int b; public long c; public long d; public long e; public long f; public int g; public int h; public int i; public final int[] j = new int[255]; private final bh k = new bh(255); public void a() { this.a = 0; this.b = 0; this.c = 0L; this.d = 0L; this.e = 0L; this.f = 0L; this.g = 0; this.h = 0; this.i = 0; } public boolean a(l8 l8Var, boolean z) { a(); this.k.d(27); if (!n8.a(l8Var, this.k.c(), 0, 27, z) || this.k.y() != 1332176723) { return false; } int w = this.k.w(); this.a = w; if (w != 0) { if (z) { return false; } throw dh.a("unsupported bit stream revision"); } this.b = this.k.w(); this.c = this.k.n(); this.d = this.k.p(); this.e = this.k.p(); this.f = this.k.p(); int w2 = this.k.w(); this.g = w2; this.h = w2 + 27; this.k.d(w2); if (!n8.a(l8Var, this.k.c(), 0, this.g, z)) { return false; } for (int i = 0; i < this.g; i++) { this.j[i] = this.k.w(); this.i += this.j[i]; } return true; } public boolean a(l8 l8Var) { return a(l8Var, -1L); } public boolean a(l8 l8Var, long j) { b1.a(l8Var.f() == l8Var.d()); this.k.d(4); while (true) { if ((j == -1 || l8Var.f() + 4 < j) && n8.a(l8Var, this.k.c(), 0, 4, true)) { this.k.f(0); if (this.k.y() == 1332176723) { l8Var.b(); return true; } l8Var.a(1); } } do { if (j != -1 && l8Var.f() >= j) { break; } } while (l8Var.b(1) != -1); return false; } }