diff --git a/NVEncCore/convert_csp.cpp b/NVEncCore/convert_csp.cpp index 6459a417..5ad86b2f 100644 --- a/NVEncCore/convert_csp.cpp +++ b/NVEncCore/convert_csp.cpp @@ -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); @@ -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) diff --git a/NVEncCore/convert_csp.h b/NVEncCore/convert_csp.h index 1c14e3a0..c1a05469 100644 --- a/NVEncCore/convert_csp.h +++ b/NVEncCore/convert_csp.h @@ -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 @@ -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"), @@ -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 @@ -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 @@ -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 @@ -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, @@ -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 diff --git a/NVEncCore/convert_csp_simd.h b/NVEncCore/convert_csp_simd.h index dc6d56f7..e85d5f6f 100644 --- a/NVEncCore/convert_csp_simd.h +++ b/NVEncCore/convert_csp_simd.h @@ -615,75 +615,6 @@ static void RGY_FORCEINLINE convert_rgb_to_rgb24_simd(void **dst, const void **s } #endif -template -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 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]; @@ -691,10 +622,14 @@ static void RGY_FORCEINLINE convert_rgb32_to_rgba_simd(void **dst, const void ** 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) { @@ -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)); @@ -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); } } diff --git a/NVEncCore/convert_csp_sse2.cpp b/NVEncCore/convert_csp_sse2.cpp index 1f3c936c..8ab8bed8 100644 --- a/NVEncCore/convert_csp_sse2.cpp +++ b/NVEncCore/convert_csp_sse2.cpp @@ -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(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(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(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(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(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(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(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(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) { @@ -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(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(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) { diff --git a/NVEncCore/rgy_avutil.cpp b/NVEncCore/rgy_avutil.cpp index e3836d58..3450ed69 100644 --- a/NVEncCore/rgy_avutil.cpp +++ b/NVEncCore/rgy_avutil.cpp @@ -879,6 +879,8 @@ static const auto CSP_PIXFMT_RGY = make_array> 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) ); diff --git a/NVEncCore/rgy_frame.cpp b/NVEncCore/rgy_frame.cpp index 1ace9dc5..092493d8 100644 --- a/NVEncCore/rgy_frame.cpp +++ b/NVEncCore/rgy_frame.cpp @@ -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; diff --git a/NVEncCore/rgy_frame_info.h b/NVEncCore/rgy_frame_info.h index 5424ccf8..e9bfc089 100644 --- a/NVEncCore/rgy_frame_info.h +++ b/NVEncCore/rgy_frame_info.h @@ -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; diff --git a/NVEncCore/rgy_input_avcodec.cpp b/NVEncCore/rgy_input_avcodec.cpp index f146c931..eb96963e 100644 --- a/NVEncCore/rgy_input_avcodec.cpp +++ b/NVEncCore/rgy_input_avcodec.cpp @@ -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 }, };