Skip to content

Commit 8f2a778

Browse files
committed
Fix: v141_xp does not know c++17 lambda syntax
1 parent 1427496 commit 8f2a778

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

avs_core/convert/intel/convert_planar_avx2.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,16 @@ void convert_yuv_to_planarrgb_uintN_avx2(BYTE* (&dstp)[3], int(&dstPitch)[3], co
513513
// res2= (yv_b*v3 + round' ) ... round' = round + rgb_offset
514514

515515
// Processing lambda - checked and benchmarked to be inlined nicely -avoids code bloat
516+
517+
// For v141_xp compatibility: forces the compiler to capture a const variable
518+
// that would otherwise be optimized out of nested lambda scopes.
519+
#define XP_LAMBDA_CAPTURE_FIX(x) (void)(x)
520+
516521
auto process_plane = [&](BYTE* plane_ptr, __m256i m_uy, __m256i m_vr, __m256i v_patch) {
522+
XP_LAMBDA_CAPTURE_FIX(limit);
523+
XP_LAMBDA_CAPTURE_FIX(safe_last_16float_64bytes);
517524
auto madd_scale = [&](__m256i uy, __m256i vr) {
525+
XP_LAMBDA_CAPTURE_FIX(v_patch);
518526
__m256i sum = _mm256_add_epi32(_mm256_madd_epi16(m_uy, uy), _mm256_madd_epi16(m_vr, vr));
519527
// 16-bit adjustment (signed patch, offset, output rgb offset)
520528
if constexpr (!lessthan16bit) sum = _mm256_add_epi32(sum, v_patch);
@@ -584,6 +592,8 @@ void convert_yuv_to_planarrgb_uintN_avx2(BYTE* (&dstp)[3], int(&dstPitch)[3], co
584592
}
585593
};
586594

595+
#undef XP_LAMBDA_CAPTURE_FIX
596+
587597
// Process planes, using pre-packed coefficient, and the 16 bit patch if needed
588598
process_plane(dstp[0], m_uy_G, m_vR_G, v_patch_G);
589599
process_plane(dstp[1], m_uy_B, m_vR_B, v_patch_B);

avs_core/convert/intel/convert_planar_sse.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,10 +1176,18 @@ void convert_yuv_to_planarrgb_uintN_sse2(BYTE *(&dstp)[3], int (&dstPitch)[3], c
11761176
// ( v3 4096 ) ( v2 4096 ) ( v1 4096 ) ( v0 4096 )
11771177
// res2= (yv_b*v3 + round' ) ... round' = round + rgb_offset
11781178

1179+
// For v141_xp compatibility: forces the compiler to capture a const variable
1180+
// that would otherwise be optimized out of nested lambda scopes.
1181+
#define XP_LAMBDA_CAPTURE_FIX(x) (void)(x)
1182+
11791183
// Processing lambda - checked and benchmarked to be inlined nicely -avoids code bloat
11801184
auto process_plane_sse2 = [&](BYTE* plane_ptr, __m128i m_uy, __m128i m_vr, __m128i v_patch) {
1185+
XP_LAMBDA_CAPTURE_FIX(zero);
1186+
XP_LAMBDA_CAPTURE_FIX(limit);
1187+
XP_LAMBDA_CAPTURE_FIX(scale_f_sse2);
11811188

11821189
auto madd_shift = [&](__m128i uy, __m128i vr) {
1190+
XP_LAMBDA_CAPTURE_FIX(v_patch);
11831191
__m128i sum = _mm_add_epi32(_mm_madd_epi16(m_uy, uy), _mm_madd_epi16(m_vr, vr));
11841192
// 16-bit adjustment (signed patch, offset, output rgb offset)
11851193
if constexpr (!lessthan16bit) sum = _mm_add_epi32(sum, v_patch);
@@ -1220,6 +1228,8 @@ void convert_yuv_to_planarrgb_uintN_sse2(BYTE *(&dstp)[3], int (&dstPitch)[3], c
12201228
}
12211229
};
12221230

1231+
#undef XP_LAMBDA_CAPTURE_FIX
1232+
12231233
// Process planes, using pre-packed coefficient, and the 16 bit patch if needed
12241234
process_plane_sse2(dstp[0], m_uy_G, m_vr_G, v_patch_G);
12251235
process_plane_sse2(dstp[1], m_uy_B, m_vr_B, v_patch_B);

0 commit comments

Comments
 (0)