int mjpeg_init(MpegEncContext *s) { MJpegContext *m; m = malloc(sizeof(MJpegContext)); if (!m) return -1; /* build all the huffman tables */ build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, bits_dc_luminance, val_dc_luminance); build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, bits_dc_chrominance, val_dc_chrominance); build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, bits_ac_luminance, val_ac_luminance); build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, bits_ac_chrominance, val_ac_chrominance); s->mjpeg_ctx = m; return 0; }