You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	mpc7/8: use planar sample format
This commit is contained in:
		| @@ -43,28 +43,24 @@ void ff_mpc_init(void) | ||||
| /** | ||||
|  * Process decoded Musepack data and produce PCM | ||||
|  */ | ||||
| static void mpc_synth(MPCContext *c, int16_t *out, int channels) | ||||
| static void mpc_synth(MPCContext *c, int16_t **out, int channels) | ||||
| { | ||||
|     int dither_state = 0; | ||||
|     int i, ch; | ||||
|     OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr; | ||||
|  | ||||
|     for(ch = 0;  ch < channels; ch++){ | ||||
|         samples_ptr = samples + ch; | ||||
|         for(i = 0; i < SAMPLES_PER_BAND; i++) { | ||||
|             ff_mpa_synth_filter_fixed(&c->mpadsp, | ||||
|                                 c->synth_buf[ch], &(c->synth_buf_offset[ch]), | ||||
|                                 ff_mpa_synth_window_fixed, &dither_state, | ||||
|                                 samples_ptr, channels, | ||||
|                                 out[ch] + 32 * i, 1, | ||||
|                                 c->sb_samples[ch][i]); | ||||
|             samples_ptr += 32 * channels; | ||||
|         } | ||||
|     } | ||||
|     for(i = 0; i < MPC_FRAME_SIZE*channels; i++) | ||||
|         *out++=samples[i]; | ||||
| } | ||||
|  | ||||
| void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels) | ||||
| void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, int16_t **out, | ||||
|                                  int channels) | ||||
| { | ||||
|     int i, j, ch; | ||||
|     Band *bands = c->bands; | ||||
| @@ -100,5 +96,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int ch | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     mpc_synth(c, data, channels); | ||||
|     mpc_synth(c, out, channels); | ||||
| } | ||||
|   | ||||
| @@ -73,6 +73,6 @@ typedef struct { | ||||
| } MPCContext; | ||||
|  | ||||
| void ff_mpc_init(void); | ||||
| void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst, int channels); | ||||
| void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels); | ||||
|  | ||||
| #endif /* AVCODEC_MPC_H */ | ||||
|   | ||||
| @@ -94,7 +94,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) | ||||
|             c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); | ||||
|     c->frames_to_skip = 0; | ||||
|  | ||||
|     avctx->sample_fmt = AV_SAMPLE_FMT_S16; | ||||
|     avctx->sample_fmt = AV_SAMPLE_FMT_S16P; | ||||
|     avctx->channel_layout = AV_CH_LAYOUT_STEREO; | ||||
|  | ||||
|     if(vlc_initialized) return 0; | ||||
| @@ -293,7 +293,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, | ||||
|         for(ch = 0; ch < 2; ch++) | ||||
|             idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off); | ||||
|  | ||||
|     ff_mpc_dequantize_and_synth(c, mb, c->frame.data[0], 2); | ||||
|     ff_mpc_dequantize_and_synth(c, mb, (int16_t **)c->frame.extended_data, 2); | ||||
|  | ||||
|     bits_used = get_bits_count(&gb); | ||||
|     bits_avail = buf_size * 8; | ||||
| @@ -340,4 +340,6 @@ AVCodec ff_mpc7_decoder = { | ||||
|     .flush          = mpc7_decode_flush, | ||||
|     .capabilities   = CODEC_CAP_DR1, | ||||
|     .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV7"), | ||||
|     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, | ||||
|                                                       AV_SAMPLE_FMT_NONE }, | ||||
| }; | ||||
|   | ||||
| @@ -135,7 +135,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) | ||||
|     c->MSS = get_bits1(&gb); | ||||
|     c->frames = 1 << (get_bits(&gb, 3) * 2); | ||||
|  | ||||
|     avctx->sample_fmt = AV_SAMPLE_FMT_S16; | ||||
|     avctx->sample_fmt = AV_SAMPLE_FMT_S16P; | ||||
|     avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; | ||||
|  | ||||
|     if(vlc_initialized) return 0; | ||||
| @@ -405,7 +405,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     ff_mpc_dequantize_and_synth(c, maxband - 1, c->frame.data[0], | ||||
|     ff_mpc_dequantize_and_synth(c, maxband - 1, | ||||
|                                 (int16_t **)c->frame.extended_data, | ||||
|                                 avctx->channels); | ||||
|  | ||||
|     c->cur_frame++; | ||||
| @@ -438,4 +439,6 @@ AVCodec ff_mpc8_decoder = { | ||||
|     .flush          = mpc8_decode_flush, | ||||
|     .capabilities   = CODEC_CAP_DR1, | ||||
|     .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV8"), | ||||
|     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, | ||||
|                                                       AV_SAMPLE_FMT_NONE }, | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user