Hi -

        I'm sure you've all see the blocks/splotches in dim/dark scenes - it's
        especially noticeable when fades from or to black occur.

        No, I'm not hot on the trail of a new filter - but the visible blocks
        during dark and fade scenes is very annoying and I'm not sure how to
        reduce their obviousness.

        What seems like a good idea is a selective median/averaging filter
        that would be more aggressive in dark scenes and gradually taper off
        as the frames became brighter.  I'm not sure if treating regions within
        a frame would be a good thing or not - might be, but might lead to
        artifacts.

        What's a good metric for determining the "brightness" of a frame?
        Compute a histogram of the Y' values and see if there's a big cluster
        below a specified threshold (such as 32)?  For example, this is a
        histogram of Y' for a frame that's supposedly pure black (after Y=32
        it's all 0):

Y 0 0
Y 1 0
Y 2 0
Y 3 0
Y 4 0
Y 5 1
Y 6 2
Y 7 11
Y 8 14
Y 9 37
Y 10 96
Y 11 266
Y 12 734
Y 13 2223
Y 14 5806
Y 15 11904
Y 16 19854
Y 17 28770
Y 18 41353
Y 19 54259
Y 20 58347
Y 21 47760
Y 22 32121
Y 23 19341
Y 24 9487
Y 25 3593
Y 26 1285
Y 27 406
Y 28 170
Y 29 48
Y 30 16
Y 31 12
Y 32 1

        Now if that same frame is run thru the medianfilter with the default
        threshold of 2:

Y 0 0
Y 1 0
Y 2 0
Y 3 0
Y 4 0
Y 5 1
Y 6 2
Y 7 10
Y 8 8
Y 9 25
Y 10 43
Y 11 86
Y 12 104
Y 13 208
Y 14 542
Y 15 2709
Y 16 11383
Y 17 27625
Y 18 48690
Y 19 72625
Y 20 77236
Y 21 56771
Y 22 30253
Y 23 8061
Y 24 1219
Y 25 211
Y 26 67
Y 27 25
Y 28 12
Y 29 3
Y 30 1
Y 31 0
Y 32 0

        and with a threshold (-t) of 4:

Y 0 0
Y 1 0
Y 2 0
Y 3 0
Y 4 0
Y 5 1
Y 6 2
Y 7 10
Y 8 8
Y 9 25
Y 10 43
Y 11 86
Y 12 106
Y 13 220
Y 14 561
Y 15 2662
Y 16 10036
Y 17 24510
Y 18 45282
Y 19 74879
Y 20 92223
Y 21 59140
Y 22 20823
Y 23 5774
Y 24 1207
Y 25 214
Y 26 67
Y 27 25
Y 28 12
Y 29 3
Y 30 1
Y 31 0
Y 32 0

        and finally with 8:

Y 0 0
Y 1 0
Y 2 0
Y 3 0
Y 4 0
Y 5 1
Y 6 2
Y 7 10
Y 8 8
Y 9 25
Y 10 43
Y 11 84
Y 12 100
Y 13 142
Y 14 238
Y 15 573
Y 16 1691
Y 17 13763
Y 18 53222
Y 19 93559
Y 20 109834
Y 21 58018
Y 22 5464
Y 23 619
Y 24 298
Y 25 125
Y 26 60
Y 27 25
Y 28 12
Y 29 3
Y 30 1
Y 31 0
Y 32 0

        It wouldn't be a good idea to use a "-t 8" over the entire movie.  But
        if a frame is so dark that Y' is centered around 20 perhaps a "-t 8"
        would be fine.

        Would it make sense to have several 'regions' or 'bands' that have
        different thresholds?   If the majority of the frame has a Y' around
        20 +/-4 use a "-t 8", if it's centered about 28 +/- 4 then a "-t 6",
        32 +/-4  "-t 4", and so on.  After a certain point Y' will be high
        enough (48 or so) that the scene will be bright enough to not need
        median/averaging since the blocks/splotches won't be as noticeable to
        the eye.

        Or would that not make much difference or even worse cause visible
        artifacts?

        The other idea is to quantize dim scenes less accurately.  For dim
        frames (where the majority of the frame has Y' less than a specified
        value) turning Y' values between 16...19 = 18, 18...22 = 20 and so on
        up to a max (40 perhaps the default ceiling).   That would reduce the
        blockiness quite a bit I'd think since the encoder wouldn't see 
        Y' jumping up and down by small amounts.

        Yet another idea (notice how easy they come when one isn't writing the
        code :)) would be a filter than could be 'trained' - by that I mean
        feed it a bunch of frames of what should be considered "black" - from
        that it could would determine the appropriate median/quantizing 
        parameters to apply.   What'd be great would be the ability to 
        "subtract" the differences between "pure black" and the "reference
        frame(s)" from the movie - but I'm not sure how one subtracts in the
        "YUV" space ;)

        Any statistics or signal processing folks care to chime in with ideas,
        suggestions, or even better working code? :) :)

        Cheers,
        Steven Schultz


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to