Lightroom plugin cr2hdr v3.0 DEV (WIP)

Started by kichetof, March 18, 2014, 05:04:33 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

newsky13

The plugin is just perfect! Thank you so much! But can do so that would be custom keywords exported to the DNG? Thank you.
Sorry for my English, I use a translator site

Walter Schulz

True. Custom keywords will be added if a second export takes place. Dual-ISO will show up, though. Is there a parameter for cr2hdr?

Audionut

Quote from: Walter Schulz on May 04, 2014, 08:10:06 AM
Is there a parameter for cr2hdr?

To add keywords to the output of cr2hdr?

Only in the source.

Walter Schulz

Thanks!
Because this is hardcoded I suggest to change GUI a little bit:

kichetof

I like it! I'll add it ;)

@Walter
I'll merge your pull request (thanks!) but you don't have to clone for every pull request. Clone my project like Walter/lr_cr2hdr_edit or what you want and simply push commit from my repo to keep yours up to day. I'll found a capture when I've my Mac on my hand ;)

Directly from Overview page

What do you think about illustration?


or without background


g3gg0

is it really IMG-0069-dualiso.CR2 ?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

kichetof

Good observation g3gg0!

I edited my previous post and added without background ;)

joshuamk

Hi All,

I've just tried out the lightroom plugin for mac, it's got some serious speed compared to the old GUI. I'm wondering whether it is running the latest 20 bit version of cr2hdr.

The reason I ask is because compared to the v2 GUI which was released on 2013-12-02 there have been some staggering images posted up by A1ex regarding improvements in aliasing and moire. this post in particular caught my eye http://www.magiclantern.fm/forum/index.php?topic=7139.1925.

I have conducted a test of my own using an old mac version of cr2hdr and your latest lightroom plugin. Both images seem pretty much identical as far as aliasing and overall usability in the real world is concerned.

Here are both images with a 400% crop on the most offending areas.
https://www.dropbox.com/s/2gt40u0k80nx459/crop1.jpg
https://www.dropbox.com/s/1ffm3oakgrfwwbv/crop2.jpg

So just a bit of clarification really on whether the lightroom plugin is running the latest version of cr2hdr and if it isn't is there a way to update the plugin? Just in case you think this has been covered I have been keeping a close eye on these forums for the past few months and it was A1ex's quite remarkable images that prompted me to engage. But so far I have not managed to find a way to re-create his results on my video stills.

Any suggestions or help would be greatly appreciated.

kichetof

I focused on the module with stable version and add arguments.

Once this version will lose its beta status, I'll plan to add an experimental cr2hdr-20bit but it's always in development so I don't want to spend a lot of time if there are a lot of changes when it will be available.

Feel free to clone the plugin, add a new branch and pull request and I'll add it :)

(I encountered some difficult to compile cr2hdr since Xcode 5.1 has been released: -Wno-error=unused-command-line-argument-hard-error-in-future)

joshuamk

Thank you for getting back to me so quickly. That seems like a very sensible way to work, otherwise you'd be fighting an uphill battle.
Also i'm quite relieved that it is the stable build and my eyes haven't packed in yet ;)

Thank you that's very generous, something that incorporates some of the current breakthroughs would be very beneficial to filmmakers. We'll certainly start seeing a lot more video clips that sell the great work you guys are doing.

Do cloning and pull requesting happen on bitbucket? I'm very new so pardon my ignorance but if you have a link then i'll follow it and do some learning




kichetof

@joshuamk see links in this post

Okay I confirm I've some trouble to compile cr2hdr-20bit!

$ make cr2hdr
REBUILDING
[ README   ]   module_strings.h
[ gcc      ]   cr2hdr
clang: error: unknown argument: '-mno-ms-bitfields' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [cr2hdr] Error 1


And after removing -mno-ms-bitfields from Makefile.cr2hdr:


$ make cr2hdr
[ gcc      ]   cr2hdr
cr2hdr.c:1218:46: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist rggb.m"));
                                             ^
cr2hdr.c:1218:46: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:1351:46: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist bddb.m"));
                                             ^
