+
+
+/*
+ * Initialize the transencoer codec.
+ * This is called only once, during master selection.
+ */
+
+LOCAL(void)
+transencode_codec (j_compress_ptr cinfo,
+ jvirt_barray_ptr * coef_arrays)
+{
+ j_lossy_c_ptr lossyc;
+
+ /* Create subobject in permanent pool */
+ lossyc = (j_lossy_c_ptr)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ SIZEOF(jpeg_lossy_c_codec));
+ cinfo->codec = (struct jpeg_c_codec *) lossyc;
+
+ /* Initialize sub-modules */
+
+ /* Entropy encoding: either Huffman or arithmetic coding. */
+ if (cinfo->arith_code) {
+ jinit_arith_encoder(cinfo);
+ } else {
+ if (cinfo->process == JPROC_PROGRESSIVE) {
+#ifdef C_PROGRESSIVE_SUPPORTED
+ jinit_phuff_encoder(cinfo);
+#else
+ ERREXIT(cinfo, JERR_NOT_COMPILED);
+#endif
+ } else
+ jinit_shuff_encoder(cinfo);
+ }
+
+ /* We need a special coefficient buffer controller. */
+ transencode_coef_controller(cinfo, coef_arrays);
+
+ /* Initialize method pointers */
+ lossyc->pub.start_pass = start_pass_coef;
+ lossyc->pub.compress_data = compress_output;
+}