Thread: Final filter test failing

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,425

    Final filter test failing

    Got round to trying my filters on the last 2 images of the filter test set in the png suite, the colour worked fine but the greyscale dot didn't work out, from what I've seen so far it seems my filters only work on 8 bits values (possible 16 bit also), in other words whole bytes, anyone have any ideas just by looking at the main function:

    Code:
    int ScanLines( IMAGE *Image )
    {
    	ulong Cols = Image->Cols, col, pixel;
    	ulong Rows = Image->Rows, row;
    	ulong depth = Image->Depth;
    	ulong keep = ~(~0 << depth);
    	ulong channels = (Image->Flags & 2) + 1;
    	//float max = keep;
    	BUFFERS *Buffers = Image->Buffers;
    	BUFFER *Data = AccessBuffer( Buffers, Image->DataID );
    	uchar *data = Data->addr;
    	BIT pos;
    #if 0
    	STREAM Stream = {0};
    	STREAM_BUFFER_ID StreamID = {0};
    
    	StreamID.Buffers = Image->Buffers;
    	StreamID.id = Image->DataID );
    	Stream.data = &StreamID;
    	Stream.DataCB = StreamDataFromBufferIndex;
    #endif
    
    	SetBit( &pos, data, 0 );
    
    	for ( row = 0, pixel = 0; row < Rows; ++row )
    	{
    		ulong filter = ImageValueFromIDAT( Image, &pos, 8 );
    
    		for ( col = 0; col < Cols; ++col, ++pixel )
    		{
    			ulong channel = 0;
    
    			for ( ; channel < channels; ++channel )
    			{
    				ulong index = ImagePixelX( Image, row, col );
    				ulong val = ImageValueFromIDAT( Image, &pos, depth );
    				ulong *PX = ImagePixel( Image, index, channel );
    				ulong loc = ImageFilters[filter]( Image, channel, row, col );
    				*PX = (val + loc) & keep;
    			}
    
    			for ( ; channel < IMAGE_CHANNEL_A; ++channel )
    			{
    				ulong index = ImagePixelX( Image, row, col );
    				ulong *PX = ImagePixel( Image, index, channel );
    				ulong *P0 = ImagePixel( Image, index, 0 );
    				*PX = *P0;
    			}
    		}
    	}
    
    	return 0;
    }
    Moved some code to a more appropriate place, found out that last of the (af0df35f) * Commits * Lee Shallis / glEngine * GitLab

    Edit: The image is here:

    f99n0g04.png

  2. #2
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,425
    Since hamster_nz is able to produce the lists for zlib format I'll ask this, for the image noted in my previous post could you generate a list of the huffman codes it's supposed to have, I wanna check if maybe my decompression code had an edge case bug, I'll add what I get to this post so I can more easily compare what you post

    Code:
    make eog ARGS="--detailed -f ./pngsuite/f99n0g04.png"
    ...
    ./a.out --detailed -f ./pngsuite/f99n0g04.png && eog pic.ppm
    ...
    buff/zlib.c:919: Zlib: method = 8, info = 7, type = 0, dictionary = false, check = 13
    buff/zlib.c:866: last = 1, type = 10, Stream->used = 19
    buff/zlib.c:723: Type Symbols List Details: foresee:  14, longest =  5, highest = 31, have =     256, used =      32
    type_symbols[         0]: _tt =  true, src =   5, lit =   7, use =  true, get =  0, cpy =     1, len =  2, uid = 00
    type_symbols[         1]: _tt =  true, src =   4, lit =   8, use =  true, get =  0, cpy =     1, len =  2, uid = 01
    type_symbols[         4]: _tt =  true, src =   3, lit =   0, use =  true, get =  0, cpy =     1, len =  3, uid = 100
    type_symbols[         5]: _tt =  true, src =   1, lit =  17, use =  true, get =  3, cpy =     3, len =  3, uid = 101
    type_symbols[        12]: _tt =  true, src =  11, lit =   4, use =  true, get =  0, cpy =     1, len =  4, uid = 1100
    type_symbols[        13]: _tt =  true, src =   9, lit =   5, use =  true, get =  0, cpy =     1, len =  4, uid = 1101
    type_symbols[        14]: _tt =  true, src =   7, lit =   6, use =  true, get =  0, cpy =     1, len =  4, uid = 1110
    type_symbols[        30]: _tt =  true, src =  13, lit =   3, use =  true, get =  0, cpy =     1, len =  5, uid = 11110
    type_symbols[        31]: _tt =  true, src =   2, lit =  18, use =  true, get =  7, cpy =    11, len =  5, uid = 11111
    buff/zlib.c:749: Stream Details: End Of Data =  true, End Of Stream = false, data = 0x7ffd5b08f820, byte = 369, took = 629, used = 629
    Code Symbols List Details: foresee: 271, longest =  8, highest = 255, have =   65536, used =     256
    code_symbols[         0]: _tt = false, src = 257, lit = 257, use =  true, get =  0, cpy =     3, len =  4, uid = 0000
    code_symbols[         2]: _tt = false, src =   0, lit =   0, use =  true, get =  0, cpy =     0, len =  5, uid = 00010
    code_symbols[         3]: _tt = false, src =   1, lit =   1, use =  true, get =  0, cpy =     0, len =  5, uid = 00011
    code_symbols[         4]: _tt = false, src =   8, lit =   8, use =  true, get =  0, cpy =     0, len =  5, uid = 00100
    code_symbols[         5]: _tt = false, src =  16, lit =  16, use =  true, get =  0, cpy =     0, len =  5, uid = 00101
    code_symbols[         6]: _tt = false, src =  17, lit =  17, use =  true, get =  0, cpy =     0, len =  5, uid = 00110
    code_symbols[         7]: _tt = false, src = 221, lit = 221, use =  true, get =  0, cpy =     0, len =  5, uid = 00111
    code_symbols[         8]: _tt = false, src = 222, lit = 222, use =  true, get =  0, cpy =     0, len =  5, uid = 01000
    code_symbols[         9]: _tt = false, src = 238, lit = 238, use =  true, get =  0, cpy =     0, len =  5, uid = 01001
    code_symbols[        10]: _tt = false, src = 239, lit = 239, use =  true, get =  0, cpy =     0, len =  5, uid = 01010
    code_symbols[        11]: _tt = false, src = 240, lit = 240, use =  true, get =  0, cpy =     0, len =  5, uid = 01011
    code_symbols[        12]: _tt = false, src = 248, lit = 248, use =  true, get =  0, cpy =     0, len =  5, uid = 01100
    code_symbols[        13]: _tt = false, src = 255, lit = 255, use =  true, get =  0, cpy =     0, len =  5, uid = 01101
    code_symbols[        14]: _tt = false, src = 258, lit = 258, use =  true, get =  0, cpy =     4, len =  5, uid = 01110
    code_symbols[        30]: _tt = false, src =   3, lit =   3, use =  true, get =  0, cpy =     0, len =  6, uid = 011110
    code_symbols[        31]: _tt = false, src =   4, lit =   4, use =  true, get =  0, cpy =     0, len =  6, uid = 011111
    code_symbols[        32]: _tt = false, src =   9, lit =   9, use =  true, get =  0, cpy =     0, len =  6, uid = 100000
    code_symbols[        33]: _tt = false, src =  25, lit =  25, use =  true, get =  0, cpy =     0, len =  6, uid = 100001
    code_symbols[        34]: _tt = false, src =  33, lit =  33, use =  true, get =  0, cpy =     0, len =  6, uid = 100010
    code_symbols[        35]: _tt = false, src =  34, lit =  34, use =  true, get =  0, cpy =     0, len =  6, uid = 100011
    code_symbols[        36]: _tt = false, src = 153, lit = 153, use =  true, get =  0, cpy =     0, len =  6, uid = 100100
    code_symbols[        37]: _tt = false, src = 204, lit = 204, use =  true, get =  0, cpy =     0, len =  6, uid = 100101
    code_symbols[        76]: _tt = false, src =   2, lit =   2, use =  true, get =  0, cpy =     0, len =  7, uid = 1001100
    code_symbols[        77]: _tt = false, src =   5, lit =   5, use =  true, get =  0, cpy =     0, len =  7, uid = 1001101
    code_symbols[        78]: _tt = false, src =  10, lit =  10, use =  true, get =  0, cpy =     0, len =  7, uid = 1001110
    code_symbols[        79]: _tt = false, src =  18, lit =  18, use =  true, get =  0, cpy =     0, len =  7, uid = 1001111
    code_symbols[        80]: _tt = false, src =  19, lit =  19, use =  true, get =  0, cpy =     0, len =  7, uid = 1010000
    code_symbols[        81]: _tt = false, src =  48, lit =  48, use =  true, get =  0, cpy =     0, len =  7, uid = 1010001
    code_symbols[        82]: _tt = false, src =  52, lit =  52, use =  true, get =  0, cpy =     0, len =  7, uid = 1010010
    code_symbols[        83]: _tt = false, src =  66, lit =  66, use =  true, get =  0, cpy =     0, len =  7, uid = 1010011
    code_symbols[        84]: _tt = false, src = 100, lit = 100, use =  true, get =  0, cpy =     0, len =  7, uid = 1010100
    code_symbols[        85]: _tt = false, src = 120, lit = 120, use =  true, get =  0, cpy =     0, len =  7, uid = 1010101
    code_symbols[        86]: _tt = false, src = 135, lit = 135, use =  true, get =  0, cpy =     0, len =  7, uid = 1010110
    code_symbols[        87]: _tt = false, src = 170, lit = 170, use =  true, get =  0, cpy =     0, len =  7, uid = 1010111
    code_symbols[        88]: _tt = false, src = 171, lit = 171, use =  true, get =  0, cpy =     0, len =  7, uid = 1011000
    code_symbols[        89]: _tt = false, src = 185, lit = 185, use =  true, get =  0, cpy =     0, len =  7, uid = 1011001
    code_symbols[        90]: _tt = false, src = 186, lit = 186, use =  true, get =  0, cpy =     0, len =  7, uid = 1011010
    code_symbols[        91]: _tt = false, src = 188, lit = 188, use =  true, get =  0, cpy =     0, len =  7, uid = 1011011
    code_symbols[        92]: _tt = false, src = 190, lit = 190, use =  true, get =  0, cpy =     0, len =  7, uid = 1011100
    code_symbols[        93]: _tt = false, src = 203, lit = 203, use =  true, get =  0, cpy =     0, len =  7, uid = 1011101
    code_symbols[        94]: _tt = false, src = 205, lit = 205, use =  true, get =  0, cpy =     0, len =  7, uid = 1011110
    code_symbols[        95]: _tt = false, src = 220, lit = 220, use =  true, get =  0, cpy =     0, len =  7, uid = 1011111
    code_symbols[        96]: _tt = false, src = 223, lit = 223, use =  true, get =  0, cpy =     0, len =  7, uid = 1100000
    code_symbols[        97]: _tt = false, src = 246, lit = 246, use =  true, get =  0, cpy =     0, len =  7, uid = 1100001
    code_symbols[        98]: _tt = false, src = 247, lit = 247, use =  true, get =  0, cpy =     0, len =  7, uid = 1100010
    code_symbols[        99]: _tt = false, src = 253, lit = 253, use =  true, get =  0, cpy =     0, len =  7, uid = 1100011
    code_symbols[       100]: _tt = false, src = 259, lit = 259, use =  true, get =  0, cpy =     5, len =  7, uid = 1100100
    code_symbols[       101]: _tt = false, src = 260, lit = 260, use =  true, get =  0, cpy =     6, len =  7, uid = 1100101
    code_symbols[       102]: _tt = false, src = 263, lit = 263, use =  true, get =  0, cpy =     9, len =  7, uid = 1100110
    code_symbols[       103]: _tt = false, src = 267, lit = 267, use =  true, get =  1, cpy =    15, len =  7, uid = 1100111
    code_symbols[       208]: _tt = false, src =  20, lit =  20, use =  true, get =  0, cpy =     0, len =  8, uid = 11010000
    code_symbols[       209]: _tt = false, src =  21, lit =  21, use =  true, get =  0, cpy =     0, len =  8, uid = 11010001
    code_symbols[       210]: _tt = false, src =  26, lit =  26, use =  true, get =  0, cpy =     0, len =  8, uid = 11010010
    code_symbols[       211]: _tt = false, src =  42, lit =  42, use =  true, get =  0, cpy =     0, len =  8, uid = 11010011
    code_symbols[       212]: _tt = false, src =  43, lit =  43, use =  true, get =  0, cpy =     0, len =  8, uid = 11010100
    code_symbols[       213]: _tt = false, src =  49, lit =  49, use =  true, get =  0, cpy =     0, len =  8, uid = 11010101
    code_symbols[       214]: _tt = false, src =  50, lit =  50, use =  true, get =  0, cpy =     0, len =  8, uid = 11010110
    code_symbols[       215]: _tt = false, src =  58, lit =  58, use =  true, get =  0, cpy =     0, len =  8, uid = 11010111
    code_symbols[       216]: _tt = false, src =  64, lit =  64, use =  true, get =  0, cpy =     0, len =  8, uid = 11011000
    code_symbols[       217]: _tt = false, src =  65, lit =  65, use =  true, get =  0, cpy =     0, len =  8, uid = 11011001
    code_symbols[       218]: _tt = false, src =  67, lit =  67, use =  true, get =  0, cpy =     0, len =  8, uid = 11011010
    code_symbols[       219]: _tt = false, src =  70, lit =  70, use =  true, get =  0, cpy =     0, len =  8, uid = 11011011
    code_symbols[       220]: _tt = false, src =  80, lit =  80, use =  true, get =  0, cpy =     0, len =  8, uid = 11011100
    code_symbols[       221]: _tt = false, src =  83, lit =  83, use =  true, get =  0, cpy =     0, len =  8, uid = 11011101
    code_symbols[       222]: _tt = false, src =  86, lit =  86, use =  true, get =  0, cpy =     0, len =  8, uid = 11011110
    code_symbols[       223]: _tt = false, src =  99, lit =  99, use =  true, get =  0, cpy =     0, len =  8, uid = 11011111
    code_symbols[       224]: _tt = false, src = 101, lit = 101, use =  true, get =  0, cpy =     0, len =  8, uid = 11100000
    code_symbols[       225]: _tt = false, src = 103, lit = 103, use =  true, get =  0, cpy =     0, len =  8, uid = 11100001
    code_symbols[       226]: _tt = false, src = 116, lit = 116, use =  true, get =  0, cpy =     0, len =  8, uid = 11100010
    code_symbols[       227]: _tt = false, src = 118, lit = 118, use =  true, get =  0, cpy =     0, len =  8, uid = 11100011
    code_symbols[       228]: _tt = false, src = 119, lit = 119, use =  true, get =  0, cpy =     0, len =  8, uid = 11100100
    code_symbols[       229]: _tt = false, src = 121, lit = 121, use =  true, get =  0, cpy =     0, len =  8, uid = 11100101
    code_symbols[       230]: _tt = false, src = 137, lit = 137, use =  true, get =  0, cpy =     0, len =  8, uid = 11100110
    code_symbols[       231]: _tt = false, src = 151, lit = 151, use =  true, get =  0, cpy =     0, len =  8, uid = 11100111
    code_symbols[       232]: _tt = false, src = 152, lit = 152, use =  true, get =  0, cpy =     0, len =  8, uid = 11101000
    code_symbols[       233]: _tt = false, src = 154, lit = 154, use =  true, get =  0, cpy =     0, len =  8, uid = 11101001
    code_symbols[       234]: _tt = false, src = 155, lit = 155, use =  true, get =  0, cpy =     0, len =  8, uid = 11101010
    code_symbols[       235]: _tt = false, src = 169, lit = 169, use =  true, get =  0, cpy =     0, len =  8, uid = 11101011
    code_symbols[       236]: _tt = false, src = 175, lit = 175, use =  true, get =  0, cpy =     0, len =  8, uid = 11101100
    code_symbols[       237]: _tt = false, src = 182, lit = 182, use =  true, get =  0, cpy =     0, len =  8, uid = 11101101
    code_symbols[       238]: _tt = false, src = 187, lit = 187, use =  true, get =  0, cpy =     0, len =  8, uid = 11101110
    code_symbols[       239]: _tt = false, src = 192, lit = 192, use =  true, get =  0, cpy =     0, len =  8, uid = 11101111
    code_symbols[       240]: _tt = false, src = 198, lit = 198, use =  true, get =  0, cpy =     0, len =  8, uid = 11110000
    code_symbols[       241]: _tt = false, src = 200, lit = 200, use =  true, get =  0, cpy =     0, len =  8, uid = 11110001
    code_symbols[       242]: _tt = false, src = 202, lit = 202, use =  true, get =  0, cpy =     0, len =  8, uid = 11110010
    code_symbols[       243]: _tt = false, src = 208, lit = 208, use =  true, get =  0, cpy =     0, len =  8, uid = 11110011
    code_symbols[       244]: _tt = false, src = 212, lit = 212, use =  true, get =  0, cpy =     0, len =  8, uid = 11110100
    code_symbols[       245]: _tt = false, src = 216, lit = 216, use =  true, get =  0, cpy =     0, len =  8, uid = 11110101
    code_symbols[       246]: _tt = false, src = 224, lit = 224, use =  true, get =  0, cpy =     0, len =  8, uid = 11110110
    code_symbols[       247]: _tt = false, src = 231, lit = 231, use =  true, get =  0, cpy =     0, len =  8, uid = 11110111
    code_symbols[       248]: _tt = false, src = 237, lit = 237, use =  true, get =  0, cpy =     0, len =  8, uid = 11111000
    code_symbols[       249]: _tt = false, src = 249, lit = 249, use =  true, get =  0, cpy =     0, len =  8, uid = 11111001
    code_symbols[       250]: _tt = false, src = 256, lit = 256, use =  true, get =  0, cpy =     0, len =  8, uid = 11111010
    code_symbols[       251]: _tt = false, src = 261, lit = 261, use =  true, get =  0, cpy =     7, len =  8, uid = 11111011
    code_symbols[       252]: _tt = false, src = 264, lit = 264, use =  true, get =  0, cpy =    10, len =  8, uid = 11111100
    code_symbols[       253]: _tt = false, src = 268, lit = 268, use =  true, get =  1, cpy =    17, len =  8, uid = 11111101
    code_symbols[       254]: _tt = false, src = 269, lit = 269, use =  true, get =  2, cpy =    19, len =  8, uid = 11111110
    code_symbols[       255]: _tt = false, src = 270, lit = 270, use =  true, get =  2, cpy =    23, len =  8, uid = 11111111
    Loop Symbols List Details: foresee:  18, longest =  8, highest = 63, have =  131072, used =     256
    loop_symbols[         0]: _tt = false, src =  12, lit = 300, use =  true, get =  5, cpy =    65, len =  3, uid = 000
    loop_symbols[         1]: _tt = false, src =  14, lit = 302, use =  true, get =  6, cpy =   129, len =  3, uid = 001
    loop_symbols[         2]: _tt = false, src =  15, lit = 303, use =  true, get =  6, cpy =   193, len =  3, uid = 010
    loop_symbols[         6]: _tt = false, src =   0, lit = 288, use =  true, get =  0, cpy =     1, len =  4, uid = 0110
    loop_symbols[         7]: _tt = false, src =   4, lit = 292, use =  true, get =  1, cpy =     5, len =  4, uid = 0111
    loop_symbols[         8]: _tt = false, src =   9, lit = 297, use =  true, get =  3, cpy =    25, len =  4, uid = 1000
    loop_symbols[         9]: _tt = false, src =  10, lit = 298, use =  true, get =  4, cpy =    33, len =  4, uid = 1001
    loop_symbols[        10]: _tt = false, src =  11, lit = 299, use =  true, get =  4, cpy =    49, len =  4, uid = 1010
    loop_symbols[        11]: _tt = false, src =  13, lit = 301, use =  true, get =  5, cpy =    97, len =  4, uid = 1011
    loop_symbols[        12]: _tt = false, src =  16, lit = 304, use =  true, get =  7, cpy =   257, len =  4, uid = 1100
    loop_symbols[        13]: _tt = false, src =  17, lit = 305, use =  true, get =  7, cpy =   385, len =  4, uid = 1101
    loop_symbols[        28]: _tt = false, src =   6, lit = 294, use =  true, get =  2, cpy =     9, len =  5, uid = 11100
    loop_symbols[        29]: _tt = false, src =   8, lit = 296, use =  true, get =  3, cpy =    17, len =  5, uid = 11101
    loop_symbols[        60]: _tt = false, src =   1, lit = 289, use =  true, get =  0, cpy =     2, len =  6, uid = 111100
    loop_symbols[        61]: _tt = false, src =   2, lit = 290, use =  true, get =  0, cpy =     3, len =  6, uid = 111101
    loop_symbols[        62]: _tt = false, src =   5, lit = 293, use =  true, get =  1, cpy =     7, len =  6, uid = 111110
    loop_symbols[        63]: _tt = false, src =   7, lit = 295, use =  true, get =  2, cpy =    13, len =  6, uid = 111111

  3. #3
    Registered User
    Join Date
    Sep 2020
    Posts
    294
    Just by eyeballing them I can tell that they are good. They start at "all zeros" and end at "all ones".

    But will supply a table when I finish work (in about 9 hours or so).

  4. #4
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,425
    Quote Originally Posted by hamster_nz View Post
    Just by eyeballing them I can tell that they are good. They start at "all zeros" and end at "all ones".

    But will supply a table when I finish work (in about 9 hours or so).
    Thx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 10-19-2013, 11:01 PM
  2. DirectX dll Final Debug and Final Retail
    By hdragon in forum Tech Board
    Replies: 0
    Last Post: 11-15-2005, 09:46 PM
  3. Test at http://www.artlogic.com/careers/test.html
    By zMan in forum C++ Programming
    Replies: 6
    Last Post: 07-15-2003, 06:11 AM

Tags for this Thread