cr2hdr.c:1351:46: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:1468:5: error: function definition is not allowed here
    {
    ^
cr2hdr.c:1510:24: error: use of undeclared identifier 'gain'; did you mean
      'main'?
    double a = 100.0 / gain;
                       ^~~~
                       main
cr2hdr.c:555:5: note: 'main' declared here
int main(int argc, char** argv)
    ^
cr2hdr.c:1510:22: error: invalid operands to binary expression ('double' and
      'int (*)(int, char **)')
    double a = 100.0 / gain;
               ~~~~~ ^ ~~~~
cr2hdr.c:1531:39: error: use of undeclared identifier 'gain'; did you mean
      'main'?
                int delta = b * 100 / gain - d;
                                      ^~~~
                                      main
cr2hdr.c:555:5: note: 'main' declared here
int main(int argc, char** argv)
    ^
cr2hdr.c:1531:37: error: invalid operands to binary expression ('int' and
      'int (*)(int, char **)')
                int delta = b * 100 / gain - d;
                            ~~~~~~~ ^ ~~~~
cr2hdr.c:1542:51: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist iso-curve.m"));
                                                  ^
cr2hdr.c:1542:51: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:1964:55: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist fullres-curve.m"));
                                                      ^
cr2hdr.c:1964:55: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:2295:56: warning: if statement has empty body [-Wempty-body]
            if(system("dcraw -d -r 1 1 1 1 edges.dng"));
                                                       ^
cr2hdr.c:2295:56: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:2308:59: warning: if statement has empty body [-Wempty-body]
            if(system("dcraw -d -r 1 1 1 1 edge-map.dng"));
                                                          ^
cr2hdr.c:2308:59: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:2334:21: error: function definition is not allowed here
                    {
                    ^
cr2hdr.c:2352:53: error: use of undeclared identifier 'pi0'
                    interp[x   + y * w] = ev2raw[(2*pi0+pip+pim)/4];
                                                    ^
cr2hdr.c:2594:51: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist mix-curve.m"));
                                                  ^
cr2hdr.c:2594:51: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:3070:55: warning: if statement has empty body [-Wempty-body]
            if(system("octave --persist soft-film.m"));
                                                      ^
cr2hdr.c:3070:55: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:3370:34: warning: if statement has empty body [-Wempty-body]
        if(system("octave wb.m"));
                                 ^
cr2hdr.c:3370:34: note: put the semicolon on a separate line to silence this
      warning
9 warnings and 7 errors generated.
make: *** [cr2hdr] Error 1

g3gg0

your compiler seems a bit picky.
okay local function definitions are evil, but still its valid C :)

try to install gcc.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

kichetof

It's gcc from Xcode and since version 5.1 it's soooo restrictive!

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix


I'll search if I can use an another version

I'll remove Xcode 5.1.1 and reinstall Xcode 5.0.2 I hope its solve this problem

kichetof

the error is still present with xcode 5.0.2 :(

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix


make cr2hdr
REBUILDING
[ README   ]   module_strings.h
[ gcc      ]   cr2hdr
cr2hdr.c:1218:46: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist rggb.m"));
                                             ^
cr2hdr.c:1218:46: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:1351:46: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist bddb.m"));
                                             ^
cr2hdr.c:1351:46: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:1467:29: error: expected ';' at end of declaration
    int match_test(int gain)
                            ^
                            ;
cr2hdr.c:1510:24: error: use of undeclared identifier 'gain'; did you mean
      'main'?
    double a = 100.0 / gain;
                       ^~~~
                       main
cr2hdr.c:555:5: note: 'main' declared here
int main(int argc, char** argv)
    ^
cr2hdr.c:1510:22: error: invalid operands to binary expression ('double' and
      'int (*)(int, char **)')
    double a = 100.0 / gain;
               ~~~~~ ^ ~~~~
cr2hdr.c:1531:39: error: use of undeclared identifier 'gain'; did you mean
      'main'?
                int delta = b * 100 / gain - d;
                                      ^~~~
                                      main
cr2hdr.c:555:5: note: 'main' declared here
int main(int argc, char** argv)
    ^
cr2hdr.c:1531:37: error: invalid operands to binary expression ('int' and
      'int (*)(int, char **)')
                int delta = b * 100 / gain - d;
                            ~~~~~~~ ^ ~~~~
cr2hdr.c:1542:51: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist iso-curve.m"));
                                                  ^
cr2hdr.c:1542:51: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:1964:55: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist fullres-curve.m"));
                                                      ^
cr2hdr.c:1964:55: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:2295:56: warning: if statement has empty body [-Wempty-body]
            if(system("dcraw -d -r 1 1 1 1 edges.dng"));
                                                       ^
cr2hdr.c:2295:56: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:2308:59: warning: if statement has empty body [-Wempty-body]
            if(system("dcraw -d -r 1 1 1 1 edge-map.dng"));
                                                          ^
cr2hdr.c:2308:59: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:2333:45: error: expected ';' at end of declaration
                    int edge_interp(int dir)
                                            ^
                                            ;
cr2hdr.c:2352:53: error: use of undeclared identifier 'pi0'
                    interp[x   + y * w] = ev2raw[(2*pi0+pip+pim)/4];
                                                    ^
cr2hdr.c:2594:51: warning: if statement has empty body [-Wempty-body]
        if(system("octave --persist mix-curve.m"));
                                                  ^
cr2hdr.c:2594:51: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:3070:55: warning: if statement has empty body [-Wempty-body]
            if(system("octave --persist soft-film.m"));
                                                      ^
cr2hdr.c:3070:55: note: put the semicolon on a separate line to silence this
      warning
cr2hdr.c:3370:34: warning: if statement has empty body [-Wempty-body]
        if(system("octave wb.m"));
                                 ^
cr2hdr.c:3370:34: note: put the semicolon on a separate line to silence this
      warning
9 warnings and 7 errors generated.
make: *** [cr2hdr] Error 1

a1ex

clang does not support nested functions, so the only option is to refactor the code with a regular function (shouldn't be very hard).

kichetof

oh thanks a1ex for your reply! I do not understand why it did not worked! Thanks for explanation!

But .. I don't know how to make changes  :o I hope you can make something


New visual!

g3gg0

"Apple LLVM version 5.0 (clang-500.2.79)" != gcc :)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

kichetof

Okay I learned something! I believed with gcc -v that I had gcc ... apple apple apple.... :)

$ brew install gcc49

I'll try tomorrow!

Danne

Quote from: kichetof on May 04, 2014, 11:04:56 PM
oh thanks a1ex for your reply! I do not understand why it did not worked! Thanks for explanation!

But .. I don't know how to make changes  :o I hope you can make something


New visual!


I like it...

a1ex

I just tried to refactor the nested function, and got this:


diff -r 8b19cff1db59 modules/dual_iso/cr2hdr.c
--- a/modules/dual_iso/cr2hdr.c Mon May 05 09:53:19 2014 +0300
+++ b/modules/dual_iso/cr2hdr.c Mon May 05 10:06:45 2014 +0300
@@ -1828,6 +1828,30 @@
     return round(raw_adjusted + fast_randn05());
}

