/* Write an abbreviated table-specification datastream. This consists of SOI, DQT and DHT tables, and EOI. Any table that is defined and not marked sent_table = TRUE will be emitted. Note that all tables will be marked sent_table = TRUE at exit.  */
write_tables_only(j_compress_ptr cinfo)
/* Write an abbreviated table-specification datastream. This consists of SOI, DQT and DHT tables, and EOI. Any table that is defined and not marked sent_table = TRUE will be emitted. Note that all tables will be marked sent_table = TRUE at exit.  */
write_tables_only(j_compress_ptr cinfo)
{
    int i;
    emit_marker(cinfo, M_SOI);
    for (i = 0; i < NUM_QUANT_TBLS; i++) {
        if (cinfo->quant_tbl_ptrs[i] != NULL)
            (void)emit_dqt(cinfo, i);
    }
    if (!cinfo->arith_code) {
        for (i = 0; i < NUM_HUFF_TBLS; i++) {
            if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
                emit_dht(cinfo, i, FALSE);
            if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
                emit_dht(cinfo, i, TRUE);
        }
    }
    emit_marker(cinfo, M_EOI);
}