/* initialize an RTJpegContext, may be called multiple times  */
void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp, int width, int height, const uint32_t *lquant, const uint32_t *cquant)
/* initialize an RTJpegContext, may be called multiple times  */
void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp, int width, int height, const uint32_t *lquant, const uint32_t *cquant)
{
    int i;
    c->dsp = dsp;
    for (i = 0; i < 64; i++) {
        int z = ff_zigzag_direct[i];
        int p = c->dsp->idct_permutation[i];
        z = ((z << 3) | (z >> 3)) & 63;
        c->scan[i] = c->dsp->idct_permutation[z];
        c->lquant[p] = lquant[i];
        c->cquant[p] = cquant[i];
    }
    c->w = width;
    c->h = height;
}