MlRawViewer 1.3.3 (CDNG/MLV/RAW Viewer & Encoder, Linux/Mac/Win)

Started by baldand, December 09, 2013, 06:10:19 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

a1ex

@baldand: you can take the AMaZE code from cr2hdr (it's already tweaked to compile as standalone C object).

If you make it export high-quality data (where I'm sure AMaZE is very hard to beat), I'll want my modified soft film curve from ufraw :D

ItsMeLenny

Quote from: a1ex on December 14, 2013, 12:45:48 PM
I'll want my modified soft film curve from ufraw :D

And I'll want a no curve :P But highlight clipping will be needed.


In fact; I like what your curve does, just viewing your examples. Canons picture styles do the opposite, which is what I don't like.

baldand

Ok, AMaZE is in.

It's now used to display frames when paused, or during playback if explicitly turned on with the Q key.

I will try to add encoding output next (which will also use AMaZE).

a1ex

Looks great, no artifacts at all! Only one little problem: the image is pitch black.

The progress bar does get slower, and CPU usage jumps to around 90%, so I guess it's trying to do something.

baldand

I would take a wild guess that this is texture-upload related again.

The output from the CPU demosaicing is floating point, so we need to be able to upload in RGB float format to an RGB texture (instead of 16 bit uint as with bayer data).

Looking again at the patches you made, was the conclusion that your Intel GPU doesn't support floating point textures at all?



a1ex

Yes, it seems so. I should probably rescale the data somehow, but with previous code I didn't have to do any conversion (it just worked).

baldand

Ok, let me try and rework it to support this setup.

baldand

I just pushed a change to remove the need for uploading float textures in the CPU demosaicing case.

It means doing a little more work in the CPU-side, but should work now in more environments.

ItsMeLenny

Wow, the amaze works great, my videos are only small 640x320 and similar sizes, but I can really see the difference.

I am getting some artifacts though. Bright purple lines and similar in some places.

tin2tin

Would it be possible to use this to compile it for the various platforms?
http://www.pyinstaller.org/

g3gg0

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!

ItsMeLenny

Quote from: tin2tin on December 15, 2013, 01:47:16 AM
Would it be possible to use this to compile it for the various platforms?
http://www.pyinstaller.org/

I would think it would be. py2exe for windows, py2app for mac, and I think most linux users would just run it from the python files.

The best option would most probably be cx-freeze, for all platforms http://cx-freeze.sourceforge.net/


What am I saying >_<

It only runs on linux afaik.

Edit: Yeah, just tried windows, failed:
Microsoft Windows XP [Version 5.1.2600]
C:\Documents and Settings\Cosmo\Desktop\mlrawviewer>python -B mlrawviewer.py "c:
\Documents and Settings\Cosmo\Desktop\M14-2120.MLV"
MlRawViewer v1.0.1
(c) Andrew Baldwin & contributors 2013
Falling back to Numpy for bit unpacking operations.
Consider compiling bitunpack module for faster conversion and export.
Opening MLV file c:\Documents and Settings\Cosmo\Desktop\M14-2120.MLV
Black level: 2048
Traceback (most recent call last):
  File "mlrawviewer.py", line 307, in <module>
    sys.exit(main())
  File "mlrawviewer.py", line 302, in main
    rmc = Viewer(r)
  File "mlrawviewer.py", line 182, in __init__
    super(Viewer,self).__init__(width=userWidth,height=int(userWidth*self.vidAsp
ect),**kwds)
  File "C:\Documents and Settings\Cosmo\Desktop\mlrawviewer\GLCompute.py", line
183, in __init__
    glutInit(sys.argv)
  File "C:\Python27\lib\site-packages\OpenGL\GLUT\special.py", line 324, in glut
Init
    _base_glutInit( ctypes.byref(count), holder )
TypeError: 'NoneType' object is not callable

baldand

No, it does work on Windows. But getting it working needs a few steps.

First, I can't say anything about Windows 8 as I haven't used it at all. But I know that there have been problems with OpenGL based apps there. So Windows 8 might be out unless you know you have working OpenGL.

However, I just tested the latest code on an ACER Aspire One 522 with AMD C-50 & integrated Radeon 6250 with Win7 whatever version it came with - 32bit, limited to 2Gbytes of RAM(!??!)

I used WinPython 2.7.5.3 https://code.google.com/p/winpython/downloads/detail?name=WinPython-32bit-2.7.5.3.exe

I had to add the included mingw to the path, e.g.:

set PATH=C:\WinPython-32bit-2.7.5.3\tools\mingw32\bin;%PATH%

Then (from the mlrawviewer direcory) I built the bitunpack module:

\WinPython-32bit-2.7.5.3\python-2.7.5\python.exe setup.py build_ext -c mingw32 --inplace

Finally I ran it:

\WinPython-32bit-2.7.5.3\python-2.7.5\python.exe mlrawviewer.py \Users\andrew\Downloads\mlr\M15-1647.RAW

The video comes up and plays. I can navigate with cursor keys, change brightness, fullscreen with TAB.

But I also had some problems which would need investigating by someone -> it crashed whenever it tried to use AMaZE. Which means pausing, or Q button.


ItsMeLenny

ah. I was using win XP 32 bit for the record.
I don't know why it didn't work then.
I might investigate further, but considering my machine is linux.

a1ex

I need one more little change:

diff --git a/GLCompute.py b/GLCompute.py
index 811afb7..4e6601a 100755
--- a/GLCompute.py
+++ b/GLCompute.py
@@ -86,7 +86,8 @@ class Texture:
             try: glTexImage2D(GL_TEXTURE_2D,0,GL_R16,self.width,self.height,0,GL_RED,GL_UNSIGNED_SHORT,rgbadata)
             except GLError: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB16,self.width,self.height,0,GL_RED,GL_UNSIGNED_SHORT,rgbadata)
         elif not mono and sixteen:
-            glTexImage2D(GL_TEXTURE_2D,0,GL_RGB32F,self.width,self.height,0,GL_RGB,GL_UNSIGNED_SHORT,rgbadata)
+            try: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB32F,self.width,self.height,0,GL_RGB,GL_UNSIGNED_SHORT,rgbadata)
+            except GLError: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB16,self.width,self.height,0,GL_RGB,GL_UNSIGNED_SHORT,rgbadata)
         else:
             glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,self.width,self.height,0,GL_RGB,GL_UNSIGNED_BYTE,rgbadata)
         if mipmap:


