Exemplo n.º 1
0
static av_cold int decode_init(AVCodecContext *avctx)
{
    ASV1Context * const a = avctx->priv_data;
    const int scale       = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
    int i;

    ff_asv_common_init(avctx);
    init_vlcs(a);
    ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_asv_scantab);
    avctx->pix_fmt = AV_PIX_FMT_YUV420P;

    a->inv_qscale = avctx->extradata[0];
    if (a->inv_qscale == 0) {
        av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
        if (avctx->codec_id == AV_CODEC_ID_ASV1)
            a->inv_qscale = 6;
        else
            a->inv_qscale = 10;
    }

    for (i = 0; i < 64; i++) {
        int index = ff_asv_scantab[i];

        a->intra_matrix[i] = 64 * scale * ff_mpeg1_default_intra_matrix[index] / a->inv_qscale;
    }

    return 0;
}
Exemplo n.º 2
0
static av_cold int decode_init(AVCodecContext *avctx){
    ASV1Context * const a = avctx->priv_data;
    AVFrame *p= &a->picture;
    int i;
    const int scale= avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;

    ff_asv_common_init(avctx);
    init_vlcs(a);
    ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_asv_scantab);
    avctx->pix_fmt= AV_PIX_FMT_YUV420P;

    a->inv_qscale= avctx->extradata[0];
    if(a->inv_qscale == 0){
        av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
        if(avctx->codec_id == AV_CODEC_ID_ASV1)
            a->inv_qscale= 6;
        else
            a->inv_qscale= 10;
    }

    for(i=0; i<64; i++){
        int index = ff_asv_scantab[i];

        a->intra_matrix[i]= 64*scale*ff_mpeg1_default_intra_matrix[index] / a->inv_qscale;
    }

    p->qstride= a->mb_width;
    p->qscale_table= av_malloc( p->qstride * a->mb_height);
    p->quality= (32*scale + a->inv_qscale/2)/a->inv_qscale;
    memset(p->qscale_table, p->quality, p->qstride*a->mb_height);

    return 0;
}