Skip to content

Commit

Permalink
argb, abgrからの変換に対応。
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Aug 11, 2024
1 parent 28021fe commit d265c55
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 84 deletions.
10 changes: 10 additions & 0 deletions NVEncCore/convert_csp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ void convert_rgb32_to_rgba_sse2(void **dst, const void **src, int width, int src
void convert_bgr32_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);
void convert_rgb32r_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);

void convert_argb32_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);
void convert_abgr32_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);
void convert_argb32_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);
void convert_abgr32_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);

void convert_gbr_to_rgb24_ssse3(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);
void convert_gbr_to_rgb32_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop);

Expand Down Expand Up @@ -2177,6 +2182,11 @@ static const ConvertCSP funcList[] = {
FUNC_SSE( RGY_CSP_RGB32, RGY_CSP_RGBA, false, convert_rgb32_to_rgba_sse2, convert_rgb32_to_rgba_sse2, SSE2 )
FUNC_SSE( RGY_CSP_BGR32, RGY_CSP_RGBA, false, convert_bgr32_to_rgba_sse2, convert_bgr32_to_rgba_sse2, SSE2 )
FUNC_SSE( RGY_CSP_RGB32R, RGY_CSP_RGBA, false, convert_rgb32r_to_rgba_sse2, convert_rgb32r_to_rgba_sse2, SSE2 )

FUNC_SSE( RGY_CSP_ARGB32, RGY_CSP_RGB, false, convert_argb32_to_rgb_sse2, convert_argb32_to_rgb_sse2, SSE2 )
FUNC_SSE( RGY_CSP_ABGR32, RGY_CSP_RGB, false, convert_abgr32_to_rgb_sse2, convert_abgr32_to_rgb_sse2, SSE2 )
FUNC_SSE( RGY_CSP_ARGB32, RGY_CSP_RGBA, false, convert_argb32_to_rgba_sse2, convert_argb32_to_rgba_sse2, SSE2 )
FUNC_SSE( RGY_CSP_ABGR32, RGY_CSP_RGBA, false, convert_abgr32_to_rgba_sse2, convert_abgr32_to_rgba_sse2, SSE2 )

#if ENABLE_AVSW_READER || ENABLE_AVI_READER || ENABLE_AVISYNTH_READER || ENABLE_VAPOURSYNTH_READER || ENABLE_AVI_READER || ENABLE_RAW_READER
FUNC_SSE( RGY_CSP_GBR, RGY_CSP_RGB24, false, convert_gbr_to_rgb24_ssse3, convert_gbr_to_rgb24_ssse3, SSSE3|SSE2)
Expand Down
14 changes: 14 additions & 0 deletions NVEncCore/convert_csp.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ enum RGY_CSP {
RGY_CSP_RGB32, //packed
RGY_CSP_BGR24, //packed
RGY_CSP_BGR32, //packed
RGY_CSP_ARGB32, //packed
RGY_CSP_ABGR32, //packed
RGY_CSP_RGBA_FP16_P, //packed
RGY_CSP_RGB, //planar
RGY_CSP_RGBA, //planar
Expand Down Expand Up @@ -191,6 +193,8 @@ static const TCHAR *RGY_CSP_NAMES[] = {
_T("rgb32"),
_T("bgr24"),
_T("bgr32"),
_T("argb32"),
_T("abgr32"),
_T("rgba(fp16)"),
_T("rgb"),
_T("rgba"),
Expand Down Expand Up @@ -265,6 +269,8 @@ static const uint8_t RGY_CSP_BIT_DEPTH[] = {
8, //RGY_CSP_RGB32
8, //RGY_CSP_BGR24
8, //RGY_CSP_BGR32
8, //RGY_CSP_ARGB32
8, //RGY_CSP_ABGR32
16, //RGY_CSP_RGBA_FP16_P
8, //RGY_CSP_RGB
8, //RGY_CSP_RGBA
Expand Down Expand Up @@ -349,6 +355,8 @@ static const RGY_DATA_TYPE RGY_CSP_DATA_TYPE[] = {
RGY_DATA_TYPE_U8, //RGY_CSP_RGB32
RGY_DATA_TYPE_U8, //RGY_CSP_BGR24
RGY_DATA_TYPE_U8, //RGY_CSP_BGR32
RGY_DATA_TYPE_U8, //RGY_CSP_ARGB32
RGY_DATA_TYPE_U8, //RGY_CSP_ABGR32
RGY_DATA_TYPE_FP16, //RGY_CSP_RGBA_FP16_P
RGY_DATA_TYPE_U8, //RGY_CSP_RGB
RGY_DATA_TYPE_U8, //RGY_CSP_RGBA
Expand Down Expand Up @@ -430,6 +438,8 @@ static const uint8_t RGY_CSP_PLANES[] = {
1, //RGY_CSP_RGB32
1, //RGY_CSP_BGR24
1, //RGY_CSP_BGR32
1, //RGY_CSP_ARGB32
1, //RGY_CSP_ABGR32
1, //RGY_CSP_RGBA_FP16_P
3, //RGY_CSP_RGB
4, //RGY_CSP_RGBA
Expand Down Expand Up @@ -564,6 +574,8 @@ static const RGY_CHROMAFMT RGY_CSP_CHROMA_FORMAT[] = {
RGY_CHROMAFMT_RGB_PACKED,
RGY_CHROMAFMT_RGB_PACKED,
RGY_CHROMAFMT_RGB_PACKED,
RGY_CHROMAFMT_RGB_PACKED, //RGY_CSP_ARGB32
RGY_CHROMAFMT_RGB_PACKED, //RGY_CSP_ABGR32
RGY_CHROMAFMT_RGB_PACKED, //RGY_CSP_RGBA_FP16_P
RGY_CHROMAFMT_RGB,
RGY_CHROMAFMT_RGB,
Expand Down Expand Up @@ -638,6 +650,8 @@ static const uint8_t RGY_CSP_BIT_PER_PIXEL[] = {
32, //RGY_CSP_RGB32
24, //RGY_CSP_BGR24
32, //RGY_CSP_BGR32
32, //RGY_CSP_ARGB32
32, //RGY_CSP_ABGR32
64, //RGY_CSP_RGBA_FP16_P
24, //RGY_CSP_RGB
32, //RGY_CSP_RGBA
Expand Down
97 changes: 16 additions & 81 deletions NVEncCore/convert_csp_simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,86 +615,21 @@ static void RGY_FORCEINLINE convert_rgb_to_rgb24_simd(void **dst, const void **s
}
#endif

template<uint32_t plane_from, bool source_reverse>
static void RGY_FORCEINLINE convert_rgb32_to_rgb_simd(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
const int crop_left = crop[0];
const int crop_up = crop[1];
const int crop_right = crop[2];
const int crop_bottom = crop[3];
const auto y_range = thread_y_range(crop_up, height - crop_bottom, thread_id, thread_n);
uint8_t *dst0Line = (uint8_t *)dst[(plane_from >> 0) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst1Line = (uint8_t *)dst[(plane_from >> 8) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst2Line = (uint8_t *)dst[(plane_from >> 16) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *srcLine = (uint8_t *)src[0] + src_y_pitch_byte * ((source_reverse) ? (height - crop_bottom - y_range.start_src - 1) : y_range.start_src) + crop_left * 4;
__m128i xMask = _mm_set1_epi16(0xff);
if (source_reverse) {
src_y_pitch_byte = -1 * src_y_pitch_byte;
}
for (int y = 0; y < y_range.len; y++, srcLine += src_y_pitch_byte, dst0Line += dst_y_pitch_byte, dst1Line += dst_y_pitch_byte, dst2Line += dst_y_pitch_byte) {
uint8_t *ptr_src = srcLine;
uint8_t *ptr_dst0 = dst0Line;
uint8_t *ptr_dst1 = dst1Line;
uint8_t *ptr_dst2 = dst2Line;
int x = 0, x_fin = width - crop_left - crop_right - 16;
for (; x < x_fin; x += 16, ptr_src += 64, ptr_dst0 += 16, ptr_dst1 += 16, ptr_dst2 += 16) {
__m128i xSrc0 = _mm_loadu_si128((__m128i *)(ptr_src + 0));
__m128i xSrc1 = _mm_loadu_si128((__m128i *)(ptr_src + 16));
__m128i xSrc2 = _mm_loadu_si128((__m128i *)(ptr_src + 32));
__m128i xSrc3 = _mm_loadu_si128((__m128i *)(ptr_src + 48));

__m128i x02_0 = _mm_packus_epi16(_mm_and_si128(xMask, xSrc0), _mm_and_si128(xMask, xSrc1));
__m128i x02_1 = _mm_packus_epi16(_mm_and_si128(xMask, xSrc2), _mm_and_si128(xMask, xSrc3));
__m128i x13_0 = _mm_packus_epi16(_mm_srli_epi16(xSrc0, 8), _mm_srli_epi16(xSrc1, 8));
__m128i x13_1 = _mm_packus_epi16(_mm_srli_epi16(xSrc2, 8), _mm_srli_epi16(xSrc3, 8));

__m128i x0 = _mm_packus_epi16(_mm_and_si128(xMask, x02_0), _mm_and_si128(xMask, x02_1));
__m128i x1 = _mm_packus_epi16(_mm_and_si128(xMask, x13_0), _mm_and_si128(xMask, x13_1));
__m128i x2 = _mm_packus_epi16(_mm_srli_epi16(x02_0, 8), _mm_srli_epi16(x02_1, 8));
//__m128i x3 = _mm_packus_epi16(_mm_srli_epi16(x13_0, 8), _mm_srli_epi16(x13_1, 8));

_mm_storeu_si128((__m128i *)ptr_dst0, x0);
_mm_storeu_si128((__m128i *)ptr_dst1, x1);
_mm_storeu_si128((__m128i *)ptr_dst2, x2);
}
if (width & 15) {
int x_offset = (16 - (width & 15));
ptr_src -= x_offset * 3;
ptr_dst0 -= x_offset;
ptr_dst1 -= x_offset;
ptr_dst2 -= x_offset;
}
__m128i xSrc0 = _mm_loadu_si128((__m128i *)(ptr_src + 0));
__m128i xSrc1 = _mm_loadu_si128((__m128i *)(ptr_src + 16));
__m128i xSrc2 = _mm_loadu_si128((__m128i *)(ptr_src + 32));
__m128i xSrc3 = _mm_loadu_si128((__m128i *)(ptr_src + 48));

__m128i x02_0 = _mm_packus_epi16(_mm_and_si128(xMask, xSrc0), _mm_and_si128(xMask, xSrc1));
__m128i x02_1 = _mm_packus_epi16(_mm_and_si128(xMask, xSrc2), _mm_and_si128(xMask, xSrc3));
__m128i x13_0 = _mm_packus_epi16(_mm_srli_epi16(xSrc0, 8), _mm_srli_epi16(xSrc1, 8));
__m128i x13_1 = _mm_packus_epi16(_mm_srli_epi16(xSrc2, 8), _mm_srli_epi16(xSrc3, 8));

__m128i x0 = _mm_packus_epi16(_mm_and_si128(xMask, x02_0), _mm_and_si128(xMask, x02_1));
__m128i x1 = _mm_packus_epi16(_mm_and_si128(xMask, x13_0), _mm_and_si128(xMask, x13_1));
__m128i x2 = _mm_packus_epi16(_mm_srli_epi16(x02_0, 8), _mm_srli_epi16(x02_1, 8));
//__m128i x3 = _mm_packus_epi16(_mm_srli_epi16(x13_0), 8), _mm_srli_epi16(x13_1), 8));

_mm_storeu_si128((__m128i *)ptr_dst0, x0);
_mm_storeu_si128((__m128i *)ptr_dst1, x1);
_mm_storeu_si128((__m128i *)ptr_dst2, x2);
}
}

template<uint32_t plane_from, bool source_reverse>
static void RGY_FORCEINLINE convert_rgb32_to_rgba_simd(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
const int crop_left = crop[0];
const int crop_up = crop[1];
const int crop_right = crop[2];
const int crop_bottom = crop[3];
const auto y_range = thread_y_range(crop_up, height - crop_bottom, thread_id, thread_n);
uint8_t *dst0Line = (uint8_t *)dst[(plane_from >> 0) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst1Line = (uint8_t *)dst[(plane_from >> 8) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst2Line = (uint8_t *)dst[(plane_from >> 16) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst3Line = (uint8_t *)dst[(plane_from >> 24) & 0xff] + dst_y_pitch_byte * y_range.start_dst;
constexpr auto plane_from0 = (plane_from >> 0) & 0xff;
constexpr auto plane_from1 = (plane_from >> 8) & 0xff;
constexpr auto plane_from2 = (plane_from >> 16) & 0xff;
constexpr auto plane_from3 = (plane_from >> 24) & 0xff;
uint8_t *dst0Line = (plane_from0 == 0xff) ? nullptr : (uint8_t *)dst[plane_from0] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst1Line = (plane_from1 == 0xff) ? nullptr : (uint8_t *)dst[plane_from1] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst2Line = (plane_from2 == 0xff) ? nullptr : (uint8_t *)dst[plane_from2] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *dst3Line = (plane_from3 == 0xff) ? nullptr : (uint8_t *)dst[plane_from3] + dst_y_pitch_byte * y_range.start_dst;
uint8_t *srcLine = (uint8_t *)src[0] + src_y_pitch_byte * ((source_reverse) ? (height - crop_bottom - y_range.start_src - 1) : y_range.start_src) + crop_left * 4;
__m128i xMask = _mm_set1_epi16(0xff);
if (source_reverse) {
Expand Down Expand Up @@ -723,10 +658,10 @@ static void RGY_FORCEINLINE convert_rgb32_to_rgba_simd(void **dst, const void **
__m128i x2 = _mm_packus_epi16(_mm_srli_epi16(x02_0, 8), _mm_srli_epi16(x02_1, 8));
__m128i x3 = _mm_packus_epi16(_mm_srli_epi16(x13_0, 8), _mm_srli_epi16(x13_1, 8));

_mm_storeu_si128((__m128i *)ptr_dst0, x0);
_mm_storeu_si128((__m128i *)ptr_dst1, x1);
_mm_storeu_si128((__m128i *)ptr_dst2, x2);
_mm_storeu_si128((__m128i *)ptr_dst3, x2);
if constexpr (plane_from0 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst0, x0);
if constexpr (plane_from1 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst1, x1);
if constexpr (plane_from2 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst2, x2);
if constexpr (plane_from3 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst3, x2);
}
if (width & 15) {
int x_offset = (16 - (width & 15));
Expand All @@ -751,10 +686,10 @@ static void RGY_FORCEINLINE convert_rgb32_to_rgba_simd(void **dst, const void **
__m128i x2 = _mm_packus_epi16(_mm_srli_epi16(x02_0, 8), _mm_srli_epi16(x02_1, 8));
__m128i x3 = _mm_packus_epi16(_mm_srli_epi16(x13_0, 8), _mm_srli_epi16(x13_1, 8));

_mm_storeu_si128((__m128i *)ptr_dst0, x0);
_mm_storeu_si128((__m128i *)ptr_dst1, x1);
_mm_storeu_si128((__m128i *)ptr_dst2, x2);
_mm_storeu_si128((__m128i *)ptr_dst3, x3);
if constexpr (plane_from0 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst0, x0);
if constexpr (plane_from1 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst1, x1);
if constexpr (plane_from2 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst2, x2);
if constexpr (plane_from3 != 0xff) _mm_storeu_si128((__m128i *)ptr_dst3, x3);
}
}

Expand Down
22 changes: 19 additions & 3 deletions NVEncCore/convert_csp_sse2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,27 @@ void convert_gbr_to_rgb32_sse2(void **dst, const void **src, int width, int src_
}

void convert_rgb32_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgb_simd<RGB_PLANE(2, 1, 0, -1), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
convert_rgb32_to_rgba_simd<RGB_PLANE(2, 1, 0, -1), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_bgr32_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgb_simd<RGB_PLANE(0, 1, 2, -1), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
convert_rgb32_to_rgba_simd<RGB_PLANE(0, 1, 2, -1), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_argb32_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgba_simd<RGB_PLANE(-1, 0, 1, 2), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_abgr32_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgba_simd<RGB_PLANE(-1, 2, 1, 0), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_argb32_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgba_simd<RGB_PLANE(3, 0, 1, 2), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_abgr32_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgba_simd<RGB_PLANE(3, 2, 1, 0), false>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_rgb32_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
Expand All @@ -80,7 +96,7 @@ void convert_bgr32_to_rgba_sse2(void **dst, const void **src, int width, int src
}

void convert_rgb32r_to_rgb_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
convert_rgb32_to_rgb_simd<RGB_PLANE(2, 1, 0, -1), true>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
convert_rgb32_to_rgba_simd<RGB_PLANE(2, 1, 0, -1), true>(dst, src, width, src_y_pitch_byte, src_uv_pitch_byte, dst_y_pitch_byte, height, dst_height, thread_id, thread_n, crop);
}

void convert_rgb32r_to_rgba_sse2(void **dst, const void **src, int width, int src_y_pitch_byte, int src_uv_pitch_byte, int dst_y_pitch_byte, int height, int dst_height, int thread_id, int thread_n, int *crop) {
Expand Down
2 changes: 2 additions & 0 deletions NVEncCore/rgy_avutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,8 @@ static const auto CSP_PIXFMT_RGY = make_array<std::pair<AVPixelFormat, RGY_CSP>>
std::make_pair(AV_PIX_FMT_RGBA, RGY_CSP_RGB32),
std::make_pair(AV_PIX_FMT_BGR24, RGY_CSP_BGR24),
std::make_pair(AV_PIX_FMT_BGRA, RGY_CSP_BGR32),
std::make_pair(AV_PIX_FMT_ARGB, RGY_CSP_ARGB32),
std::make_pair(AV_PIX_FMT_ABGR, RGY_CSP_ABGR32),
std::make_pair(AV_PIX_FMT_GBRP, RGY_CSP_GBR),
std::make_pair(AV_PIX_FMT_GBRAP, RGY_CSP_GBRA)
);
Expand Down
2 changes: 2 additions & 0 deletions NVEncCore/rgy_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ RGY_ERR RGYSysFrame::allocate(const RGYFrameInfo &info) {
case RGY_CSP_RGB32R:
case RGY_CSP_RGB32:
case RGY_CSP_BGR32:
case RGY_CSP_ARGB32:
case RGY_CSP_ABGR32:
case RGY_CSP_RGBA_FP16_P:
pixsize *= 4;
break;
Expand Down
2 changes: 2 additions & 0 deletions NVEncCore/rgy_frame_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ static int bytesPerPix(RGY_CSP csp) {
case RGY_CSP_RGB32R:
case RGY_CSP_RGB32:
case RGY_CSP_BGR32:
case RGY_CSP_ARGB32:
case RGY_CSP_ABGR32:
case RGY_CSP_RGBA_FP16_P:
pixsize *= 4;
break;
Expand Down
2 changes: 2 additions & 0 deletions NVEncCore/rgy_input_avcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,8 @@ RGY_ERR RGYInputAvcodec::Init(const TCHAR *strFileName, VideoInfo *inputInfo, co
{ AV_PIX_FMT_BGR24, 8, RGY_CHROMAFMT_RGB_PACKED, (ENCODER_NVENC) ? RGY_CSP_RGB : (ENCODER_MPP ? RGY_CSP_BGR24 : RGY_CSP_RGB32) },
{ AV_PIX_FMT_RGBA, 8, RGY_CHROMAFMT_RGB_PACKED, (ENCODER_NVENC) ? RGY_CSP_RGBA : RGY_CSP_RGB32 },
{ AV_PIX_FMT_BGRA, 8, RGY_CHROMAFMT_RGB_PACKED, (ENCODER_NVENC) ? RGY_CSP_RGBA : RGY_CSP_RGB32 },
{ AV_PIX_FMT_ARGB, 8, RGY_CHROMAFMT_RGB_PACKED, (ENCODER_NVENC) ? RGY_CSP_RGBA : RGY_CSP_RGB32 },
{ AV_PIX_FMT_ABGR, 8, RGY_CHROMAFMT_RGB_PACKED, (ENCODER_NVENC) ? RGY_CSP_RGBA : RGY_CSP_RGB32 },
{ AV_PIX_FMT_GBRP, 8, RGY_CHROMAFMT_RGB, (ENCODER_NVENC) ? RGY_CSP_RGB : RGY_CSP_RGB32 },
{ AV_PIX_FMT_GBRAP, 8, RGY_CHROMAFMT_RGB, (ENCODER_NVENC) ? RGY_CSP_RGBA : RGY_CSP_RGB32 },
};
Expand Down

0 comments on commit d265c55

Please sign in to comment.