Error Diffusion Dithering - Computerphile

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ส.ค. 2024
  • The smarter way to dither. Dr Bagley takes us through the Floyd-Steinberg error diffusion dithering technique.
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottsco...
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

ความคิดเห็น • 103

  • @sixft7in
    @sixft7in 5 ปีที่แล้ว +177

    I love how Dr. Bagley wears that shirt for the dithering videos.

    • @totlyepic
      @totlyepic 5 ปีที่แล้ว +1

      ...I think it's more likely that the two videos were just recorded on the same day.

    • @sixft7in
      @sixft7in 5 ปีที่แล้ว +6

      @@totlyepic True, but the fact that he wore that shirt for both or each is still funny.

    • @sixft7in
      @sixft7in 5 ปีที่แล้ว +4

      @Zero Cool Oh, I know. Either way it's funny to me, accidental or intentional.

  • @pseudo_goose
    @pseudo_goose 5 ปีที่แล้ว +112

    Aw man, you had to put in a teaser for audio dithering at the end. I hope that's in a video soon!

    • @azyfloof
      @azyfloof 5 ปีที่แล้ว +6

      It was probably in the audio of _this_ video :P

    • @ChristopherMeadors
      @ChristopherMeadors 5 ปีที่แล้ว +3

      I'm definitely here for the audio dithering. There's an excellent Xiph video called Digital Show and Tell, that goes into what dither does for audio. But other than providing a sample code download, it doesn't really go into the how it's implemented.

    • @kaitlyn__L
      @kaitlyn__L 5 ปีที่แล้ว

      Me too!

  • @veggiet2009
    @veggiet2009 5 ปีที่แล้ว +40

    It's interesting that I've seen these different styles of dithering, and I've recognized them as different, but I've never considered what made them different.... These videos are fascinating. I'd like more detail about how the algorithms translate to color and to higher bit depths.

    • @jursamaj
      @jursamaj 3 ปีที่แล้ว +2

      In color, you'd simply dither each of the color channels (red, green, & blue) separately. For higher bits depths, you just pick values for each pixel value. So instead of black (0) and white (255) for 1-bit, you'd have 0, 85, 170, & 255 for 2-bit. You'd use the same error diffusion after picking the nearest value.
      Technically, your values don't have to be equally spaced, and the formulae really should account for things like display gamma.

  • @TimTam69420
    @TimTam69420 5 ปีที่แล้ว +43

    I very much hope you asked how they do it for audio. its actually pretty straightforward and would make for an interesting video

  • @DreadKyller
    @DreadKyller 5 ปีที่แล้ว +13

    even with how many colors we have today on most modern devices dithering is still used even with 8-bit colors, if you have a smooth gradient there are points where it moves from being solid 80 for example down to solid 79, and while that's not really noticeable, you can still dither that change to blend the colors together to simulate even more colors in between. Because when zoomed in even 256 options per color channel can still have banding issues, dithering as it zooms in helps remove such banding artifacts.

  • @user-zz6fk8bc8u
    @user-zz6fk8bc8u 5 ปีที่แล้ว +45

    Dithering is still used in generated color images to reduce banding.

    • @silkwesir1444
      @silkwesir1444 5 ปีที่แล้ว +1

      What a great idea, why didn't I think of that. Thanks.

  • @jerrywatson1958
    @jerrywatson1958 5 ปีที่แล้ว +3

    Wow you earned a new sub today! Finally after all these years of seeing this kind of dithering in my (then) Amiga photo creation software and graphics it clicked! How the computer calculates each pixel on the screen. The math is calculated and displayed SO fast it puts me in awe of what designers have done. This helps me in what I am trying to learn to do in Blender and understand lighting.

  • @tungstikum
    @tungstikum 5 ปีที่แล้ว +121

    "Error diffusion dithering" is how I walk home from the pub.

    • @haulin
      @haulin 5 ปีที่แล้ว +4

      It's also my relationship strategy. I don't return to the one I've already done.

  • @FyberOptic
    @FyberOptic 5 ปีที่แล้ว +1

    These videos were so interesting that after the last one I started playing with implementing a color dithering script, just to experiment with it. Dithering is always something I took for granted in programs like Paint Shop Pro over the last few decades, but never really considered how it worked.

  • @mrsvcd
    @mrsvcd 5 ปีที่แล้ว +2

    Thank you for explaining Floyd-Steinberg dithering and now I can understand the notation for it as well.

  • @lazycrypt6893
    @lazycrypt6893 5 ปีที่แล้ว +28

    TH-cam compression sure didn't like the dithering.

  • @mspysu79
    @mspysu79 5 ปีที่แล้ว +3

    Another good video, and a teaser for what Sony used to call "Super BitMapping" using a 20 bit ADC and dithering down to 16 bit for recording on a CD.

  • @JaccovanSchaik
    @JaccovanSchaik 5 ปีที่แล้ว +19

    Wonder what dithering algorithm the shirt uses.

    • @haulin
      @haulin 5 ปีที่แล้ว +2

      Must be a crappy one. I can't work out what was the original image.

  • @roderik1990
    @roderik1990 5 ปีที่แล้ว +1

    Notes that you likely want to add some noise before going through the whole floyd-steinberg process. (of the proper PDF) To prevent noise modulation from being too noticeable.
    Error diffusion dithering like Floyd-Steinberg, is analogous to noise shaping in audio dithering.

  • @NoHandleToSpeakOf
    @NoHandleToSpeakOf 5 ปีที่แล้ว +4

    Animated GIF is limited to 256 colors and they use dithering too.

    • @superscatboy
      @superscatboy 5 ปีที่แล้ว

      If keeping the size of a gif to a minimum is a major concern, dithering is your worst enemy :P

    • @NoHandleToSpeakOf
      @NoHandleToSpeakOf 5 ปีที่แล้ว

      @@superscatboy True. Multi-meg gifs are rarely problematic these days though

  • @user-vn7ce5ig1z
    @user-vn7ce5ig1z 5 ปีที่แล้ว +18

    5:00 - That's how PWM works.

    • @stanrogers5613
      @stanrogers5613 5 ปีที่แล้ว +4

      ...or PCM (pulse code modulation), where the on/off edges are fixed, which can make some parts of the circuitry easier to manage, but the pattern of pulses is varied (basically a single-bit synchronous encoding of a number). That was how single-bit oversampling worked on many of the early "hifi" CD players, for instance, to move the quantization noise far enough out of the audio frequency range to make filtering easy using lower-order filters (which don't hurt teeth nearly as badly as "brick wall" high-order filter phase shifts).

    • @KX36
      @KX36 5 ปีที่แล้ว

      or PFM

  • @piteoswaldo
    @piteoswaldo 5 ปีที่แล้ว +3

    What's the name of the dither technique that simply sums a white noise to the original image before thresholding?

  • @misterhat5823
    @misterhat5823 5 ปีที่แล้ว +1

    Dithering down (or reducing bit width) is a different process. A random noise (or triangle wave to cheat) is added to the signal and then it's truncated. This is done instead of rounding or simple truncation.

  • @matt4193
    @matt4193 5 ปีที่แล้ว

    Nice dithered shirt, Dr. Bagley.

  • @f4614n
    @f4614n 5 ปีที่แล้ว +2

    At 4:01 it really shows that video compression was not designed to cope with dithered signals.

    • @misterhat5823
      @misterhat5823 5 ปีที่แล้ว +2

      Very true. It's adding high frequency noise and most compression methods attempt to throw out high frequency signals.

  • @10100rsn
    @10100rsn 5 ปีที่แล้ว +3

    What about half-tone algorithms where there is lpi and angle?

  • @NullPointer
    @NullPointer 5 ปีที่แล้ว +1

    It's also used today in Deferred Rendered engines to acchieve screen door transparency

  • @alexxxcanz
    @alexxxcanz 5 ปีที่แล้ว +7

    I’d like a video on Intel Management Engine. About what is it, how does it work and how to disabled it. That would be great!

  • @forthrightgambitia1032
    @forthrightgambitia1032 5 ปีที่แล้ว +9

    A video on line/circle drawing algorithms would be nice.

  • @Rocket_Try
    @Rocket_Try 3 ปีที่แล้ว

    Great, thank you so much. Got it working with your explanation on an ESP32 Cam.

  • @arsnakehert
    @arsnakehert 4 ปีที่แล้ว

    _Excellent_ choice of shirt

  • @karlkastor
    @karlkastor 5 ปีที่แล้ว +3

    Isn't 'dithering in time' just Pulse-width modulation?

    • @misterhat5823
      @misterhat5823 5 ปีที่แล้ว +3

      Never thought of that, but essentially yes.

    • @danieljensen2626
      @danieljensen2626 5 ปีที่แล้ว +1

      Sounds like it yeah, but for each pixel in an image.

  • @TheAnarchoX_
    @TheAnarchoX_ 2 ปีที่แล้ว

    We use it to dither lens molds, these lens printer heads have a resolution of a few microns and are rather fault sensitive by applying dithering to the 3d mapping we can eliminate the error of broken printer heads so that we always get a smooth result

  • @Sth0r
    @Sth0r 5 ปีที่แล้ว +2

    Hey love the stuff you guys and girls make on this channel. what happnes if you do this to the red, the green and the blue layers and rekomebine them?

    • @decece
      @decece 5 ปีที่แล้ว +3

      There's a nice example at: caca.zoy.org/study/part6.html

  • @themusicicreate
    @themusicicreate 5 ปีที่แล้ว +1

    I'd love to learn about audio dithering like he alluded to at the end!

  • @nsputnik
    @nsputnik 5 ปีที่แล้ว

    How did you create the dithering example at 4:04? I have been wanting to do this in VDMX. I can do it with still images by bringing a .jpg into Classic Mac OS Photoshop and switching to graysacale and then halftone.

  • @pattywu9301
    @pattywu9301 4 หลายเดือนก่อน

    Thanks for the video really helpful

  • @OrangeC7
    @OrangeC7 5 ปีที่แล้ว +1

    Me in the previous video: Awww what they didn't show off the dithering on that image!
    Me in this video: Oh, that's why they didn't show it off

  • @noestreet760
    @noestreet760 4 ปีที่แล้ว

    If these values are based on quadrants, why is the maximum 255, not 256?

  • @n00dle_king
    @n00dle_king 5 ปีที่แล้ว

    Such a cool algorithm. Makes me miss school.

  • @JamesBrown-oz5bl
    @JamesBrown-oz5bl 5 ปีที่แล้ว +4

    of course you'd first multiply and only then divide and you'd want gamma correction in your error values...

  • @renemunkthalund3581
    @renemunkthalund3581 5 ปีที่แล้ว

    I would like to have seen dithering in time exemplified on Dr. Bagley. I know it would take some coding, since it's not readily available like Floyd-Steinberg.

  • @roar779
    @roar779 5 ปีที่แล้ว

    Can someone please tell me what the last sentence was after the big pause? at 5:52

  • @NVRMTmotion
    @NVRMTmotion 5 ปีที่แล้ว +1

    Just wrote a python program for cropping and printing photos on thermal printers, dithering required, still relevant and fascinating!

  • @juschu85
    @juschu85 5 ปีที่แล้ว

    The export dialog in my music software also gives me a dithering option. So this is probably also dithering over time since you can only hear a single sample at a time.
    So in that case, the error is just carried over to the next sample, right?

    • @groszak1
      @groszak1 5 ปีที่แล้ว +1

      nope, that leads to high frequencies, in audio dithering they randomize whether to round up or down so that the error is uniformly a noise

  • @raydleemsc
    @raydleemsc 5 ปีที่แล้ว +1

    So is Floyd-Steinberg used in audio dithering?

    • @misterhat5823
      @misterhat5823 5 ปีที่แล้ว +1

      No.

    • @groszak1
      @groszak1 5 ปีที่แล้ว

      humans perceive audio differently than images so Floyd-Steinberg isn't the best choice for audio dithering, randomizing whether to round up or down gives better results for audio

  • @simonmultiverse6349
    @simonmultiverse6349 2 ปีที่แล้ว

    Was your shirt created by a dithering algorithm?

  • @dreammfyre
    @dreammfyre 5 ปีที่แล้ว +1

    Double surnames always makes me think of some dystopian mega-corporation. Maas-Chen Holdings etc.

  • @solemnwaltz
    @solemnwaltz 5 ปีที่แล้ว

    Nice! Your shirt matches your topic. :D

  • @BlankBrain
    @BlankBrain 5 ปีที่แล้ว

    5:52 Please discuss dithering in audio.

  • @WacKEDmaN
    @WacKEDmaN 5 ปีที่แล้ว

    i wanna know about audio dithering!

  • @3dlabs99
    @3dlabs99 5 ปีที่แล้ว

    That shirt is perfect for the video :)

  • @sogerc1
    @sogerc1 5 ปีที่แล้ว +2

    I remember so-so many years ago, when color was a problem for videocards I used to love dithering. Except when looking at pictures of naked chicks ;-)

  • @victorx4648
    @victorx4648 5 ปีที่แล้ว

    A funny thing - just yesterday I was wondering how those dithering algorithms are working. :)

  • @someone-br9ur
    @someone-br9ur 5 ปีที่แล้ว +1

    notch's tweet

  • @KuraIthys
    @KuraIthys 5 ปีที่แล้ว +1

    Floyd-Steinberg is a better method on paper, but personally I've always found it to be one of the uglier methods to perform dithering.
    Guess there's always compromises with stuff like this...

  • @AlphaFoxDelta
    @AlphaFoxDelta 5 ปีที่แล้ว

    Always a pleasure, even if this isnt not my error of expertise, heh

  • @KOrbyPoulpe
    @KOrbyPoulpe 5 ปีที่แล้ว +1

    Recently, Dithering have also been heavily used in the game "Return of the Obra Dinn" released in october 2018

    • @cacheman
      @cacheman 5 ปีที่แล้ว

      Lucas Pope (the author) did some additional work to make the dithering more stable under movment. He wrote about the technical details in a post on tigsource, which can be easily found through google by searching for something like "lucas pope dithering" #bayermatrix #bluenoise

  • @TheRumpletiltskin
    @TheRumpletiltskin 5 ปีที่แล้ว

    PLS DO AUDIO DITHERING!

  • @rev_lunar
    @rev_lunar 5 ปีที่แล้ว

    Dithering in time seems like it would be the best solution for static images as it wouldn't compromise image quality, but would require more resources.

    • @misterhat5823
      @misterhat5823 5 ปีที่แล้ว +1

      There's a limited frame rate most display devices can use, so the benefits are less than you might expect.

  • @danfg7215
    @danfg7215 5 ปีที่แล้ว +1

    black then white then black then white then black then white then black then white then black then white then black then white then black then white then black then white then black then white then...

  • @hillwin10
    @hillwin10 5 ปีที่แล้ว +2

    Oh -- we are getting "fancy."
    Lol.

  • @preferredimage
    @preferredimage 5 ปีที่แล้ว +1

    Cool minecraft shirt bro! ;)

  • @michaelcharlesthearchangel
    @michaelcharlesthearchangel 5 ปีที่แล้ว +1

    Hm. The moment a voxel-deep hologram shade appears and then fills in. I see some kind of holodithering occurring until less than 2 percent error is maintained.
    Quantum computers/hyperservers will help us speed up the resolution-- error correction of a quantumFlashplayer playing a holovideo.

  • @cipherxen2
    @cipherxen2 3 ปีที่แล้ว

    His shirt can be dithered

  • @hrnekbezucha
    @hrnekbezucha 5 ปีที่แล้ว

    Printers are black and white. A colour printer is four printers in one package, each doing one colour.

  • @blazbole3342
    @blazbole3342 9 หลายเดือนก่อน

    nice teeth

    • @blazbole3342
      @blazbole3342 9 หลายเดือนก่อน

      space for train

    • @blazbole3342
      @blazbole3342 9 หลายเดือนก่อน

      sry bro. ly

  • @vitalnutrients744
    @vitalnutrients744 5 ปีที่แล้ว

    130th!

  • @Eternal_23
    @Eternal_23 5 ปีที่แล้ว

    Blue noise is answer for everything

  • @fredericchopin2947
    @fredericchopin2947 5 ปีที่แล้ว

    Philip Seymour Hoffman

  • @schatjepatatje767
    @schatjepatatje767 5 ปีที่แล้ว +2

    uwu

  • @Muzkaw
    @Muzkaw 5 ปีที่แล้ว

    It's pixel level ASCII art!

  • @SeamusCampbell89
    @SeamusCampbell89 5 ปีที่แล้ว

    First

    • @misterhat5823
      @misterhat5823 5 ปีที่แล้ว +1

      First down vote.

    • @superscatboy
      @superscatboy 5 ปีที่แล้ว

      This is extremely interesting.

  • @VIVAFPV
    @VIVAFPV 5 ปีที่แล้ว

    boring