Author Topic: Microsoft Visual Studio Post-Processing Development C++ and/or C#  (Read 4050 times)

maxotics

  • Hero Member
  • *****
  • Posts: 532
I'm stuck between many a rock and hard place...

I want to work with the RAW files, ("focus dots" and moire issues in pre de-bayered data), and ultimately create a RAW to ProRes for the EOS-M. 

I've been working from g3gg0's C# MLVViewer which has been EXTREMELY helpful (thank you, g3ggo!).   My goal has been a RAW frame manipulation lab.

But part of me says to just create a function in raw2dng that deals with the focus dots and maybe push to the main fork one day if thought worthy.  I want to work in the spirit Alex talks about, so don't want to go down a path that may make it more difficult for others later.  My first choice would be to work with Visual Studio, which I know.

C++ is a struggle for me, C# is easier.  Anyway, should I

1. Figure out how to port any C++ to C# and just work from there
2. Work with C++ in Visual Studio
3. Man up and use MinGW or something similar?

I see many posts on development for ML, but I want to focus on post-processing.   Advice GREATLY appreciated!  If there is already a thread on post-processing development in Windows please point me to it, or any other helpful material. (BTW, have installed MinGW but already have basic configuration problems, so this is why I want to know what I'm dealing with).

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Microsoft Visual Studio Post-Processing Development C++ and/or C#
« Reply #1 on: October 22, 2013, 09:07:53 PM »
raw2dng is written in C, not C++. I'm not sure if Visual Studio can compile it, because I had to use -mno-ms-bitfields for unpacking the 14-bit stream with the raw_pixblock structure. I don't know the exact details, but I believe Microsoft uses a different ordering of bit fields in a structure (so one should probably rewrite struct raw_pixblock?)

But mingw and a good text editor should work pretty well.

Indeed, raw processing code in C may not be straightforward (mostly because of packed 14-bit data, and black/white levels). You can access a pixel with raw_get_pixel / raw_set_pixel (slow, but readable), or you could iterate through the image buffer with struct raw_pixblock * and use the PA / SET_PA and related macros (faster, but harder to write and to read), or you can unpack the raw data and copy it in whatever format you wish (for example, in chroma_smooth and cr2hdr code I found it easy to work with a large block of memory and address a pixel with buf[x + y*w], but others may prefer a matrix addressed with buf[y][x ], or to work on tiles and so on).

Also look in the dual ISO pdf, since it contains a short description of the raw format.

maxotics

  • Hero Member
  • *****
  • Posts: 532
Re: Microsoft Visual Studio Post-Processing Development C++ and/or C#
« Reply #2 on: October 22, 2013, 10:05:14 PM »
Alex, Your "struct raw_pixblock * and use the PA / SET_PA and related macros" has sent me jumping back into the safety of g3gg0's MLV viewer. :) I've been able to read the footer data and load a frame into a viewer.  At this point, I'm not looking for speed, but working ideas.  Sounds like I should just continue there.  I can see that g3gg0 has to deal with black/white levels in his code, etc.  Thanks!

Man I wish I knew about this a few weeks ago!  Putting the link here for anyone else http://acoutts.com/a1ex/dual_iso.pdf

minimimi

  • Freshman
  • **
  • Posts: 68
Re: Microsoft Visual Studio Post-Processing Development C++ and/or C#
« Reply #3 on: November 16, 2013, 01:16:12 PM »
I just made a VC++ projects for raw2dng
https://bitbucket.org/minimimi/magic-lantern-raw2dng_vc

see contrib/raw2dng_vc dir.

I'm imported raw2dng.c to main app  and using C++ class version chdk-dng.c