logo Sign In

Post #625278

Author
Spaced Ranger
Parent topic
THX 1138 "preservations" + the 'THX 1138 Italian Cut' project (Released)
Link to post in topic
https://originaltrilogy.com/post/id/625278/action/topic#625278
Date created
4-Mar-2013, 7:13 AM

@ Harmy

Even though done on this 720p sample, your example fix is a significant  improvement and probably good enough for the full 1080p. I think you've made someone happy. :)

 

msycamore

Spaced Ranger said:

Interesting that they look allot like edge-enhancement halo's.

A great storyteller always use foreshadowing. :)

Back on page 42, I demo'ed the DeHalo_alpha Avisynth filter on a noticeably EE'd laserdisc snapshot -- with mixed results.

Now, on the film capture, the de-focused edges in 2 of the 3 R/G/B separations have added different color fringing to the chromatic aberration problem. Applying DeHalo to the Red and Blue separations reduced the level of peaking on those bad edges:

                              BLUE separation                                                    BLUE separation DeHalo'ed

In this Blue separation, it flattens out the light and dark peaks. Of course, being in "alpha" development, it produces some artifacts of it's own. But those are less obtrusive and get lost when joined back to the other separations.

Using the same DeHalo settings on both Red and Blue (Green didn't have the edge damage) cleaned up what the chromatic aberration corrections couldn't (notice the shoulder and the collar across the 3 sections -- color fringing reduces as you move along):

            color corrected (cc)           cc & chromatic aberration correction (cac)             cc & cac & DeHalo

Note: color correction was applied later, in a paint program.

I did make one change in applying the chromatic aberration correction. Red seemed to be a very minor player and resizing it, even at a single pixel, didn't produce a noticeable improvement. So I adjusted only Blue and that seemed enough.

Here's the Avisynth script that produced this. DeHalo_alpha is an add-on script (not mine):

##====================
## THX 1138 16mm
## AviSynth 2.5.x script
##==========

## source
##----------
clip1 = ImageSource( "THX1138 16mm -0000.png" )
v1 = clip1.ConvertToRGB32()

## get RED / GREEN / BLUE channels
##----------
v1_R = v1.ShowRed()
v1_G = v1.ShowGreen()
v1_B = v1.ShowBlue()

## DeHalo & resize (chromatic aberration fix) each channel
##----------
## DeHalo_alpha()
## clip clp, float "rx", float "ry", float "darkstr", float "brightstr",
## float "lowsens", float "highsens", float "ss"
## - rx, ry [float, 1.0 ... 2.0 ... ~3.0] Default 2.0
# As usual, the radii for halo removal.
# this function is rather sensitive to the radius settings. Set it as low
# as possible! If radius is set too high, it will start missing small spots.
## - darkkstr, brightstr [float, 0.0 ... 1.0] Default 1.0, <0.0 and >1.0 allowed
# The strength factors for processing dark and bright halos. Default 1.0 both
# for symmetrical processing. On Comic/Anime, darkstr=0.4~0.8 sometimes might
# be better ... sometimes. In General, the function seems to preserve dark
# lines rather good.
## - lowsens, highsens [int, 0 ... 50 ... 100] Default 50
# Sensitivity settings, not that easy to describe them exactly ... in a sense,
# they define a window between how weak an achieved effect has to be to get
# fully accepted, and how strong an achieved effect has to be to get fully
# discarded.
## - ss [float, 1.0 ... 1.5 ...] Default 1.5
# Supersampling factor, to avoid creation of aliasing.
##----------

# DeHalo RED
v1_R_DH = v1_R.ConvertToYV12()
\.DeHalo_alpha( rx=5.0, ry=5.0, lowsens=99, highsens=99 )
\.ConvertToRGB32()
#\.Lanczos4Resize( 718, 480 ).AddBorders( 1, 0, 1, 0 ) #not needed

# do nothing to GREEN
v1_G_DH = v1_G

# DeHalo & resize BLUE
v1_B_DH = v1_B.ConvertToYV12()
\.DeHalo_alpha( rx=5.0, ry=5.0, lowsens=99, highsens=99 )
\.ConvertToRGB32()
\.Lanczos4Resize( 726, 484 ).Crop( 6/2, 4/2, 720, 480 )

# recombined "fixed" separations
v1_DH = MergeRGB( v1_R_DH, v1_G_DH, v1_B_DH )


## display the various results
##==========

#showclip = StackHorizontal( v1_R, v1_R_DH )
#showclip = StackHorizontal( v1_G, v1_G_DH )
#showclip = StackHorizontal( v1_B, v1_B_DH )
showclip = StackHorizontal( v1, v1_DH )
#showclip = v1_DH

showclip



##====================
## De-halo

# Here are the parameters:

# - rx, ry [float, 1.0 ... 2.0 ... ~3.0] Default 2.0
# As usual, the radii for halo removal.
# Note: this function is rather sensitive to the radius settings. Set it as low
# as possible! If radius is set too high, it will start missing small spots.

# - darkkstr, brightstr [float, 0.0 ... 1.0] Default 1.0, <0.0 and >1.0 allowed
# The strength factors for processing dark and bright halos. Default 1.0 both
# for symmetrical processing. On Comic/Anime, darkstr=0.4~0.8 sometimes might
# be better ... sometimes. In General, the function seems to preserve dark
# lines rather good.

# - lowsens, highsens [int, 0 ... 50 ... 100] Default 50
# Sensitivity settings, not that easy to describe them exactly ... in a sense,
# they define a window between how weak an achieved effect has to be to get
# fully accepted, and how strong an achieved effect has to be to get fully
# discarded.

# - ss [float, 1.0 ... 1.5 ...] Default 1.5
# Supersampling factor, to avoid creation of aliasing.

function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
{
rx        = default( rx,        2.0 )
ry        = default( ry,        2.0 )
darkstr   = default( darkstr,   1.0 )
brightstr = default( brightstr, 1.0 )
lowsens   = default( lowsens,    50 )
highsens  = default( highsens,   50 )
ss        = default( ss,        1.5 )

LOS = string(lowsens)
HIS = string(highsens/100.0)
DRK = string(darkstr)
BRT = string(brightstr)
ox  = clp.width()
oy  = clp.height()
uv  = 1
uv2 = (uv==3) ? 3 : 2

halos  = clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
are    = yv12lutxy(clp.expand(U=uv,V=uv),clp.inpand(U=uv,V=uv),"x y -","x y -","x y-",U=uv,V=uv)
ugly   = yv12lutxy(halos.expand(U=uv,V=uv),halos.inpand(U=uv,V=uv),"x y -","x y-","x y -",U=uv,V=uv)
so     = yv12lutxy( ugly, are, "y x - y 0.001 + / 255 * "+LOS+" - y 256 + 512 / "+HIS+" + *" )
lets   = maskedmerge(halos,clp,so,U=uv,V=uv)
remove = (ss==1.0) ? clp.repair(lets,1,0)
          \        : clp.lanczosresize(m4(ox*ss),m4(oy*ss))
          \            .logic(lets.expand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"min",U=uv2,V=uv2)
          \            .logic(lets.inpand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"max",U=uv2,V=uv2)
          \             .lanczosresize(ox,oy)
them   = yv12lutxy(clp,remove,"x y < x x y - "+DRK+" * - x x y - "+BRT+" * - ?",U=2,V=2)

return( them )
}

function m4(float x) {return(x<16?16:int(round(x/4.0)*4))}
##====================