diff options
Diffstat (limited to 'libavcodec/fmtconvert.c')
-rw-r--r-- | libavcodec/fmtconvert.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c index e27c1f6..0e8aa5e 100644 --- a/libavcodec/fmtconvert.c +++ b/libavcodec/fmtconvert.c @@ -66,3 +66,34 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx); if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx); } + +/* ffdshow custom code */ +void float_interleave(float *dst, const float **src, long len, int channels) +{ + int i,j,c; + if(channels==2){ + for(i=0; i<len; i++){ + dst[2*i] = src[0][i] / 32768.0f; + dst[2*i+1] = src[1][i] / 32768.0f; + } + }else{ + for(c=0; c<channels; c++) + for(i=0, j=c; i<len; i++, j+=channels) + dst[j] = src[c][i] / 32768.0f; + } +} + +void float_interleave_noscale(float *dst, const float **src, long len, int channels) +{ + int i,j,c; + if(channels==2){ + for(i=0; i<len; i++){ + dst[2*i] = src[0][i]; + dst[2*i+1] = src[1][i]; + } + }else{ + for(c=0; c<channels; c++) + for(i=0, j=c; i<len; i++, j+=channels) + dst[j] = src[c][i]; + } +} |