Giter Site home page Giter Site logo

gopro / cineform-sdk Goto Github PK

View Code? Open in Web Editor NEW
273.0 94.0 56.0 14.18 MB

The GoPro® CineForm video codec SDK.

License: Apache License 2.0

CMake 0.35% C++ 14.32% C 77.52% Objective-C 0.13% Makefile 0.01% POV-Ray SDL 7.39% SourcePawn 0.28%
compression wavelet cineform wavelets sdk gopro

cineform-sdk's People

Contributors

0dan0 avatar 1480c1 avatar dnewman-gpsw avatar emericg avatar enpinion avatar mpiatka avatar ptran-gpfw avatar retokromer avatar tmatth avatar ylaala-gpsw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cineform-sdk's Issues

Memory leak caused by CFHD_PrepareToEncode (Windows only?)

There appears to be a memory leak when calling CFHD_PrepareToEncode. I've only tested on Windows 10.

I first observed this in some unit tests for my encoder (the unit test calls _CrtDumpMemoryLeaks), so to try and confirm the problem, I tried an infinite loop of creating an encoder, calling PrepareToEncode, and closing the encoder, to see how the process VM usage grows over time.

Using 8fd6bba from 'master' (9 Nov 21), build the solution with VS 2019 x64, and then insert the following at the very start of main() in TestCFHD.cpp

while (true)
{
    CFHD_EncoderRef enc = nullptr;
    CFHD_Error res = CFHD_OpenEncoder(&enc, nullptr);
    if (res != CFHD_ERROR_OKAY)
        return res;

    res = CFHD_PrepareToEncode(
        enc,
        320,
        160,
        CFHD_PIXEL_FORMAT_RG24,
        CFHD_ENCODED_FORMAT_YUV_422,
        CFHD_ENCODING_FLAGS_NONE,
        CFHD_ENCODING_QUALITY_DEFAULT);
    if (res != CFHD_ERROR_OKAY)
        return res;

    CFHD_CloseEncoder(enc);
}

Watch the process memory usage in something like Windows Task Manager.

The VM usage grows sharply with smaller resolutions (like 160x80, 320x160, etc) but much slower with higher resolutions.

image

Bayer format description

Hi! I've been trying to use the encoder with a bayer image. Other than the very vague description of "Raw Bayer 12-bits per component, packed line of 8-bit then line a 4-bit reminder" (CFHDTypes.h:145) I can't figure out what the format is.

Is it two pixels combined as two bytes of MSB then one byte containing the 4 bits LSB for the two?
Or is it MSB for all the pixels than LSB for all the pixels?
I've even tried one byte of MSB then one byte with the remaining 4 bits.

I've spent hours trying different formats and I'm always getting a cropped image with different parts overplayed in colors. Google doesn't turn up anything since this is a not a common thing.

Windows and MacOS compiled codec?

Hey Cineform Team,

Is there a guide available for installing the latest compile of Cineform so we can get playback in our native OS's?

Thanks,
Jonathan

Port to WebAssembly?

Has anyone tried to or contemplated porting the decoder to wasm for use in web browsers?

Crashes with odd image height in Stereo 3D

I have a bunch of files shot with a DSLR on a slider and converted to 2k CineForm 3D files. Due to the sensor size the 2k frames are 2048x1363. So this is an odd image height (not a multiple of two).

The decoder returns a Stereo 3D image when set to VIDEO_SELECT_BOTH_EYES and STEREO3D_TYPE_DEFAULT that is 2048x2728 (i.e. not 2048x2726 as one would expect) and has a black line (single pixel height) below each of the views/eyes.

Switching the Stereo 3D types to STEREO3D_TYPE_STACKED or STEREO3D_TYPE_FIELDS crashes the decoder. All other types work correctly (as long as I make the output buffer large enough to hold an extra scanline).

Availability of original C implementation

Hi, I'd like to ask if there are still any original C implementation codes available.

I'm currently working on multi-platform codes and revive cross-platform implementation of _PROCESSOR_DISPATCH feature for SIMD like SSE2, AVX2 and AVX-512 implementations for the future while keep the backwards compatibility.
And it seems some functions only have SSE2/MMX codes with no corresponding C implementation left. Maybe I could rewrite them in C but before doing this, I'd like to ask if they are available.

Regards.

inconsistent rgb/rgba behavior

I see different maximum values depending on requested decoding format.

decode to CFHD_PIXEL_FORMAT_BGRA:
result: r/g/b/a = 0xFF as expected

decode to CFHD_PIXEL_FORMAT_R210:
result: r/g/b = 0x3FC (expected 0x3FF)

