]> git.sesse.net Git - ffmpeg/blobdiff - libswresample/dither.c
Merge commit '8a62d2c28fbacd1ae20c35887a1eecba2be14371'
[ffmpeg] / libswresample / dither.c
index 08c793d4cf8cad84252208b51c849326d29fb242..64068d35b6a8611db05b64bb56eb16739335fd22 100644 (file)
@@ -102,6 +102,11 @@ av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AV
     if (out_fmt == AV_SAMPLE_FMT_S32 && s->dither.output_sample_bits)
         scale *= 1<<(32-s->dither.output_sample_bits);
 
+    if (scale == 0) {
+        s->dither.method = 0;
+        return 0;
+    }
+
     s->dither.ns_pos = 0;
     s->dither.noise_scale=   scale;
     s->dither.ns_scale   =   scale;
@@ -123,15 +128,6 @@ av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AV
         s->dither.method = SWR_DITHER_TRIANGULAR_HIGHPASS;
     }
 
-    av_assert0(!s->preout.count);
-    s->dither.noise = s->preout;
-    s->dither.temp  = s->preout;
-    if (s->dither.method > SWR_DITHER_NS) {
-        s->dither.noise.bps = 4;
-        s->dither.noise.fmt = AV_SAMPLE_FMT_FLTP;
-        s->dither.noise_scale = 1;
-    }
-
     return 0;
 }