UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
aja_common.hpp
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2018-2024 CESNET
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, is permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * 3. Neither the name of CESNET nor the names of its contributors may be
21 * used to endorse or promote products derived from this software without
22 * specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
28 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#include <map>
39#include <ntv2enums.h>
40
41#include "types.h"
42
43class CNTV2Card;
44
45#ifdef _MSC_VER
46#define log_msg(x, ...) fprintf(stderr, __VA_ARGS__)
47#define bug_msg(x, ...) \
48 log_msg(x, __VA_ARGS__); \
49 log_msg(x, " Please report a bug if you reach here.\n")
50#define color_printf printf
51#undef LOG
52#include <iostream>
53#define LOG(level) if (level > log_level) ; else std::cerr
54#define col() std::cout
55#undef TUNDERLINE
56#define TUNDERLINE(x) x
57#undef SUNDERLINE
58#define SUNDERLINE(x) x
59#endif
60
61// compat
62#ifndef NTV2_AUDIOSIZE_MAX
63#define NTV2_AUDIOSIZE_MAX (401 * 1024)
64#endif
65
66namespace ultragrid {
67namespace aja {
68static const std::map<NTV2FrameBufferFormat, codec_t> codec_map = {
69 { NTV2_FBF_10BIT_YCBCR, v210 },
70 { NTV2_FBF_8BIT_YCBCR, UYVY },
71 { NTV2_FBF_ABGR, RGBA },
72 { NTV2_FBF_10BIT_DPX, R10k },
73 { NTV2_FBF_8BIT_YCBCR_YUY2, YUYV },
74 { NTV2_FBF_24BIT_RGB, RGB },
75 { NTV2_FBF_24BIT_BGR, BGR },
76 { NTV2_FBF_48BIT_RGB, RG48 },
77 { NTV2_FBF_12BIT_RGB_PACKED, R12L },
78};
79} // end of namespace aja
80} // end of namespace ultragrid
81
82#ifdef __cplusplus
83extern "C" {
84#endif
85
86void
87vc_copylineR12AtoR12L(unsigned char * __restrict dst, const unsigned char * __restrict src, int dstlen, int rshift,
88 int gshift, int bshift);
89void
90vc_copylineR12LtoR12A(unsigned char * __restrict dst, const unsigned char * __restrict src, int dstlen, int rshift,
91 int gshift, int bshift);
92
93void print_aja_device_details(CNTV2Card *device);
94
95#ifdef __cplusplus
96}
97#endif
void print_aja_device_details(CNTV2Card *device)
void vc_copylineR12AtoR12L(unsigned char *__restrict dst, const unsigned char *__restrict src, int dstlen, int rshift, int gshift, int bshift)
void vc_copylineR12LtoR12A(unsigned char *__restrict dst, const unsigned char *__restrict src, int dstlen, int rshift, int gshift, int bshift)
static const std::map< NTV2FrameBufferFormat, codec_t > codec_map
This file contains some common data types.
@ YUYV
YCbCr 422 8-bit - Y0 Cb Y1 Cr.
Definition types.h:72
@ R10k
RGB 10-bit packed - RGBX, big-endian (2 bit padding)
Definition types.h:73
@ RGB
RGB 8-bit (packed into 24-bit word)
Definition types.h:80
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
Definition types.h:71
@ BGR
8-bit BGR
Definition types.h:88
@ RG48
16-bit RGB little-endian (RlRhGl...)
Definition types.h:95
@ R12L
RGB 12-bit packed, little-endian.
Definition types.h:74
@ RGBA
RGBA 8-bit, big-endian.
Definition types.h:70
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
Definition types.h:75