Now it works; you can see it's changing the algorithm if you open a dual ISO movie :)

baldand

Ok, I applied the patch. Glad to hear it is working now.

(Proper Dual ISO playback support would be great, even if I would never be able to make use of it with my 7D... sob)


tin2tin

I can test an exe on win 8 if you can provide one?

baldand

Quote from: tin2tin on December 15, 2013, 10:31:27 AM
I can test an exe on win 8 if you can provide one?

Thanks. I will take closer look at pyinstaller soon for Win/Mac packaging. Of course it might be good if you or another Win8 user could try it first with https://code.google.com/p/winpython/ to see does it even work.

I just pushed a fix for the crash on Windows+mingw32 with CPU demosaicing. For me the current tip is now working fine on Win7.

I will try also with Mac tomorrow to see if there are any new problems there (it was working earlier).

Danne



baldand

I added encoding to ProRes using ffmpeg. It needs a newish versions of ffmpeg for that to work. Only tested on Linux so far.

To use it, optionally add an output name as a 2nd command line argument.
Then adjust the white balance and brightness, find the starting frame, and press "E".
To end encoding, press "E" again.
It will also stop automatically at the end of the file.

ItsMeLenny

Quote from: baldand on December 15, 2013, 09:43:34 PM
I added encoding to ProRes using ffmpeg. It needs a newish versions of ffmpeg for that to work. Only tested on Linux so far.

Yeah "broken pipe" for me. Do note that I'm using avconv, which the ffmpeg command just references avconv.
Must need a newer ffmpeg for the codec, as I got; Unknown encoder 'prores_ks'

baldand

I pushed a small change now so it will use an ffmpeg in the same directory as the script in preference to one on the path.

I strongly recommend downloading a suitable static binary from one of the links on http://www.ffmpeg.org/download.html and putting it to the same directory as mlrawviewer.py

That's what I did in order to get a version which could encode 10bit 444 ProRes.

baldand

Mac update: I just tested the latest version on Mac and it can be made to work with small changes.

I know these steps are not suitable for all Mac users, but maybe an installable package will come later as a result of this.

I used OSX Mavericks with the system python. Assuming you have git and the command line compiler....clone the source code.

Install pyOpenGL like this:

sudo easy_install pip && sudo pip install pyOpenGL

You should already have numpy installed (I did, and I hadn't installed it myself).

Then you need to edit setup.py to remove the 2 openmp references. Clang does not yet support openmp (maybe there is a way to use gcc instead and hence get openmp and faster CPU demosaicing - I'm not sure).

Then:

python setup.py build
ln -s build/lib.macosx-10.9-intel-2.7/bitunpack.so .


Download ffmpeg static binary from http://www.evermeet.cx/ffmpeg/ and:

7z x ffmpeg-2.1.1.7z

(if you need 7z, use homebrew and "brew install p7zip")

Finally from the source dir:

python mlrawviewer.py /Volumes/RAWVIDEOS/M01-2345.MLV MyEncodedFilm.MOV

I was able to encode a ProRes MOV and play it back fine with Quicktime.


ItsMeLenny

Quote from: baldand on December 16, 2013, 07:23:02 AM
I pushed a small change now so it will use an ffmpeg in the same directory as the script in preference to one on the path.
That's a good idea. There are plenty of static daily builds around.

http://ffmpeg.gusari.org/static/