@@ -269,7 +269,7 @@ func TestICC(t *testing.T) {
269269
270270 // try encoding a WebP image, including ICC profile data when available
271271 dstBuf := make ([]byte , destinationBufferSize )
272- encoder , err := newWebpEncoder (decoder , dstBuf , false )
272+ encoder , err := newWebpEncoder (decoder , dstBuf )
273273 if err != nil {
274274 t .Fatalf ("Failed to create a new webp encoder: %v" , err )
275275 }
@@ -292,76 +292,3 @@ func TestICC(t *testing.T) {
292292 }
293293}
294294
295- // TestStandaloneToneMapping tests the standalone tone mapping API
296- func TestStandaloneToneMapping (t * testing.T ) {
297- // Test that tone mapping can be applied independently of encoding
298- hdrPngData , err := ioutil .ReadFile ("data/hdr-ohmama.png" )
299- if err != nil {
300- t .Skipf ("HDR test image not found: %v" , err )
301- }
302-
303- decoder , err := NewDecoder (hdrPngData )
304- if err != nil {
305- t .Fatalf ("Failed to create decoder: %v" , err )
306- }
307- defer decoder .Close ()
308-
309- header , err := decoder .Header ()
310- if err != nil {
311- t .Fatalf ("Failed to read header: %v" , err )
312- }
313-
314- // Create a framebuffer and decode the image
315- fb := NewFramebuffer (header .Width (), header .Height ())
316- defer fb .Close ()
317-
318- if err := decoder .DecodeTo (fb ); err != nil {
319- t .Fatalf ("Failed to decode: %v" , err )
320- }
321-
322- // Get the ICC profile
323- icc := decoder .ICC ()
324- if len (icc ) == 0 {
325- t .Skip ("No ICC profile found in test image" )
326- }
327-
328- // Apply tone mapping as a standalone operation
329- if err := fb .ApplyToneMapping (icc ); err != nil {
330- t .Fatalf ("Failed to apply tone mapping: %v" , err )
331- }
332-
333- // Verify the framebuffer is still valid
334- if fb .Width () != header .Width () || fb .Height () != header .Height () {
335- t .Fatalf ("Framebuffer dimensions changed after tone mapping: got %dx%d, want %dx%d" ,
336- fb .Width (), fb .Height (), header .Width (), header .Height ())
337- }
338-
339- // Now encode to multiple formats to demonstrate independence
340- outputBuf := make ([]byte , 50 * 1024 * 1024 )
341-
342- for _ , format := range []string {".png" , ".webp" } {
343- encodeOptions := map [int ]int {}
344- if format == ".png" {
345- encodeOptions [PngCompression ] = 7
346- } else if format == ".webp" {
347- encodeOptions [WebpQuality ] = 85
348- }
349-
350- // Create encoder without ForceSdr since we already tone-mapped
351- encoder , err := NewEncoder (format , decoder , outputBuf )
352- if err != nil {
353- t .Fatalf ("Failed to create %s encoder: %v" , format , err )
354- }
355-
356- encoded , err := encoder .Encode (fb , encodeOptions )
357- if err != nil {
358- t .Fatalf ("Failed to encode to %s: %v" , format , err )
359- }
360-
361- if len (encoded ) == 0 {
362- t .Fatalf ("Encoded %s data is empty" , format )
363- }
364-
365- encoder .Close ()
366- }
367- }
0 commit comments