Ticket #6063: patchdca20.diff

File patchdca20.diff, 1.5 KB (added by cehoyos, 2 years ago)
  • libavcodec/dca_xll.c

    diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
    index 1d616c2..325af29 100644
    a b static int chs_parse_header(DCAXllDecoder *s, DCAXllChSet *c, DCAExssAsset *asse 
    143143
    144144    // Storage unit width
    145145    c->storage_bit_res = get_bits(&s->gb, 5) + 1;
    146     if (c->storage_bit_res != 16 && c->storage_bit_res != 24) {
     146    if (c->storage_bit_res != 16 && c->storage_bit_res != 20 && c->storage_bit_res != 24) {
    147147        avpriv_request_sample(s->avctx, "%d-bit XLL storage resolution", c->storage_bit_res);
    148148        return AVERROR_PATCHWELCOME;
    149149    }
    int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame) 
    14161416    case 16:
    14171417        avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
    14181418        break;
     1419    case 20:
    14191420    case 24:
    14201421        avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
    14211422        break;
    int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame) 
    14451446            int16_t *plane = (int16_t *)frame->extended_data[i];
    14461447            for (k = 0; k < nsamples; k++)
    14471448                plane[k] = av_clip_int16(samples[k] * (1 << shift));
     1449        } else if (p->storage_bit_res == 20) {
     1450            int32_t *plane = (int32_t *)frame->extended_data[i];
     1451            for (k = 0; k < nsamples; k++)
     1452                plane[k] = av_clip_intp2(samples[k] * (1 << shift), 19) * (1 << 12);
    14481453        } else {
    14491454            int32_t *plane = (int32_t *)frame->extended_data[i];
    14501455            for (k = 0; k < nsamples; k++)