-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application closes when selecting a single file or when choosing a resolution and selecting a folder #1
Comments
Heya. Can you please provide a sample file and ways to reproduce? I will try to debug the error. |
Generally speaking there are not a lot of "foolproof" checks in this application. So, for example, if you open a file with a higher resolution than pixels in the raw file, it will likely crash. Same if you open a 12 bit raw file as 16 bit (because to the program, it will seem like the file is ending too soon). It could be fixed, but there hasn't been enough demand so far to justify it. |
Motioncam app. Smartphone photo. Possibly both 4000x3000 |
Okay looking at the 4000x3000 image, at 16 bit that should be 24,000,000 bytes, but it is only 15,000,000 bytes. However 15,000,000 bytes is exactly what you would get at 10 bit. This likely caused the crash. The smaller resolution image has the exact same filesize, leading me to believe it's the same format and whatever settings you made, made no difference. Problem is, 10 bit is not currently supported, only 12 bit. If I find the time, I will try and make it support 10 bit as well, but no promises. Sometimes it can be difficult when the exact bit arrangement is not known. I can try a few default known bit arrangements though. |
Thank you so much for your reply. Here's more information. Now the MotionCam application is rapidly developing, in which you can record RAW photos up to 30 frames per second. Many enthusiasts who need RAW video shooting. The in-app RAW to DNG converter is slow on smartphone. I have not found a working converter for Windows. Maybe you can help. :) |
Hi, the files can be read now. The settings you need are: 4000x3000, 10 bit and 1021 (GRBG) as the bayer pattern. But, the metadata is ignored for now, so the colors are wrong and the black level is not adjusted, and lens corrections are not done. I hope I used the correct algorithm for the 10 bit decoding. I was just guessing because I don't have any specification on what packing was used. This is the algorithm I ended up using: public static byte[] convert10p1Inputto16bit(byte[] input)
{
long inputlength = input.Length * 8;
long outputLength = inputlength / 10 * 16;
long inputlengthBytes = inputlength / 8;
long outputLengthBytes = outputLength / 8;
byte[] output = new byte[outputLengthBytes];
// For each 5 bytes in input, we write 8 bytes in output
for (long i = 0, o = 0; i < inputlengthBytes; i += 5, o += 8)
{
output[o + 1] = input[i]; // Seems correct
output[o] = (byte)((input[i + 4] & 0b0000_0011) << 6);
output[o + 3] = input[i + 1];
output[o + 2] = (byte)((input[i + 4] & 0b0000_1100) << 4);
output[o + 5] = input[i + 2];
output[o + 4] = (byte)((input[i + 4] & 0b0011_0000) << 2);
output[o + 7] = input[i + 3];
output[o + 6] = (byte)(input[i + 4] & 0b1100_0000);
/*Try 1: 1,2,3,4 and then the least significant bits of each in right order. Wasnt quite correct I think.
* output[o+1] = input[i]; // Seems correct
output[o] = (byte)(input[i+4] & 0b1100_0000);
output[o+3] = input[i + 1];
output[o+2] = (byte)((input[i + 4] & 0b0011_0000) << 2);
output[o+5] = input[i + 2];
output[o+4] = (byte)((input[i + 4] & 0b0000_11000) << 4);
output[o+7] = input[i + 3];
output[o+6] = (byte)((input[i + 4] & 0b0000_0011) << 6);*/
}
return output;
} I've attached a sample file. (Presumably) because the output format still uses 12 bit, the dng is larger than that of the camera (~9 MB vs ~7MB). This would need some more work to perfect but I don't know if I have the time. The code changes are pushed, so you can compile the current version if you want. |
Doesnt work, can you compile windows build where it can convert raw files from motioncam ? currently its crashing. |
Hello.
The text was updated successfully, but these errors were encountered: