jpeg_pipeline_dest(j_compress_ptr cinfo,
                   unsigned char* outbuffer, size_t size,
                   Pipeline* next)
{
    cinfo->dest = static_cast<struct jpeg_destination_mgr *>(
        (*cinfo->mem->alloc_small)(reinterpret_cast<j_common_ptr>(cinfo),
                                   JPOOL_PERMANENT,
                                   sizeof(dct_pipeline_dest)));
    dct_pipeline_dest* dest =
        reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
    dest->pub.init_destination = init_pipeline_destination;
    dest->pub.empty_output_buffer = empty_pipeline_output_buffer;
    dest->pub.term_destination = term_pipeline_destination;
    dest->pub.next_output_byte = dest->buffer = outbuffer;
    dest->pub.free_in_buffer = dest->size = size;
    dest->next = next;
}
jpeg_pipeline_dest(j_compress_ptr cinfo,
                   unsigned char* outbuffer, size_t size,
                   Pipeline* next)
{
    cinfo->dest = static_cast<struct jpeg_destination_mgr *>(
        (*cinfo->mem->alloc_small)(reinterpret_cast<j_common_ptr>(cinfo),
                                   JPOOL_PERMANENT,
                                   sizeof(dct_pipeline_dest)));
    dct_pipeline_dest* dest =
        reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
    dest->pub.init_destination = init_pipeline_destination;
    dest->pub.empty_output_buffer = empty_pipeline_output_buffer;
    dest->pub.term_destination = term_pipeline_destination;
    dest->pub.next_output_byte = dest->buffer = outbuffer;
    dest->pub.free_in_buffer = dest->size = size;
    dest->next = next;
}