decode to CFHD_PIXEL_FORMAT_B64A:
sample: CFHD_ENCODED_FORMAT_RGB_4444
result: r/g/b = 0xFF00, a = 0xFFFF (expected r/g/b 0xFFFF)
sample: CFHD_ENCODED_FORMAT_RGB_444
result: r/g/b = 0xFF00, a = 0xFFF0

Main issue is underscaled rgb, alpha seems ok where it is present.

Where are samples/documentation?

Hello,

I thought about integrating cineform into a toy project of mine which currently can just process image sequences through openimageio. I know oiio would even be able to do some stuff with video files, but my implementation is for frame sequences only at the moment.
Cineform seems like a nice intermediate codec and as I just realized a few days ago that DaVinci Resolve supports Cineform it would be nice to integrate it as working with large sequences of OpenEXR/tiff/dpx files is cumbersome. (Resolve for Linux is Cineform read only at the moment so I never saw it in the export and hadn't realized Resolve has at least some support for it.)

However, I'm unable to find a documentation for the use of Cineform either in the repository nor in the README and there is no usage sample. As I haven't found any other repository from gopro, is there any sample repository for the usage of cineform-sdk or a sample site?
I saw some mentions about some docu/samples from the times before cineform-sdk was open source somewhere. Are those available?

VCPKG integration

Hi,

is there any plan to integrate your SDK into vckpg install manager?

Building on Debian Jessie

I was able to successfully build this project on Debian Jessie with a couple of notes.

First, it is necessary to install cmake through jessie-backports to ensure you are on 3.5.1+

Second, I had to edit Example/TestCFHD.cpp line 497 from:

else sprintf_s(restxt, sizeof(restxt), "THUM");

to:

else sprintf(restxt, "THUM");

as "sprintf_s" is apparently not a standard c/c++ function, but sprintf will work with a change in parameters.

No code path to encode with optimised COLOR_FORMAT_BYR3 bayer color format

Looking at the code, the COLOR_FORMAT_BYR3 has a fast path which is by default enabled with the 'FAST_BYR3' define (encoder.c:119).
However, there is no exposed CFHD pixel format to use that code path.
There is a CFHD_PIXEL_FORMAT_BYR4 and a CFHD_PIXEL_FORMAT_BYR5 which map to COLOR_FORMAT_BYR4 and COLOR_FORMAT_BYR5 respectively but nothing for COLOR_FORMAT_BYR3 :(.

Is this an incomplete code optimisation which can't be used or have I misunderstood something?

multi-threaded encoder generates different output than single-threaded

I noticed some pattern, therefore looks suspicious.
Encoding constant input (repeated still frame)
single-threaded encoder output:
A,B,C,C,C,...
multi-threaded (2 threads):
A,A,B,B,C,C,C,...
multi-threaded (4 threads):
A,A,A,A,B,B,B,B,C,C,C,...
So is the output affected by some internal state in CSampleEncoder? Should this happen? Should this state be shared in encoders pool?
Decoded differences are somewhere 1-bit high.

Is there a working codec that can be installed on Win10 for viewing files?

After a couple years, i'm trying to view some old HD footage with cineform compression, but don't have the codec. Is this codec available any more so I can simply view/transcode my old cineform avi files? I can't get past the no-longer-supported license key step when trying to install the old version of neo3d I have archived. Any help would be appreciated, thanks!

LUTPaths: when is it used/useful?

There is some weirdness here (hardcoded fully qualified path)

TCHAR defaultLUTpath[260] = "C:\\Program Files\\Common Files\\CineForm\\LUTs";

and here

TCHAR defaultLUTpath[260] = "C:\\Program Files\\Common Files\\CineForm\\LUTs";

Is this actually executed at some point?
Also there are registry access, system variable access etc. Is it a convention shared between all CineForm-enabled programs? Which programs create these registry keys and lut files?

aborting cleanly

First of all, thanks for releasing this to the community!

I've got the encoding working OK. I have 1 input thread submitting input samples by calling CFHD_EncodeAsyncSample(), and another output thread getting output samples by calling CFHD_WaitForSample(). Both of these functions (and therefore the threads) can block.

Perhaps I've missed something, but I can't find a way to cleanly abort if, for example, the user wants to prematurely cancel the encoding. At the moment of abort, either of the threads may be blocked. I've found that in a third thread I can call CFHD_ReleaseEncoderPool() - that unblocks both threads but with an exception, so this is obviously a dirty way of doing this that might leave the heap in a mess or a memory leak.

Is there a way of aborting cleanly, or just forcing CFHD_EncodeAsyncSample() and CFHD_WaitForSample() to unblock cleanly ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.