mirror of
				https://github.com/stevenrobertson/cuburn.git
				synced 2025-11-04 02:10:45 -05:00 
			
		
		
		
	Add logencode filter.
This commit is contained in:
		@ -77,6 +77,19 @@ yuv_to_rgb(float4 *dst, const float4 *src) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
''')
 | 
					''')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					logencodelib = devlib(defs=r'''
 | 
				
			||||||
 | 
					__global__ void
 | 
				
			||||||
 | 
					logencode(float4 *dst, const float4 *src, float degamma) {
 | 
				
			||||||
 | 
					    GET_IDX(i);
 | 
				
			||||||
 | 
					    float4 pix = src[i];
 | 
				
			||||||
 | 
					    pix.x = log2f(powf(pix.x, degamma)) / 12.0f + 1.0f;
 | 
				
			||||||
 | 
					    pix.y = log2f(powf(pix.y, degamma)) / 12.0f + 1.0f;
 | 
				
			||||||
 | 
					    pix.z = log2f(powf(pix.z, degamma)) / 12.0f + 1.0f;
 | 
				
			||||||
 | 
					    pix.w = log2f(powf(pix.w, degamma)) / 12.0f + 1.0f;
 | 
				
			||||||
 | 
					    dst[i] = pix;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					''')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
denblurlib = devlib(deps=[texshearlib], decls='''
 | 
					denblurlib = devlib(deps=[texshearlib], decls='''
 | 
				
			||||||
texture<float4, cudaTextureType2D> chan4_src;
 | 
					texture<float4, cudaTextureType2D> chan4_src;
 | 
				
			||||||
texture<float,  cudaTextureType2D> chan1_src;
 | 
					texture<float,  cudaTextureType2D> chan1_src;
 | 
				
			||||||
 | 
				
			|||||||
@ -180,6 +180,17 @@ class ColorClip(Filter, ClsMod):
 | 
				
			|||||||
        launch2('colorclip', self.mod, stream, dim,
 | 
					        launch2('colorclip', self.mod, stream, dim,
 | 
				
			||||||
                fb.d_front, vib, hipow, gam, lin, lingam)
 | 
					                fb.d_front, vib, hipow, gam, lin, lingam)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Filter.register('logencode')
 | 
				
			||||||
 | 
					class LogEncode(Filter, ClsMod):
 | 
				
			||||||
 | 
					    lib = code.filters.logencodelib
 | 
				
			||||||
 | 
					    def apply(self, fb, gprof, params, dim, tc, stream=None):
 | 
				
			||||||
 | 
					        degamma = f32(params.degamma(tc))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        launch2('logencode', self.mod, stream, dim,
 | 
				
			||||||
 | 
					                fb.d_back, fb.d_front, degamma)
 | 
				
			||||||
 | 
					        fb.flip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def create(gprof):
 | 
					def create(gprof):
 | 
				
			||||||
    order = ['yuv'] + gprof.filter_order
 | 
					    order = ['yuv'] + gprof.filter_order
 | 
				
			||||||
    return [Filter.filter_map[f]() for f in order]
 | 
					    return [Filter.filter_map[f]() for f in order]
 | 
				
			||||||
 | 
				
			|||||||
@ -54,6 +54,7 @@ filters = (
 | 
				
			|||||||
  , 'haloclip': {}
 | 
					  , 'haloclip': {}
 | 
				
			||||||
  , 'smearclip': {'width': scalespline(0.7, d='Spatial stdev of filter')}
 | 
					  , 'smearclip': {'width': scalespline(0.7, d='Spatial stdev of filter')}
 | 
				
			||||||
  , 'logscale': {'brightness': scalespline(4, d='Log-scale brightness')}
 | 
					  , 'logscale': {'brightness': scalespline(4, d='Log-scale brightness')}
 | 
				
			||||||
 | 
					  , 'logencode': {'degamma': scalespline(2.2)}
 | 
				
			||||||
  , 'yuv': {}
 | 
					  , 'yuv': {}
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user