+struct xy { int x; int y; };
+
+struct edge_dir
+{
+    struct xy ack;      /* verification pixel near a */
+    struct xy a;        /* interpolation pixel from the nearby line: normally (0,s) but also (1,s) or (-1,s) */
+    struct xy b;        /* interpolation pixel from the other line: normally (0,-2s) but also (1,-2s), (-1,-2s), (2,-2s) or (-2,-2s) */
+    struct xy bck;      /* verification pixel near b */
+    /* note: all y coords should be multiplied by s */
+};
+
+static int edge_interp(int dir, int x, int y, float** plane, int* squeezed, const struct edge_dir edge_directions[], int s, int* raw2ev)
+{
+    int dxa = edge_directions[dir].a.x;
+    int dya = edge_directions[dir].a.y * s;
+    int pa = COERCE((int)plane[squeezed[y+dya]][x+dxa], 0, 0xFFFFF);
+    int dxb = edge_directions[dir].b.x;
+    int dyb = edge_directions[dir].b.y * s;
+    int pb = COERCE((int)plane[squeezed[y+dyb]][x+dxb], 0, 0xFFFFF);
+    int pi = (raw2ev[pa] * 2 + raw2ev[pb]) / 3;
+   
+    return pi;
+}
+
static int hdr_interpolate()
{
     int w = raw_info.width;
@@ -2174,15 +2198,7 @@
         #endif

         /* define edge directions for interpolation */
-        struct xy { int x; int y; };
-        const struct
-        {
-            struct xy ack;      /* verification pixel near a */
-            struct xy a;        /* interpolation pixel from the nearby line: normally (0,s) but also (1,s) or (-1,s) */
-            struct xy b;        /* interpolation pixel from the other line: normally (0,-2s) but also (1,-2s), (-1,-2s), (2,-2s) or (-2,-2s) */
-            struct xy bck;      /* verification pixel near b */
-        }
-        edge_directions[] = {       /* note: all y coords should be multiplied by s */
+        const struct edge_dir edge_directions[] = {
             //~ { {-6,2}, {-3,1}, { 6,-2}, { 9,-3} },     /* almost horizontal (little or no improvement) */
             { {-4,2}, {-2,1}, { 4,-2}, { 6,-3} },
             { {-3,2}, {-1,1}, { 3,-2}, { 4,-3} },
@@ -2374,24 +2390,12 @@

                     int dir = edge_direction[x + y*w];
                     
-                    int edge_interp(int dir)
-                    {
-                       
-                        int dxa = edge_directions[dir].a.x;
-                        int dya = edge_directions[dir].a.y * s;
-                        int pa = COERCE((int)plane[squeezed[y+dya]][x+dxa], 0, 0xFFFFF);
-                        int dxb = edge_directions[dir].b.x;
-                        int dyb = edge_directions[dir].b.y * s;
-                        int pb = COERCE((int)plane[squeezed[y+dyb]][x+dxb], 0, 0xFFFFF);
-                        int pi = (raw2ev[pa] * 2 + raw2ev[pb]) / 3;
-                       
-                        return pi;
-                    }
-                   
                     /* vary the interpolation direction and average the result (reduces aliasing) */
-                    int pi0 = edge_interp(dir);
-                    int pip = edge_interp(MIN(dir+1, COUNT(edge_directions)-1));
-                    int pim = edge_interp(MAX(dir-1,0));
+                    #define EDGE_INTERP(dir) edge_interp(dir, x, y, plane, squeezed, edge_directions, s, raw2ev)
+                    int pi0 = EDGE_INTERP(dir);
+                    int pip = EDGE_INTERP(MIN(dir+1, COUNT(edge_directions)-1));
+                    int pim = EDGE_INTERP(MAX(dir-1,0));
+                    #undef EDGE_INTERP
                     
                     interp[x   + y * w] = ev2raw[(2*pi0+pip+pim)/4];
                     native[x   + y * w] = raw_get_pixel32(x, y);


Quite ugly if you ask me, so if you can use gcc on mac, I would prefer to keep the nested function.

kichetof

Thanks a1ex for your works!
I don't have my mac on the hands, I'll try this evening. I'll try everything to compile with gcc so keep nested function!

Walter Schulz

Do you have half an hour and language skills beyond mine? First one may be tough, second one a no-brainer.
Please locate TranslatedStrings_en.txt inside your plug-in folder or here and give it a makeover. Get rid of those blanks at the end of sentences, change odd translation into proper english. In short: Create the text you want to read!

If you don't want to dive into Bitbucket you may post your results here.
If you got stuck with LR terminology: Take a look into "Export to harddisk" and feel free to follow your guts.
Or contact me by PM.

Ciao
Walter

PS: Native editors for other languages may just jump in.

Audionut

If I'm being picky.

Quote"$$$/ML/Dpendencies/Error=This plugin (cr2hdr) needs dcraw and exiftool.^n^nPlease install it before running this plugin"

Otherwise, it looks fine here.


edit:  This is better:  https://bitbucket.org/kichetof/lr_cr2hdr/pull-request/3/small-tweaks-to-english-translation/diff

kichetof

Thanks Audionut for your translation! I already merged :)

@a1ex & g3gg0 big thanks !

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.8.2/libexec/gcc/x86_64-apple-darwin13.1.0/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13.1.0
Configured with: ../configure --build=x86_64-apple-darwin13.1.0 --prefix=/usr/local/Cellar/gcc/4.8.2 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --enable-multilib
Thread model: posix
gcc version 4.8.2 (GCC)


make cr2hdr
REBUILDING
[ README   ]   module_strings.h
[ gcc      ]   cr2hdr
kelvin.c: In function 'adobe_coeff':
kelvin.c:314:25: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
           cam_xyz[0][j] = table[i].trans[j] / 10000.0;
                         ^
kelvin.c:313:9: note: containing loop
         for (j=0; j < 12; j++)
         ^


I've cr2hdr fully fonctionnal! Classic and 20bit versions!

@a1ex could you add a release status (or what you want) when you run cr2hdr for identified which is running (classic or 20bit) ?

Walter Schulz

@kichetof: Do you have some kind of time table/milestones in mind about 2.2RC/2.2 final? Having some ideas to discuss and not sure if it's a good idea to press them into 2.2 or scheduling them to a release after that.

Ciao
Walter