Files
ffmpeg/libavfilter/ocio_wrapper.hpp
Sam.Richards@taurich.org 677cf95ea4 Initial checkin of OCIO filter.
Initial checkin of OCIO filter.

Initial checkin of OCIO filter.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Change for the right C++ library, should work on linux too.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Adding inverse when using display/view.

Removed comments.

Removed code that was setting the CICP values. Hopefully this can be done through OCIO at some point.

Config cleanup - need a modified require_cpp to handle namespacing.

Switch to using require_cpp so that namespace can be used.

Adding documentation.

Sadly a bit of linting went in here, but more importantly added a threads option to split the image into horizontal tiles, since OCIO was running rather slow.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Adding context parameters.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Add the OCIO config parameter.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Make the min threads 1 for now, reserve 0 for later if we can automatically pick something.
Also added a few comments.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

This is using ffmpeg-slicing.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Adding OCIO filetransform.

Making sure everything is using av_log rather than std::cerr.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Updating the tests so they would work without additional files.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Adding the file-transform documentation.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Adding copyright/license info.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Removing tests, since this is optional code.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Code cleanup.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Typo.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

I went the wrong way, av_log is expecting \n

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Fix indenting to 4 spaces.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Fixing lint issues and a spelling mistake.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Code formatting cleanup to match conventions.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>

Whitespace removal.

Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>
2026-02-14 12:21:10 +00:00

73 lines
2.8 KiB
C++

/*
* Copyright (c) 2026 Sam Richards
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void *OCIOHandle;
// Create an OCIO processor for Display/View transform.
// Returns NULL on failure.
OCIOHandle ocio_create_display_view_processor(AVFilterContext *ctx,
const char *config_path,
const char *input_color_space,
const char *display,
const char *view, int inverse,
AVDictionary *params);
// Create an OCIO processor for output colorspace transform.
// Returns NULL on failure.
OCIOHandle
ocio_create_output_colorspace_processor(AVFilterContext *ctx,
const char *config_path,
const char *input_color_space,
const char *output_color_space,
AVDictionary *params);
// Create an OCIO processor for file transform.
// Returns NULL on failure.
OCIOHandle ocio_create_file_transform_processor(AVFilterContext *ctx,
const char *file_transform,
int inverse);
// Finalize OCIO processor for given bit depth.
// is_half_float: true for half-float, false for float
int ocio_finalize_processor(AVFilterContext *ctx, OCIOHandle handle, int input_format,
int output_format);
// Apply processor to planar float RGB(A).
// pixels: pointer to float samples
// w,h: image dimensions
// channels: 3 or 4
// stride_bytes: bytes between row starts (use 0 for tightly packed)
int ocio_apply(AVFilterContext *ctx, OCIOHandle handle, AVFrame *input_frame, AVFrame *output_frame,
int y_start, int height);
// Destroy OCIO processor.
void ocio_destroy_processor(AVFilterContext *ctx, OCIOHandle handle);
#ifdef __cplusplus
}
#endif