Closed balintlaczko closed 4 years ago
Yes, I think PNG is good. Could you check if these are uncompressed/lossless PNG files?
Yes, will check!
I´ve changed all the TIFF formats to PNG now for testing on windows. PNG has actually become the default image-exporting format for the jit.matrices. However, with 8-bit compression. So I have two questions:
Is there any reason why some files are exported as TIFF/PNG and others in JPEG?
Would it be useful to have an option in the UI for choosing which format to export the images in? That way, the user can decide whether to export the images in lossless TIFF, compressed PNG, and/or JPEG.
Good question, I think this would make a great menu option, maybe we don't need to see it on the main ui? ...I add it to my list.
Yes! There might be a way to get uncompressed PNG export, actually. I'm looking into it.
@AleksanderTidemann have you got some insight about this? I haven't seen in the docs anything clearly saying that the png is compressed or not, the file size is bigger than the jpeg, but that could also mean that it's less compressed. What I have found in the docs is that the .jxf format is for sure uncompressed - but does that imply that the others are not?
Yes, the PNG´s exported from Max are compressed (PNG-8). I haven't found a way to make PNG´s export uncompressed yet.. But I guess if the user can choose between TIFF, JPEG, and PNG, then they at least have one uncompressed file export option. Does TIFF-export work on Windows now when you fixed the motion images bugs, @balintlaczko ?
It's still weird but it does succeed more often (?...). Maybe it's something with the scheduling, I will try some tricks now.
Yes, it´s strange because it works well on Mac. If you have the chance, try to export the files in TIFF on another Windows machine. Might be interesting to see.
Yes will do that - but would also be nice to know that it works on every laptop no matter what. Looking into the issue!
Tried it with lots of pictures, in just a test patch, importmovie some/thing, exportimage some/thing tiff. Same result, sometimes got an output tiff file, sometimes nothing. Then I noticed that it depends on the matrix horizontal dim. If the horizontal dim is divisible by 4 (!?!?) then it works. If not, then it doesn't. The vertical dim doesn't seem to matter (it exports even if it's 1 pixel). This behavior seems to be 100% predictable. Will continue the investigation tomorrow... One of those "I <3 Max" moments!... Oh and will write to Cycling as well.
Crazy odd.. By the way, did the .jxf work on your Windows machine? We might want to allow for jxf and tiff (If you get it to work) as uncompressed options. In the app-style menu bar
Yep, the jxf works I just don't really understand what case could it be useful to have that since (AFAIK) it's jitter's own format, I don't know what else can recognise it.(?) But we can include it as an option. I was also thinking about the png-8 thing. I could be super wrong here but based on what I have read about it the 8 signals the bit depth so in png-8 we have 8 bits ie 256 possible values for each pixel. So far in all the test videos we have always worked with char matrices which are also 8 bit, so could it be that the png-8 export is effectively lossless? The other question is whether there is any case when the movie imported into the [jit.qt.movie] is not passed as char.
Yes, exactly! There are a few instances in the signal path where we have [jit.matrix char] specified, doesn't that automatically convert any other "format" into char?
I think all [jit. matrix] objects are @adapt 1 by default, so it only converts if you specify that @adapt 0. Not 100% sure but that's how I remember. Could be worth a test. (lol the max attribute syntax is slightly interfering with the markdown one)
Yeah, there are a few places actually. Some places need to keep a specified plane-count, like the [mgt.rbs2luma]-type externals. But they would just need a different set of arguments I guess. Should we open an issue on this? To change all matrices to adapt the Type from the imported movie?
Yes that would be good, but first let's check if it's possible to get anything else than a char matrix from the output of [jit.qt.movie], if not, it doesn't really matter anyway.
Jepp, lets!
Regarding the tiff issue on windows, I made a test patch (which I sent to Cycling in my bug report) and the issue seems to be 100% consistent. I'll make some adjustments to make sure tiffs do export on windows, and I will also post here what they replied to the report.
...and I create another issue for the char test thing!
Nice :) It´ll be interesting to hear what they have to say.
Just as a documentation, here is the reply to my bug report from Cycling:
Chris Martin (Cycling '74 Support)
Dec 16, 16:45 PST
Hello Balint,
Thanks for the patch and the detailed description. I was able to reproduce this strange behavior on my Windows machine and have brought this one to engineering's attention.
Feel free to send any other questions my way or comments and I will be happy to help.
Kindest Regards Christopher
Typically it does for either motiongram_v OR motiongram_h but not for both. Sometimes it doesn't work for either of those. Jpegs always work. Pngs always work. And the whole problem only appears on Windows - on Mac, it seems to work all the time. Not sure if this is a bug of -VideoAnalysis, -[xray.jit.mean] -Max. Tried to save the tiff from a [jit.matrix] at several stages in either [motiongram_v] or [motiongram_h] - seems like the problem has to do something with the incoming format (or shape?) of the data. If I just importmovie sunset.jpg in a [jit.matrix] and export a tiff - that works.
Possible quick solution: move over to using PNG instead of TIFF?