drivers/gpu/ipu-v3/ipu-ic-csc.c

Source file repositories/reference/linux-study-clean/drivers/gpu/ipu-v3/ipu-ic-csc.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/ipu-v3/ipu-ic-csc.c
Extension
.c
Size
9097 bytes
Lines
410
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2019 Mentor Graphics Inc.
 */

#include <linux/types.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/sizes.h>
#include "ipu-prv.h"

#define QUANT_MAP(q)					\
	((q) == V4L2_QUANTIZATION_FULL_RANGE ||		\
	 (q) == V4L2_QUANTIZATION_DEFAULT ? 0 : 1)

/* identity matrix */
static const struct ipu_ic_csc_params identity = {
	.coeff = {
		{  128,    0,    0, },
		{    0,  128,    0, },
		{    0,    0,  128, },
	},
	.offset = { 0, 0, 0, },
	.scale = 2,
};

/*
 * RGB full-range to RGB limited-range
 *
 * R_lim = 0.8588 * R_full + 16
 * G_lim = 0.8588 * G_full + 16
 * B_lim = 0.8588 * B_full + 16
 */
static const struct ipu_ic_csc_params rgbf2rgbl = {
	.coeff = {
		{  220,    0,    0, },
		{    0,  220,    0, },
		{    0,    0,  220, },
	},
	.offset = { 64, 64, 64, },
	.scale = 1,
};

/*
 * RGB limited-range to RGB full-range
 *
 * R_full = 1.1644 * (R_lim - 16)
 * G_full = 1.1644 * (G_lim - 16)
 * B_full = 1.1644 * (B_lim - 16)
 */
static const struct ipu_ic_csc_params rgbl2rgbf = {
	.coeff = {
		{  149,    0,    0, },
		{    0,  149,    0, },
		{    0,    0,  149, },
	},
	.offset = { -37, -37, -37, },
	.scale = 2,
};

/*
 * YUV full-range to YUV limited-range
 *
 * Y_lim  = 0.8588 * Y_full + 16
 * Cb_lim = 0.8784 * (Cb_full - 128) + 128
 * Cr_lim = 0.8784 * (Cr_full - 128) + 128
 */
static const struct ipu_ic_csc_params yuvf2yuvl = {
	.coeff = {
		{  220,    0,    0, },
		{    0,  225,    0, },
		{    0,    0,  225, },
	},
	.offset = { 64, 62, 62, },
	.scale = 1,
	.sat = true,
};

/*
 * YUV limited-range to YUV full-range
 *
 * Y_full  = 1.1644 * (Y_lim - 16)
 * Cb_full = 1.1384 * (Cb_lim - 128) + 128
 * Cr_full = 1.1384 * (Cr_lim - 128) + 128
 */
static const struct ipu_ic_csc_params yuvl2yuvf = {
	.coeff = {
		{  149,    0,    0, },
		{    0,  146,    0, },

Annotation

Implementation Notes