static void write_quant_table(RangeCoder *c, int16_t *quant_table){
    int last=0;
    int i;
    uint8_t state[CONTEXT_SIZE];
    memset(state, 128, sizeof(state));
    for(i=1; i<128 ; i++){
        if(quant_table[i] != quant_table[i-1]){
            put_symbol(c, state, i-last-1, 0);
            last= i;
        }
    }
    put_symbol(c, state, i-last-1, 0);
}
['static void write_header(FFV1Context *f){\n    uint8_t state[CONTEXT_SIZE];\n    int i;\n    RangeCoder * const c= &f->c;\n    memset(state, 128, sizeof(state));\n    put_symbol(c, state, f->version, 0);\n    put_symbol(c, state, f->avctx->coder_type, 0);\n    put_symbol(c, state, f->colorspace, 0);\n    put_rac(c, state, 1);\n        put_symbol(c, state, f->chroma_h_shift, 0);\n        put_symbol(c, state, f->chroma_v_shift, 0);\n    put_rac(c, state, 0);\n    for(i=0; i<5; i++)\n        write_quant_table(c, f->quant_table[i]);\n}', 'static void write_quant_table(RangeCoder *c, int16_t *quant_table){\n    int last=0;\n    int i;\n    uint8_t state[CONTEXT_SIZE];\n    memset(state, 128, sizeof(state));\n    for(i=1; i<128 ; i++){\n        if(quant_table[i] != quant_table[i-1]){\n            put_symbol(c, state, i-last-1, 0);\n            last= i;\n        }\n    }\n    put_symbol(c, state, i-last-1, 0);\n}']