thanks to Albert's corrections to the encoder.cs, the ipsp sample can now save consistently jpegs ... but I have found (unfortunately) another problem.
When opening and saving a jpeg, the output jpeg can be viewed by sompe programs and not by some others.
For example, while the original can be opened by jpgview.exe (samples) or mspaint, the one saved through the ttippi example cannot. If viewed through jpgview it shows black. If one attempts to view it via mspaint, the latter returns an error and the file can't be opened. Now here is where it gets more complicated, the same file can be viewed through the "windows Picture and Fax Viewer" or the browser (IE and Firefox).
Attached are two files, now.jpg (the original) and now1.jpg (the saved copy using the example).
Thank you in advance for any help,
with all due respect, the reason why this is in a new thread is because I think and hope that this is a different bug from the previous one. At least my initial investigation shows differences in the way the jpeg header are formatted. I have no problem, if this is what the moderators prefer, in merging different issues in a common thread. The intention was, and is, to segregate bugs so not to make any confusion. If it appears, to the reader, that this thread addresses the same issue as the previous ones, I will rephrase this to emphasize the differences. Ultimately, my only wish is to address an issue I have with the aforementioned code. I have no specific preferences about the number of threads and will modify it/them however it is necessary/requested.
I have noproblems with separating the issues. I do it as well. However, based on the thread titles your issues sound the same, so you could at least try to think of a better subject.
In a few I will try the workaround and will let you know the results. I was thinking of a pre-encoding check (if comment is blank fill it with some string ... sort of) not sure if it would be more elegant/proper to perform this check in the encoder.cs or the ttippi.cs. On a different but related matter, are you maintaining the c# examples? The reason I ask is because I have found a few more "quirks" and would like to know who I can get in contact/collaboration with so to correct as many "quircks" as possible before the next release.
definitively a step forward. The File can now be edited by MSPAINT. Instead of commenting out the entire method I just commented out the calls to it (WriteCOM). I have also noticed code (commented out) that was indeed checking for a value or it would assign a default "versioning" comment. There is still the presence of what seems to be an "extra" header. Its presence does not allow IJL based utilities (i.e. jpgview) to see the image. No errors, but a completely black image. I compared the "good" and the "bad" images and found the following "extra" header in hex:
[c-sharp]0b ff c4 00 1f 01 00 03 01 01 01 01 01 01 01 01 01 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0a[/c-sharp]
Thank you in advance,
PS It seems to have something to do with the DefaultChrominanceDCBits and the DefaultLuminanceDCBits.
for( i=0; i
m_qntbl = new CJPEGEncoderQuantTable();
for( i=0; i
m_dctbl = new CJPEGEncoderHuffmanTable();
m_actbl = new CJPEGEncoderHuffmanTable();
m_se = 63; // missed data
IppLibraryVersion lib = new IppLibraryVersion(ipp.jp.ippjGetLibVersion());
string comment = "JPEG encoder based on " + new string(lib.Name) + " " + new string(lib.BuildDate);
int len = comment.Length + 2;
if (m_dst.currPos + len >= m_dst.DataLen)
m_dst._WRITE_WORD(0xff00 | (int)JMARKER.JM_COM);
for (int i = 0; i < len - 2; i++)
thank you for the code corrections. I am now able to process jpegs and able to view them via an IJL based utility.
I am assuming you are the maintainer of the c# sample code. I have identified - but not performed any diagnostic yet - a few more quirks on the ttippi example. For example, if attempting to rotate an image, only a sub section of the complete image (North-West) is processed. A similar behaviour (sub section) can be observed when performing other filter/transformation.
What is the internal procedure to begin addressing the aforementioned problems?
Should a new thread (i.e. "c# ttippi.exe bugs and fixes") be started?
Once again thank you for the solutions already provided and looking forward to begin correction of the other issues.
This sample is example of using the unmanaged IPP functions with the managed callers via the P/Invoke method. It's not the specific purpose application. And for rotating (filtering) an image it showshow tooperate withROI (here roi is 3/4 of the complete image).You free to usethese codes to create your own application what you need.