/* Class587_Sub18_Sub2 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import jagtheora.ogg.OggPacket;
import jagtheora.ogg.OggStreamState;
import jagtheora.theora.DecoderContext;
import jagtheora.theora.Frame;
import jagtheora.theora.GranulePos;
import jagtheora.theora.SetupInfo;
import jagtheora.theora.TheoraComment;
import jagtheora.theora.TheoraInfo;

public class Class587_Sub18_Sub2 extends Class587_Sub18 {
	TheoraComment aTheoraComment10566;
	static final int anInt10567 = 1024;
	SetupInfo aSetupInfo10568 = new SetupInfo();
	boolean aBool10569;
	boolean aBool10570;
	DecoderContext aDecoderContext10571;
	GranulePos aGranulePos10572;
	Frame aFrame10573;
	double aDouble10574;
	long aLong10575;
	static final int anInt10576 = 2048;
	boolean aBool10577;
	int anInt10578;
	TheoraInfo aTheoraInfo10579 = new TheoraInfo();
	boolean aBool10580;
	int anInt10581;
	Object anObject10582;

	float method16761() {
		if (!((Class587_Sub18_Sub2) this).aBool10569 || ((Class587_Sub18_Sub2) this).aTheoraInfo10579.method7230())
			return 0.0F;
		return ((float) (((Class587_Sub18_Sub2) this).aTheoraInfo10579.fpsNumerator) / (float) (((Class587_Sub18_Sub2) this).aTheoraInfo10579.fpsDenominator));
	}

	void method16762(int i) {
		((Class587_Sub18_Sub2) this).anInt10581 = -126537859 * i;
		if (((Class587_Sub18_Sub2) this).aBool10569) {
			if (((Class587_Sub18_Sub2) this).anInt10581 * 2005926357 > ((Class587_Sub18_Sub2) this).anInt10578 * 685935511)
				((Class587_Sub18_Sub2) this).anInt10581 = -1572740677 * ((Class587_Sub18_Sub2) this).anInt10578;
			if (((Class587_Sub18_Sub2) this).anInt10581 * 2005926357 < 0)
				((Class587_Sub18_Sub2) this).anInt10581 = 0;
			((Class587_Sub18_Sub2) this).aDecoderContext10571.setPostProcessingLevel(2005926357 * ((Class587_Sub18_Sub2) this).anInt10581);
		}
	}

	void method16763(int i, byte i_0_) {
		((Class587_Sub18_Sub2) this).anInt10581 = -126537859 * i;
		if (((Class587_Sub18_Sub2) this).aBool10569) {
			if (((Class587_Sub18_Sub2) this).anInt10581 * 2005926357 > ((Class587_Sub18_Sub2) this).anInt10578 * 685935511)
				((Class587_Sub18_Sub2) this).anInt10581 = -1572740677 * ((Class587_Sub18_Sub2) this).anInt10578;
			if (((Class587_Sub18_Sub2) this).anInt10581 * 2005926357 < 0)
				((Class587_Sub18_Sub2) this).anInt10581 = 0;
			((Class587_Sub18_Sub2) this).aDecoderContext10571.setPostProcessingLevel(2005926357 * ((Class587_Sub18_Sub2) this).anInt10581);
		}
	}

	float method16764(int i) {
		if (!((Class587_Sub18_Sub2) this).aBool10569 || ((Class587_Sub18_Sub2) this).aTheoraInfo10579.method7230())
			return 0.0F;
		return ((float) (((Class587_Sub18_Sub2) this).aTheoraInfo10579.fpsNumerator) / (float) (((Class587_Sub18_Sub2) this).aTheoraInfo10579.fpsDenominator));
	}

	void method15784(int i) {
		if (null != ((Class587_Sub18_Sub2) this).aFrame10573)
			((Class587_Sub18_Sub2) this).aFrame10573.method7231();
		if (((Class587_Sub18_Sub2) this).aDecoderContext10571 != null) {
			((Class587_Sub18_Sub2) this).aDecoderContext10571.method7231();
			((Class587_Sub18_Sub2) this).aDecoderContext10571 = null;
		}
		if (null != ((Class587_Sub18_Sub2) this).aGranulePos10572) {
			((Class587_Sub18_Sub2) this).aGranulePos10572.method7231();
			((Class587_Sub18_Sub2) this).aGranulePos10572 = null;
		}
		((Class587_Sub18_Sub2) this).aTheoraInfo10579.method7231();
		((Class587_Sub18_Sub2) this).aTheoraComment10566.method7231();
		((Class587_Sub18_Sub2) this).aSetupInfo10568.method7231();
	}

	long method16765(byte i) {
		return 2763620270695543075L * ((Class587_Sub18_Sub2) this).aLong10575;
	}

	void method15793(OggPacket oggpacket) {
		if (!((Class587_Sub18_Sub2) this).aBool10569) {
			int i = (((Class587_Sub18_Sub2) this).aSetupInfo10568.decodeHeader(((Class587_Sub18_Sub2) this).aTheoraInfo10579, ((Class587_Sub18_Sub2) this).aTheoraComment10566, oggpacket));
			if (0 == i) {
				((Class587_Sub18_Sub2) this).aBool10569 = true;
				if ((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth > 2048) || (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight) > 1024)
					throw new IllegalStateException();
				((Class587_Sub18_Sub2) this).aDecoderContext10571 = new DecoderContext((((Class587_Sub18_Sub2) this).aTheoraInfo10579), (((Class587_Sub18_Sub2) this).aSetupInfo10568));
				((Class587_Sub18_Sub2) this).aGranulePos10572 = new GranulePos();
				((Class587_Sub18_Sub2) this).aFrame10573 = new Frame((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth), (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight));
				((Class587_Sub18_Sub2) this).anInt10578 = ((Class587_Sub18_Sub2) this).aDecoderContext10571.getMaxPostProcessingLevel() * 1047569447;
				method16763((2005926357 * ((Class587_Sub18_Sub2) this).anInt10581), (byte) -31);
			} else if (i < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
		} else {
			((Class587_Sub18_Sub2) this).aLong10575 = Class121.method2891(46655984) * -6982567806345591157L;
			int i = (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodePacketIn(oggpacket, ((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (i < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
			((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleFrame(((Class587_Sub18_Sub2) this).aGranulePos10572);
			((Class587_Sub18_Sub2) this).aDouble10574 = (((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleTime(((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (((Class587_Sub18_Sub2) this).aBool10570) {
				boolean bool = oggpacket.isKeyFrame() == 1;
				if (bool)
					((Class587_Sub18_Sub2) this).aBool10570 = false;
				else
					return;
			}
			if (!((Class587_Sub18_Sub2) this).aBool10577 || oggpacket.isKeyFrame() == 1) {
				if (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodeFrame(((Class587_Sub18_Sub2) this).aFrame10573) != 0)
					throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
				((Class587_Sub18_Sub2) this).aBool10580 = true;
			}
		}
	}

	void method15783(OggPacket oggpacket, byte i) {
		if (!((Class587_Sub18_Sub2) this).aBool10569) {
			int i_1_ = (((Class587_Sub18_Sub2) this).aSetupInfo10568.decodeHeader(((Class587_Sub18_Sub2) this).aTheoraInfo10579, ((Class587_Sub18_Sub2) this).aTheoraComment10566, oggpacket));
			if (0 == i_1_) {
				((Class587_Sub18_Sub2) this).aBool10569 = true;
				if ((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth > 2048) || (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight) > 1024)
					throw new IllegalStateException();
				((Class587_Sub18_Sub2) this).aDecoderContext10571 = new DecoderContext((((Class587_Sub18_Sub2) this).aTheoraInfo10579), (((Class587_Sub18_Sub2) this).aSetupInfo10568));
				((Class587_Sub18_Sub2) this).aGranulePos10572 = new GranulePos();
				((Class587_Sub18_Sub2) this).aFrame10573 = new Frame((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth), (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight));
				((Class587_Sub18_Sub2) this).anInt10578 = ((Class587_Sub18_Sub2) this).aDecoderContext10571.getMaxPostProcessingLevel() * 1047569447;
				method16763((2005926357 * ((Class587_Sub18_Sub2) this).anInt10581), (byte) -108);
			} else if (i_1_ < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i_1_).toString());
		} else {
			((Class587_Sub18_Sub2) this).aLong10575 = Class121.method2891(-44009704) * -6982567806345591157L;
			int i_2_ = (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodePacketIn(oggpacket, ((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (i_2_ < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i_2_).toString());
			((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleFrame(((Class587_Sub18_Sub2) this).aGranulePos10572);
			((Class587_Sub18_Sub2) this).aDouble10574 = (((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleTime(((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (((Class587_Sub18_Sub2) this).aBool10570) {
				boolean bool = oggpacket.isKeyFrame() == 1;
				if (bool)
					((Class587_Sub18_Sub2) this).aBool10570 = false;
				else
					return;
			}
			if (!((Class587_Sub18_Sub2) this).aBool10577 || oggpacket.isKeyFrame() == 1) {
				if (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodeFrame(((Class587_Sub18_Sub2) this).aFrame10573) != 0)
					throw new IllegalStateException(new StringBuilder().append("").append(i_2_).toString());
				((Class587_Sub18_Sub2) this).aBool10580 = true;
			}
		}
	}

	public Object method16766(Interface59 interface59, int i) {
		if (((Class587_Sub18_Sub2) this).aFrame10573 == null)
			return null;
		if (!((Class587_Sub18_Sub2) this).aBool10580 && null != ((Class587_Sub18_Sub2) this).anObject10582)
			return ((Class587_Sub18_Sub2) this).anObject10582;
		((Class587_Sub18_Sub2) this).anObject10582 = interface59.method426((((Class587_Sub18_Sub2) this).aFrame10573.pixels), 0, -1649031281 * (((Class587_Sub18_Sub2) this).aFrame10573.anInt10221), (((Class587_Sub18_Sub2) this).aFrame10573.anInt10221) * -1649031281, -1868200129 * (((Class587_Sub18_Sub2) this).aFrame10573.anInt10222), false, -1495304036);
		((Class587_Sub18_Sub2) this).aBool10580 = false;
		return ((Class587_Sub18_Sub2) this).anObject10582;
	}

	void method15788() {
		if (null != ((Class587_Sub18_Sub2) this).aFrame10573)
			((Class587_Sub18_Sub2) this).aFrame10573.method7231();
		if (((Class587_Sub18_Sub2) this).aDecoderContext10571 != null) {
			((Class587_Sub18_Sub2) this).aDecoderContext10571.method7231();
			((Class587_Sub18_Sub2) this).aDecoderContext10571 = null;
		}
		if (null != ((Class587_Sub18_Sub2) this).aGranulePos10572) {
			((Class587_Sub18_Sub2) this).aGranulePos10572.method7231();
			((Class587_Sub18_Sub2) this).aGranulePos10572 = null;
		}
		((Class587_Sub18_Sub2) this).aTheoraInfo10579.method7231();
		((Class587_Sub18_Sub2) this).aTheoraComment10566.method7231();
		((Class587_Sub18_Sub2) this).aSetupInfo10568.method7231();
	}

	void method15789() {
		if (null != ((Class587_Sub18_Sub2) this).aFrame10573)
			((Class587_Sub18_Sub2) this).aFrame10573.method7231();
		if (((Class587_Sub18_Sub2) this).aDecoderContext10571 != null) {
			((Class587_Sub18_Sub2) this).aDecoderContext10571.method7231();
			((Class587_Sub18_Sub2) this).aDecoderContext10571 = null;
		}
		if (null != ((Class587_Sub18_Sub2) this).aGranulePos10572) {
			((Class587_Sub18_Sub2) this).aGranulePos10572.method7231();
			((Class587_Sub18_Sub2) this).aGranulePos10572 = null;
		}
		((Class587_Sub18_Sub2) this).aTheoraInfo10579.method7231();
		((Class587_Sub18_Sub2) this).aTheoraComment10566.method7231();
		((Class587_Sub18_Sub2) this).aSetupInfo10568.method7231();
	}

	void method15790() {
		if (null != ((Class587_Sub18_Sub2) this).aFrame10573)
			((Class587_Sub18_Sub2) this).aFrame10573.method7231();
		if (((Class587_Sub18_Sub2) this).aDecoderContext10571 != null) {
			((Class587_Sub18_Sub2) this).aDecoderContext10571.method7231();
			((Class587_Sub18_Sub2) this).aDecoderContext10571 = null;
		}
		if (null != ((Class587_Sub18_Sub2) this).aGranulePos10572) {
			((Class587_Sub18_Sub2) this).aGranulePos10572.method7231();
			((Class587_Sub18_Sub2) this).aGranulePos10572 = null;
		}
		((Class587_Sub18_Sub2) this).aTheoraInfo10579.method7231();
		((Class587_Sub18_Sub2) this).aTheoraComment10566.method7231();
		((Class587_Sub18_Sub2) this).aSetupInfo10568.method7231();
	}

	Class587_Sub18_Sub2(OggStreamState oggstreamstate) {
		super(oggstreamstate);
		((Class587_Sub18_Sub2) this).aTheoraComment10566 = new TheoraComment();
	}

	void method15782(OggPacket oggpacket) {
		if (!((Class587_Sub18_Sub2) this).aBool10569) {
			int i = (((Class587_Sub18_Sub2) this).aSetupInfo10568.decodeHeader(((Class587_Sub18_Sub2) this).aTheoraInfo10579, ((Class587_Sub18_Sub2) this).aTheoraComment10566, oggpacket));
			if (0 == i) {
				((Class587_Sub18_Sub2) this).aBool10569 = true;
				if ((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth > 2048) || (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight) > 1024)
					throw new IllegalStateException();
				((Class587_Sub18_Sub2) this).aDecoderContext10571 = new DecoderContext((((Class587_Sub18_Sub2) this).aTheoraInfo10579), (((Class587_Sub18_Sub2) this).aSetupInfo10568));
				((Class587_Sub18_Sub2) this).aGranulePos10572 = new GranulePos();
				((Class587_Sub18_Sub2) this).aFrame10573 = new Frame((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth), (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight));
				((Class587_Sub18_Sub2) this).anInt10578 = ((Class587_Sub18_Sub2) this).aDecoderContext10571.getMaxPostProcessingLevel() * 1047569447;
				method16763((2005926357 * ((Class587_Sub18_Sub2) this).anInt10581), (byte) -71);
			} else if (i < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
		} else {
			((Class587_Sub18_Sub2) this).aLong10575 = Class121.method2891(537685341) * -6982567806345591157L;
			int i = (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodePacketIn(oggpacket, ((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (i < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
			((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleFrame(((Class587_Sub18_Sub2) this).aGranulePos10572);
			((Class587_Sub18_Sub2) this).aDouble10574 = (((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleTime(((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (((Class587_Sub18_Sub2) this).aBool10570) {
				boolean bool = oggpacket.isKeyFrame() == 1;
				if (bool)
					((Class587_Sub18_Sub2) this).aBool10570 = false;
				else
					return;
			}
			if (!((Class587_Sub18_Sub2) this).aBool10577 || oggpacket.isKeyFrame() == 1) {
				if (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodeFrame(((Class587_Sub18_Sub2) this).aFrame10573) != 0)
					throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
				((Class587_Sub18_Sub2) this).aBool10580 = true;
			}
		}
	}

	double method16767(byte i) {
		return ((Class587_Sub18_Sub2) this).aDouble10574;
	}

	long method16768() {
		return 2763620270695543075L * ((Class587_Sub18_Sub2) this).aLong10575;
	}

	void method16769(int i) {
		((Class587_Sub18_Sub2) this).anInt10581 = -126537859 * i;
		if (((Class587_Sub18_Sub2) this).aBool10569) {
			if (((Class587_Sub18_Sub2) this).anInt10581 * 2005926357 > ((Class587_Sub18_Sub2) this).anInt10578 * 685935511)
				((Class587_Sub18_Sub2) this).anInt10581 = -1572740677 * ((Class587_Sub18_Sub2) this).anInt10578;
			if (((Class587_Sub18_Sub2) this).anInt10581 * 2005926357 < 0)
				((Class587_Sub18_Sub2) this).anInt10581 = 0;
			((Class587_Sub18_Sub2) this).aDecoderContext10571.setPostProcessingLevel(2005926357 * ((Class587_Sub18_Sub2) this).anInt10581);
		}
	}

	boolean method16770(byte i) {
		return ((Class587_Sub18_Sub2) this).aBool10569;
	}

	double method16771() {
		return ((Class587_Sub18_Sub2) this).aDouble10574;
	}

	void method15791(OggPacket oggpacket) {
		if (!((Class587_Sub18_Sub2) this).aBool10569) {
			int i = (((Class587_Sub18_Sub2) this).aSetupInfo10568.decodeHeader(((Class587_Sub18_Sub2) this).aTheoraInfo10579, ((Class587_Sub18_Sub2) this).aTheoraComment10566, oggpacket));
			if (0 == i) {
				((Class587_Sub18_Sub2) this).aBool10569 = true;
				if ((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth > 2048) || (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight) > 1024)
					throw new IllegalStateException();
				((Class587_Sub18_Sub2) this).aDecoderContext10571 = new DecoderContext((((Class587_Sub18_Sub2) this).aTheoraInfo10579), (((Class587_Sub18_Sub2) this).aSetupInfo10568));
				((Class587_Sub18_Sub2) this).aGranulePos10572 = new GranulePos();
				((Class587_Sub18_Sub2) this).aFrame10573 = new Frame((((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameWidth), (((Class587_Sub18_Sub2) this).aTheoraInfo10579.frameHeight));
				((Class587_Sub18_Sub2) this).anInt10578 = ((Class587_Sub18_Sub2) this).aDecoderContext10571.getMaxPostProcessingLevel() * 1047569447;
				method16763((2005926357 * ((Class587_Sub18_Sub2) this).anInt10581), (byte) -96);
			} else if (i < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
		} else {
			((Class587_Sub18_Sub2) this).aLong10575 = Class121.method2891(-711799820) * -6982567806345591157L;
			int i = (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodePacketIn(oggpacket, ((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (i < 0)
				throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
			((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleFrame(((Class587_Sub18_Sub2) this).aGranulePos10572);
			((Class587_Sub18_Sub2) this).aDouble10574 = (((Class587_Sub18_Sub2) this).aDecoderContext10571.granuleTime(((Class587_Sub18_Sub2) this).aGranulePos10572));
			if (((Class587_Sub18_Sub2) this).aBool10570) {
				boolean bool = oggpacket.isKeyFrame() == 1;
				if (bool)
					((Class587_Sub18_Sub2) this).aBool10570 = false;
				else
					return;
			}
			if (!((Class587_Sub18_Sub2) this).aBool10577 || oggpacket.isKeyFrame() == 1) {
				if (((Class587_Sub18_Sub2) this).aDecoderContext10571.decodeFrame(((Class587_Sub18_Sub2) this).aFrame10573) != 0)
					throw new IllegalStateException(new StringBuilder().append("").append(i).toString());
				((Class587_Sub18_Sub2) this).aBool10580 = true;
			}
		}
	}

	boolean method16772() {
		return ((Class587_Sub18_Sub2) this).aBool10569;
	}

	boolean method16773() {
		return ((Class587_Sub18_Sub2) this).aBool10569;
	}

	boolean method16774() {
		return ((Class587_Sub18_Sub2) this).aBool10569;
	}

	public Object method16775(Interface59 interface59) {
		if (((Class587_Sub18_Sub2) this).aFrame10573 == null)
			return null;
		if (!((Class587_Sub18_Sub2) this).aBool10580 && null != ((Class587_Sub18_Sub2) this).anObject10582)
			return ((Class587_Sub18_Sub2) this).anObject10582;
		((Class587_Sub18_Sub2) this).anObject10582 = interface59.method426((((Class587_Sub18_Sub2) this).aFrame10573.pixels), 0, -1649031281 * (((Class587_Sub18_Sub2) this).aFrame10573.anInt10221), (((Class587_Sub18_Sub2) this).aFrame10573.anInt10221) * -1649031281, -1868200129 * (((Class587_Sub18_Sub2) this).aFrame10573.anInt10222), false, -1299458178);
		((Class587_Sub18_Sub2) this).aBool10580 = false;
		return ((Class587_Sub18_Sub2) this).anObject10582;
	}

	public Object method16776(Interface59 interface59) {
		if (((Class587_Sub18_Sub2) this).aFrame10573 == null)
			return null;
		if (!((Class587_Sub18_Sub2) this).aBool10580 && null != ((Class587_Sub18_Sub2) this).anObject10582)
			return ((Class587_Sub18_Sub2) this).anObject10582;
		((Class587_Sub18_Sub2) this).anObject10582 = interface59.method426((((Class587_Sub18_Sub2) this).aFrame10573.pixels), 0, -1649031281 * (((Class587_Sub18_Sub2) this).aFrame10573.anInt10221), (((Class587_Sub18_Sub2) this).aFrame10573.anInt10221) * -1649031281, -1868200129 * (((Class587_Sub18_Sub2) this).aFrame10573.anInt10222), false, -1813576938);
		((Class587_Sub18_Sub2) this).aBool10580 = false;
		return ((Class587_Sub18_Sub2) this).anObject10582;
	}
}
