提交 b1ef4dc4 编写于 作者: M Michael Niedermayer

swr: add triangular dither support

Signed-off-by: NMichael Niedermayer <michaelni@gmx.at>
上级 0cff3e13
......@@ -40,6 +40,11 @@ void swri_get_dither(void *dst, int len, unsigned seed, enum AVSampleFormat out_
switch(method){
case SWR_DITHER_RECTANGULAR: v= ((double)seed) / UINT_MAX - 0.5; break;
case SWR_DITHER_TRIANGULAR :
v = ((double)seed) / UINT_MAX;
seed = seed*1664525 + 1013904223;
v-= ((double)seed) / UINT_MAX;
break;
default: av_assert0(0);
}
......
......@@ -55,6 +55,7 @@ static const AVOption options[]={
{"res", "force resampling", 0, AV_OPT_TYPE_CONST, {.dbl=SWR_FLAG_RESAMPLE}, INT_MIN, INT_MAX, 0, "flags"},
{"dither", "dither method" , OFFSET(dither_method), AV_OPT_TYPE_INT, {.dbl=0}, 0, SWR_DITHER_NB-1, 0, "dither_method"},
{"rectangular", "rectangular dither", 0, AV_OPT_TYPE_CONST, {.dbl=SWR_DITHER_RECTANGULAR}, INT_MIN, INT_MAX, 0, "dither_method"},
{"triangular" , "triangular dither" , 0, AV_OPT_TYPE_CONST, {.dbl=SWR_DITHER_TRIANGULAR }, INT_MIN, INT_MAX, 0, "dither_method"},
{0}
};
......
......@@ -48,6 +48,7 @@
enum SwrDitherType {
SWR_DITHER_NONE = 0,
SWR_DITHER_RECTANGULAR,
SWR_DITHER_TRIANGULAR,
SWR_DITHER_NB, ///< not part of API/ABI
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册