on2avc: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
		
							parent
							
								
									8777ea2b01
								
							
						
					
					
						commit
						045d6b9abf
					
				@ -691,7 +691,7 @@ static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int of
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int ch, i;
 | 
					    int ch, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (ch = 0; ch < c->avctx->channels; ch++) {
 | 
					    for (ch = 0; ch < c->avctx->ch_layout.nb_channels; ch++) {
 | 
				
			||||||
        float *out   = (float*)dst->extended_data[ch] + offset;
 | 
					        float *out   = (float*)dst->extended_data[ch] + offset;
 | 
				
			||||||
        float *in    = c->coeffs[ch];
 | 
					        float *in    = c->coeffs[ch];
 | 
				
			||||||
        float *saved = c->delay[ch];
 | 
					        float *saved = c->delay[ch];
 | 
				
			||||||
@ -823,13 +823,13 @@ static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf,
 | 
				
			|||||||
        c->grouping[i] = !get_bits1(&gb);
 | 
					        c->grouping[i] = !get_bits1(&gb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    on2avc_read_ms_info(c, &gb);
 | 
					    on2avc_read_ms_info(c, &gb);
 | 
				
			||||||
    for (i = 0; i < c->avctx->channels; i++)
 | 
					    for (i = 0; i < c->avctx->ch_layout.nb_channels; i++)
 | 
				
			||||||
        if ((ret = on2avc_read_channel_data(c, &gb, i)) < 0)
 | 
					        if ((ret = on2avc_read_channel_data(c, &gb, i)) < 0)
 | 
				
			||||||
            return AVERROR_INVALIDDATA;
 | 
					            return AVERROR_INVALIDDATA;
 | 
				
			||||||
    if (c->avctx->channels == 2 && c->ms_present)
 | 
					    if (c->avctx->ch_layout.nb_channels == 2 && c->ms_present)
 | 
				
			||||||
        on2avc_apply_ms(c);
 | 
					        on2avc_apply_ms(c);
 | 
				
			||||||
    if (c->window_type < WINDOW_TYPE_EXT4) {
 | 
					    if (c->window_type < WINDOW_TYPE_EXT4) {
 | 
				
			||||||
        for (i = 0; i < c->avctx->channels; i++)
 | 
					        for (i = 0; i < c->avctx->ch_layout.nb_channels; i++)
 | 
				
			||||||
            on2avc_reconstruct_channel(c, i, dst, offset);
 | 
					            on2avc_reconstruct_channel(c, i, dst, offset);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        on2avc_reconstruct_channel_ext(c, dst, offset);
 | 
					        on2avc_reconstruct_channel_ext(c, dst, offset);
 | 
				
			||||||
@ -910,21 +910,23 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
 | 
				
			|||||||
    On2AVCContext *c = avctx->priv_data;
 | 
					    On2AVCContext *c = avctx->priv_data;
 | 
				
			||||||
    const uint8_t  *lens = ff_on2avc_cb_lens;
 | 
					    const uint8_t  *lens = ff_on2avc_cb_lens;
 | 
				
			||||||
    const uint16_t *syms = ff_on2avc_cb_syms;
 | 
					    const uint16_t *syms = ff_on2avc_cb_syms;
 | 
				
			||||||
 | 
					    int channels = avctx->ch_layout.nb_channels;
 | 
				
			||||||
    int i, ret;
 | 
					    int i, ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (avctx->channels > 2U) {
 | 
					    if (channels > 2U) {
 | 
				
			||||||
        avpriv_request_sample(avctx, "Decoding more than 2 channels");
 | 
					        avpriv_request_sample(avctx, "Decoding more than 2 channels");
 | 
				
			||||||
        return AVERROR_PATCHWELCOME;
 | 
					        return AVERROR_PATCHWELCOME;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    c->avctx = avctx;
 | 
					    c->avctx = avctx;
 | 
				
			||||||
    avctx->sample_fmt     = AV_SAMPLE_FMT_FLTP;
 | 
					    avctx->sample_fmt     = AV_SAMPLE_FMT_FLTP;
 | 
				
			||||||
    avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO
 | 
					    av_channel_layout_uninit(&avctx->ch_layout);
 | 
				
			||||||
                                                   : AV_CH_LAYOUT_MONO;
 | 
					    avctx->ch_layout = (channels == 2) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO :
 | 
				
			||||||
 | 
					                                         (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    c->is_av500 = (avctx->codec_tag == 0x500);
 | 
					    c->is_av500 = (avctx->codec_tag == 0x500);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (avctx->channels == 2)
 | 
					    if (channels == 2)
 | 
				
			||||||
        av_log(avctx, AV_LOG_WARNING,
 | 
					        av_log(avctx, AV_LOG_WARNING,
 | 
				
			||||||
               "Stereo mode support is not good, patch is welcome\n");
 | 
					               "Stereo mode support is not good, patch is welcome\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -936,7 +938,7 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
 | 
				
			|||||||
    for (; i < 128; i++)
 | 
					    for (; i < 128; i++)
 | 
				
			||||||
        c->scale_tab[i] = ceil(ff_exp10(i * 0.1) * 0.5 - 0.01);
 | 
					        c->scale_tab[i] = ceil(ff_exp10(i * 0.1) * 0.5 - 0.01);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (avctx->sample_rate < 32000 || avctx->channels == 1)
 | 
					    if (avctx->sample_rate < 32000 || channels == 1)
 | 
				
			||||||
        memcpy(c->long_win, ff_on2avc_window_long_24000,
 | 
					        memcpy(c->long_win, ff_on2avc_window_long_24000,
 | 
				
			||||||
               1024 * sizeof(*c->long_win));
 | 
					               1024 * sizeof(*c->long_win));
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user