OpenShot Library | libopenshot 1.1.1
Loading...
Searching...
No Matches
FFmpegColorRange.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 OpenShot Studios, LLC
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include "FFmpegUtilities.h"
6
7// Normalize deprecated JPEG-range YUVJ formats before creating swscale contexts.
8// swscale expects non-YUVJ formats plus explicit color-range metadata.
9inline AVPixelFormat NormalizeDeprecatedPixFmt(AVPixelFormat pix_fmt, bool& is_full_range) {
10 switch (pix_fmt) {
11 case AV_PIX_FMT_YUVJ420P:
12 is_full_range = true;
13 return AV_PIX_FMT_YUV420P;
14 case AV_PIX_FMT_YUVJ422P:
15 is_full_range = true;
16 return AV_PIX_FMT_YUV422P;
17 case AV_PIX_FMT_YUVJ444P:
18 is_full_range = true;
19 return AV_PIX_FMT_YUV444P;
20 case AV_PIX_FMT_YUVJ440P:
21 is_full_range = true;
22 return AV_PIX_FMT_YUV440P;
23#ifdef AV_PIX_FMT_YUVJ411P
24 case AV_PIX_FMT_YUVJ411P:
25 is_full_range = true;
26 return AV_PIX_FMT_YUV411P;
27#endif
28 default:
29 return pix_fmt;
30 }
31}
AVPixelFormat NormalizeDeprecatedPixFmt(AVPixelFormat pix_fmt, bool &is_full_range)
Header file for FFmpegUtilities.