FileDocCategorySizeDatePackage
CAVLCWriter.javaAPI Docmp4parser 1.0-RC-173214Wed Dec 19 20:10:37 GMT 2012com.googlecode.mp4parser.h264.write

CAVLCWriter

public class CAVLCWriter extends BitstreamWriter
A class responsible for outputting exp-Golumb values into binary stream
author
Stanislav Vitvitskiy

Fields Summary
Constructors Summary
public CAVLCWriter(OutputStream out)

        super(out);
    
Methods Summary
public voidwriteBool(boolean value, java.lang.String string)

        Debug.print(string + "\t");
        write1Bit(value ? 1 : 0);
        Debug.println("\t" + value);
    
public voidwriteNBit(long value, int n, java.lang.String string)

        Debug.print(string + "\t");
        for (int i = 0; i < n; i++) {
            write1Bit((int) (value >> (n - i - 1)) & 0x1);
        }
        Debug.println("\t" + value);
    
public voidwriteSE(int value, java.lang.String string)

        Debug.print(string + "\t");
        writeUE((value << 1) * (value < 0 ? -1 : 1) + (value > 0 ? 1 : 0));
        Debug.println("\t" + value);
    
public voidwriteSliceTrailingBits()

        throw new IllegalStateException("todo");
    
public voidwriteTrailingBits()

        write1Bit(1);
        writeRemainingZero();
        flush();
    
public voidwriteU(int value, int n, java.lang.String string)

        Debug.print(string + "\t");
        writeNBit(value, n);
        Debug.println("\t" + value);
    
public voidwriteU(int i, int n)

        writeNBit(i, n);
    
public voidwriteUE(int value)

        int bits = 0;
        int cumul = 0;
        for (int i = 0; i < 15; i++) {
            if (value < cumul + (1 << i)) {
                bits = i;
                break;
            }
            cumul += (1 << i);
        }
        writeNBit(0, bits);
        write1Bit(1);
        writeNBit(value - cumul, bits);
    
public voidwriteUE(int value, java.lang.String string)

        Debug.print(string + "\t");
        writeUE(value);
        Debug.println("\t" + value);