diff mbox series

[FFmpeg-devel,1/2] swscale/output: Implement dither none for yuv2rgb_write_full()

Message ID 20210708112245.9378-1-michael@niedermayer.cc
State Accepted
Commit 75285325500672a806ba93bfc1e0ace9c9e566c1
Headers show
Series [FFmpeg-devel,1/2] swscale/output: Implement dither none for yuv2rgb_write_full() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer July 8, 2021, 11:22 a.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/output.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Michael Niedermayer July 9, 2021, 12:59 p.m. UTC | #1
On Thu, Jul 08, 2021 at 01:22:44PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libswscale/output.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libswscale/output.c b/libswscale/output.c
index e855ad606a..0a3515f3ca 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1912,6 +1912,17 @@  static av_always_inline void yuv2rgb_write_full(SwsContext *c,
         int r,g,b;
 
         switch (c->dither) {
+        case SWS_DITHER_NONE:
+            if (isrgb8) {
+                r = av_clip_uintp2(R >> 27, 3);
+                g = av_clip_uintp2(G >> 27, 3);
+                b = av_clip_uintp2(B >> 28, 2);
+            } else {
+                r = av_clip_uintp2(R >> 29, 1);
+                g = av_clip_uintp2(G >> 28, 2);
+                b = av_clip_uintp2(B >> 29, 1);
+            }
+            break;
         default:
         case SWS_DITHER_AUTO:
         case SWS_DITHER_ED: