зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1786366
- Vendor libvpx r=webrtc-reviewers,ng
Run `./mach vendor media/libvpx/moz.yaml --patch-mode=none` as what media/libvpx/README_MOZILLA said. The updated libvpx revision is 5c38ffbfa3aba5ea4d8d0ae05a50cc76ec99bed9. Differential Revision: https://phabricator.services.mozilla.com/D168144
This commit is contained in:
Родитель
24b4aad2da
Коммит
48c201662f
|
@ -287,7 +287,8 @@ void vpx_hadamard_16x16_neon(const int16_t *src_diff, ptrdiff_t src_stride, int1
|
|||
RTCD_EXTERN void (*vpx_hadamard_16x16)(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
|
||||
void vpx_hadamard_32x32_c(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
#define vpx_hadamard_32x32 vpx_hadamard_32x32_c
|
||||
void vpx_hadamard_32x32_neon(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
RTCD_EXTERN void (*vpx_hadamard_32x32)(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
|
||||
void vpx_hadamard_8x8_c(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
void vpx_hadamard_8x8_neon(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
|
@ -933,6 +934,8 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_NEON) vpx_h_predictor_8x8 = vpx_h_predictor_8x8_neon;
|
||||
vpx_hadamard_16x16 = vpx_hadamard_16x16_c;
|
||||
if (flags & HAS_NEON) vpx_hadamard_16x16 = vpx_hadamard_16x16_neon;
|
||||
vpx_hadamard_32x32 = vpx_hadamard_32x32_c;
|
||||
if (flags & HAS_NEON) vpx_hadamard_32x32 = vpx_hadamard_32x32_neon;
|
||||
vpx_hadamard_8x8 = vpx_hadamard_8x8_c;
|
||||
if (flags & HAS_NEON) vpx_hadamard_8x8 = vpx_hadamard_8x8_neon;
|
||||
vpx_idct16x16_10_add = vpx_idct16x16_10_add_c;
|
||||
|
|
|
@ -287,7 +287,8 @@ void vpx_hadamard_16x16_neon(const int16_t *src_diff, ptrdiff_t src_stride, int1
|
|||
#define vpx_hadamard_16x16 vpx_hadamard_16x16_neon
|
||||
|
||||
void vpx_hadamard_32x32_c(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
#define vpx_hadamard_32x32 vpx_hadamard_32x32_c
|
||||
void vpx_hadamard_32x32_neon(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
#define vpx_hadamard_32x32 vpx_hadamard_32x32_neon
|
||||
|
||||
void vpx_hadamard_8x8_c(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
void vpx_hadamard_8x8_neon(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
|
|
|
@ -87,11 +87,14 @@ RTCD_EXTERN void (*vp9_iht8x8_64_add)(const tran_low_t *input, uint8_t *dest, in
|
|||
|
||||
void vp9_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_sse2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
#define vp9_quantize_fp_32x32 vp9_quantize_fp_32x32_c
|
||||
void vp9_quantize_fp_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_scale_and_extend_frame_c(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
void vp9_scale_and_extend_frame_ssse3(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
|
@ -137,7 +140,11 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSE2) vp9_iht8x8_64_add = vp9_iht8x8_64_add_sse2;
|
||||
vp9_quantize_fp = vp9_quantize_fp_c;
|
||||
if (flags & HAS_SSE2) vp9_quantize_fp = vp9_quantize_fp_sse2;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp = vp9_quantize_fp_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp = vp9_quantize_fp_avx2;
|
||||
vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_c;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_avx2;
|
||||
vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_c;
|
||||
if (flags & HAS_SSSE3) vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_ssse3;
|
||||
}
|
||||
|
|
|
@ -490,6 +490,7 @@ RTCD_EXTERN void (*vpx_quantize_b)(const tran_low_t *coeff_ptr, intptr_t n_coeff
|
|||
void vpx_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vpx_quantize_b_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
unsigned int vpx_sad16x16_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride);
|
||||
|
@ -820,6 +821,7 @@ RTCD_EXTERN uint32_t (*vpx_sub_pixel_variance8x8)(const uint8_t *src_ptr, int sr
|
|||
|
||||
void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_sse2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_avx2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
RTCD_EXTERN void (*vpx_subtract_block)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
|
||||
uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int stride, int size);
|
||||
|
@ -1165,6 +1167,7 @@ static void setup_rtcd_internal(void)
|
|||
vpx_quantize_b_32x32 = vpx_quantize_b_32x32_c;
|
||||
if (flags & HAS_SSSE3) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_ssse3;
|
||||
if (flags & HAS_AVX) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx;
|
||||
if (flags & HAS_AVX2) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx2;
|
||||
vpx_sad16x16 = vpx_sad16x16_c;
|
||||
if (flags & HAS_SSE2) vpx_sad16x16 = vpx_sad16x16_sse2;
|
||||
vpx_sad16x16_avg = vpx_sad16x16_avg_c;
|
||||
|
@ -1344,6 +1347,7 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_ssse3;
|
||||
vpx_subtract_block = vpx_subtract_block_c;
|
||||
if (flags & HAS_SSE2) vpx_subtract_block = vpx_subtract_block_sse2;
|
||||
if (flags & HAS_AVX2) vpx_subtract_block = vpx_subtract_block_avx2;
|
||||
vpx_sum_squares_2d_i16 = vpx_sum_squares_2d_i16_c;
|
||||
if (flags & HAS_SSE2) vpx_sum_squares_2d_i16 = vpx_sum_squares_2d_i16_sse2;
|
||||
vpx_tm_predictor_16x16 = vpx_tm_predictor_16x16_c;
|
||||
|
|
|
@ -93,6 +93,7 @@ RTCD_EXTERN void (*vp9_quantize_fp)(const tran_low_t *coeff_ptr, intptr_t n_coef
|
|||
|
||||
void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_scale_and_extend_frame_c(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
|
@ -122,6 +123,7 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_AVX2) vp9_quantize_fp = vp9_quantize_fp_avx2;
|
||||
vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_c;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_avx2;
|
||||
vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_c;
|
||||
if (flags & HAS_SSSE3) vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_ssse3;
|
||||
}
|
||||
|
|
|
@ -492,6 +492,7 @@ RTCD_EXTERN void (*vpx_quantize_b)(const tran_low_t *coeff_ptr, intptr_t n_coeff
|
|||
void vpx_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vpx_quantize_b_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
unsigned int vpx_sad16x16_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride);
|
||||
|
@ -822,7 +823,8 @@ RTCD_EXTERN uint32_t (*vpx_sub_pixel_variance8x8)(const uint8_t *src_ptr, int sr
|
|||
|
||||
void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_sse2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
#define vpx_subtract_block vpx_subtract_block_sse2
|
||||
void vpx_subtract_block_avx2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
RTCD_EXTERN void (*vpx_subtract_block)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
|
||||
uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int stride, int size);
|
||||
uint64_t vpx_sum_squares_2d_i16_sse2(const int16_t *src, int stride, int size);
|
||||
|
@ -1016,6 +1018,7 @@ static void setup_rtcd_internal(void)
|
|||
vpx_quantize_b_32x32 = vpx_quantize_b_32x32_c;
|
||||
if (flags & HAS_SSSE3) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_ssse3;
|
||||
if (flags & HAS_AVX) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx;
|
||||
if (flags & HAS_AVX2) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx2;
|
||||
vpx_sad32x16 = vpx_sad32x16_sse2;
|
||||
if (flags & HAS_AVX2) vpx_sad32x16 = vpx_sad32x16_avx2;
|
||||
vpx_sad32x16_avg = vpx_sad32x16_avg_sse2;
|
||||
|
@ -1100,6 +1103,8 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x4 = vpx_sub_pixel_variance8x4_ssse3;
|
||||
vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_sse2;
|
||||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_ssse3;
|
||||
vpx_subtract_block = vpx_subtract_block_sse2;
|
||||
if (flags & HAS_AVX2) vpx_subtract_block = vpx_subtract_block_avx2;
|
||||
vpx_variance16x16 = vpx_variance16x16_sse2;
|
||||
if (flags & HAS_AVX2) vpx_variance16x16 = vpx_variance16x16_avx2;
|
||||
vpx_variance16x32 = vpx_variance16x32_sse2;
|
||||
|
|
|
@ -87,11 +87,14 @@ RTCD_EXTERN void (*vp9_iht8x8_64_add)(const tran_low_t *input, uint8_t *dest, in
|
|||
|
||||
void vp9_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_sse2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
#define vp9_quantize_fp_32x32 vp9_quantize_fp_32x32_c
|
||||
void vp9_quantize_fp_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_scale_and_extend_frame_c(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
void vp9_scale_and_extend_frame_ssse3(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
|
@ -137,7 +140,11 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSE2) vp9_iht8x8_64_add = vp9_iht8x8_64_add_sse2;
|
||||
vp9_quantize_fp = vp9_quantize_fp_c;
|
||||
if (flags & HAS_SSE2) vp9_quantize_fp = vp9_quantize_fp_sse2;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp = vp9_quantize_fp_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp = vp9_quantize_fp_avx2;
|
||||
vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_c;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_avx2;
|
||||
vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_c;
|
||||
if (flags & HAS_SSSE3) vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_ssse3;
|
||||
}
|
||||
|
|
|
@ -490,6 +490,7 @@ RTCD_EXTERN void (*vpx_quantize_b)(const tran_low_t *coeff_ptr, intptr_t n_coeff
|
|||
void vpx_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vpx_quantize_b_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
unsigned int vpx_sad16x16_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride);
|
||||
|
@ -820,6 +821,7 @@ RTCD_EXTERN uint32_t (*vpx_sub_pixel_variance8x8)(const uint8_t *src_ptr, int sr
|
|||
|
||||
void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_sse2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_avx2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
RTCD_EXTERN void (*vpx_subtract_block)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
|
||||
uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int stride, int size);
|
||||
|
@ -1165,6 +1167,7 @@ static void setup_rtcd_internal(void)
|
|||
vpx_quantize_b_32x32 = vpx_quantize_b_32x32_c;
|
||||
if (flags & HAS_SSSE3) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_ssse3;
|
||||
if (flags & HAS_AVX) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx;
|
||||
if (flags & HAS_AVX2) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx2;
|
||||
vpx_sad16x16 = vpx_sad16x16_c;
|
||||
if (flags & HAS_SSE2) vpx_sad16x16 = vpx_sad16x16_sse2;
|
||||
vpx_sad16x16_avg = vpx_sad16x16_avg_c;
|
||||
|
@ -1344,6 +1347,7 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_ssse3;
|
||||
vpx_subtract_block = vpx_subtract_block_c;
|
||||
if (flags & HAS_SSE2) vpx_subtract_block = vpx_subtract_block_sse2;
|
||||
if (flags & HAS_AVX2) vpx_subtract_block = vpx_subtract_block_avx2;
|
||||
vpx_sum_squares_2d_i16 = vpx_sum_squares_2d_i16_c;
|
||||
if (flags & HAS_SSE2) vpx_sum_squares_2d_i16 = vpx_sum_squares_2d_i16_sse2;
|
||||
vpx_tm_predictor_16x16 = vpx_tm_predictor_16x16_c;
|
||||
|
|
|
@ -93,6 +93,7 @@ RTCD_EXTERN void (*vp9_quantize_fp)(const tran_low_t *coeff_ptr, intptr_t n_coef
|
|||
|
||||
void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_scale_and_extend_frame_c(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
|
@ -122,6 +123,7 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_AVX2) vp9_quantize_fp = vp9_quantize_fp_avx2;
|
||||
vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_c;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_avx2;
|
||||
vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_c;
|
||||
if (flags & HAS_SSSE3) vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_ssse3;
|
||||
}
|
||||
|
|
|
@ -492,6 +492,7 @@ RTCD_EXTERN void (*vpx_quantize_b)(const tran_low_t *coeff_ptr, intptr_t n_coeff
|
|||
void vpx_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vpx_quantize_b_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
unsigned int vpx_sad16x16_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride);
|
||||
|
@ -822,7 +823,8 @@ RTCD_EXTERN uint32_t (*vpx_sub_pixel_variance8x8)(const uint8_t *src_ptr, int sr
|
|||
|
||||
void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_sse2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
#define vpx_subtract_block vpx_subtract_block_sse2
|
||||
void vpx_subtract_block_avx2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
RTCD_EXTERN void (*vpx_subtract_block)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
|
||||
uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int stride, int size);
|
||||
uint64_t vpx_sum_squares_2d_i16_sse2(const int16_t *src, int stride, int size);
|
||||
|
@ -1016,6 +1018,7 @@ static void setup_rtcd_internal(void)
|
|||
vpx_quantize_b_32x32 = vpx_quantize_b_32x32_c;
|
||||
if (flags & HAS_SSSE3) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_ssse3;
|
||||
if (flags & HAS_AVX) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx;
|
||||
if (flags & HAS_AVX2) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx2;
|
||||
vpx_sad32x16 = vpx_sad32x16_sse2;
|
||||
if (flags & HAS_AVX2) vpx_sad32x16 = vpx_sad32x16_avx2;
|
||||
vpx_sad32x16_avg = vpx_sad32x16_avg_sse2;
|
||||
|
@ -1100,6 +1103,8 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x4 = vpx_sub_pixel_variance8x4_ssse3;
|
||||
vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_sse2;
|
||||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_ssse3;
|
||||
vpx_subtract_block = vpx_subtract_block_sse2;
|
||||
if (flags & HAS_AVX2) vpx_subtract_block = vpx_subtract_block_avx2;
|
||||
vpx_variance16x16 = vpx_variance16x16_sse2;
|
||||
if (flags & HAS_AVX2) vpx_variance16x16 = vpx_variance16x16_avx2;
|
||||
vpx_variance16x32 = vpx_variance16x32_sse2;
|
||||
|
|
|
@ -287,7 +287,8 @@ void vpx_hadamard_16x16_neon(const int16_t *src_diff, ptrdiff_t src_stride, int1
|
|||
#define vpx_hadamard_16x16 vpx_hadamard_16x16_neon
|
||||
|
||||
void vpx_hadamard_32x32_c(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
#define vpx_hadamard_32x32 vpx_hadamard_32x32_c
|
||||
void vpx_hadamard_32x32_neon(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
#define vpx_hadamard_32x32 vpx_hadamard_32x32_neon
|
||||
|
||||
void vpx_hadamard_8x8_c(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
void vpx_hadamard_8x8_neon(const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff);
|
||||
|
|
|
@ -87,11 +87,14 @@ RTCD_EXTERN void (*vp9_iht8x8_64_add)(const tran_low_t *input, uint8_t *dest, in
|
|||
|
||||
void vp9_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_sse2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
#define vp9_quantize_fp_32x32 vp9_quantize_fp_32x32_c
|
||||
void vp9_quantize_fp_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_scale_and_extend_frame_c(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
void vp9_scale_and_extend_frame_ssse3(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
|
@ -137,7 +140,11 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSE2) vp9_iht8x8_64_add = vp9_iht8x8_64_add_sse2;
|
||||
vp9_quantize_fp = vp9_quantize_fp_c;
|
||||
if (flags & HAS_SSE2) vp9_quantize_fp = vp9_quantize_fp_sse2;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp = vp9_quantize_fp_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp = vp9_quantize_fp_avx2;
|
||||
vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_c;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_avx2;
|
||||
vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_c;
|
||||
if (flags & HAS_SSSE3) vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_ssse3;
|
||||
}
|
||||
|
|
|
@ -490,6 +490,7 @@ RTCD_EXTERN void (*vpx_quantize_b)(const tran_low_t *coeff_ptr, intptr_t n_coeff
|
|||
void vpx_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vpx_quantize_b_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
unsigned int vpx_sad16x16_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride);
|
||||
|
@ -820,6 +821,7 @@ RTCD_EXTERN uint32_t (*vpx_sub_pixel_variance8x8)(const uint8_t *src_ptr, int sr
|
|||
|
||||
void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_sse2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_avx2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
RTCD_EXTERN void (*vpx_subtract_block)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
|
||||
uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int stride, int size);
|
||||
|
@ -1165,6 +1167,7 @@ static void setup_rtcd_internal(void)
|
|||
vpx_quantize_b_32x32 = vpx_quantize_b_32x32_c;
|
||||
if (flags & HAS_SSSE3) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_ssse3;
|
||||
if (flags & HAS_AVX) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx;
|
||||
if (flags & HAS_AVX2) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx2;
|
||||
vpx_sad16x16 = vpx_sad16x16_c;
|
||||
if (flags & HAS_SSE2) vpx_sad16x16 = vpx_sad16x16_sse2;
|
||||
vpx_sad16x16_avg = vpx_sad16x16_avg_c;
|
||||
|
@ -1344,6 +1347,7 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_ssse3;
|
||||
vpx_subtract_block = vpx_subtract_block_c;
|
||||
if (flags & HAS_SSE2) vpx_subtract_block = vpx_subtract_block_sse2;
|
||||
if (flags & HAS_AVX2) vpx_subtract_block = vpx_subtract_block_avx2;
|
||||
vpx_sum_squares_2d_i16 = vpx_sum_squares_2d_i16_c;
|
||||
if (flags & HAS_SSE2) vpx_sum_squares_2d_i16 = vpx_sum_squares_2d_i16_sse2;
|
||||
vpx_tm_predictor_16x16 = vpx_tm_predictor_16x16_c;
|
||||
|
|
|
@ -93,6 +93,7 @@ RTCD_EXTERN void (*vp9_quantize_fp)(const tran_low_t *coeff_ptr, intptr_t n_coef
|
|||
|
||||
void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vp9_quantize_fp_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vp9_quantize_fp_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *round_ptr, const int16_t *quant_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
void vp9_scale_and_extend_frame_c(const struct yv12_buffer_config *src, struct yv12_buffer_config *dst, INTERP_FILTER filter_type, int phase_scaler);
|
||||
|
@ -122,6 +123,7 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_AVX2) vp9_quantize_fp = vp9_quantize_fp_avx2;
|
||||
vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_c;
|
||||
if (flags & HAS_SSSE3) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_ssse3;
|
||||
if (flags & HAS_AVX2) vp9_quantize_fp_32x32 = vp9_quantize_fp_32x32_avx2;
|
||||
vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_c;
|
||||
if (flags & HAS_SSSE3) vp9_scale_and_extend_frame = vp9_scale_and_extend_frame_ssse3;
|
||||
}
|
||||
|
|
|
@ -492,6 +492,7 @@ RTCD_EXTERN void (*vpx_quantize_b)(const tran_low_t *coeff_ptr, intptr_t n_coeff
|
|||
void vpx_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
void vpx_quantize_b_32x32_avx2(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
RTCD_EXTERN void (*vpx_quantize_b_32x32)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan);
|
||||
|
||||
unsigned int vpx_sad16x16_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride);
|
||||
|
@ -822,7 +823,8 @@ RTCD_EXTERN uint32_t (*vpx_sub_pixel_variance8x8)(const uint8_t *src_ptr, int sr
|
|||
|
||||
void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
void vpx_subtract_block_sse2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
#define vpx_subtract_block vpx_subtract_block_sse2
|
||||
void vpx_subtract_block_avx2(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
RTCD_EXTERN void (*vpx_subtract_block)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
|
||||
uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int stride, int size);
|
||||
uint64_t vpx_sum_squares_2d_i16_sse2(const int16_t *src, int stride, int size);
|
||||
|
@ -1016,6 +1018,7 @@ static void setup_rtcd_internal(void)
|
|||
vpx_quantize_b_32x32 = vpx_quantize_b_32x32_c;
|
||||
if (flags & HAS_SSSE3) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_ssse3;
|
||||
if (flags & HAS_AVX) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx;
|
||||
if (flags & HAS_AVX2) vpx_quantize_b_32x32 = vpx_quantize_b_32x32_avx2;
|
||||
vpx_sad32x16 = vpx_sad32x16_sse2;
|
||||
if (flags & HAS_AVX2) vpx_sad32x16 = vpx_sad32x16_avx2;
|
||||
vpx_sad32x16_avg = vpx_sad32x16_avg_sse2;
|
||||
|
@ -1100,6 +1103,8 @@ static void setup_rtcd_internal(void)
|
|||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x4 = vpx_sub_pixel_variance8x4_ssse3;
|
||||
vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_sse2;
|
||||
if (flags & HAS_SSSE3) vpx_sub_pixel_variance8x8 = vpx_sub_pixel_variance8x8_ssse3;
|
||||
vpx_subtract_block = vpx_subtract_block_sse2;
|
||||
if (flags & HAS_AVX2) vpx_subtract_block = vpx_subtract_block_avx2;
|
||||
vpx_variance16x16 = vpx_variance16x16_sse2;
|
||||
if (flags & HAS_AVX2) vpx_variance16x16 = vpx_variance16x16_avx2;
|
||||
vpx_variance16x32 = vpx_variance16x32_sse2;
|
||||
|
|
|
@ -1,149 +1,9 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
# Generated with clang-format 7.0.1
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
BasedOnStyle: Google
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Right
|
||||
RawStringFormats:
|
||||
- Language: Cpp
|
||||
Delimiters:
|
||||
- cc
|
||||
- CC
|
||||
- cpp
|
||||
- Cpp
|
||||
- CPP
|
||||
- 'c++'
|
||||
- 'C++'
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
- Language: TextProto
|
||||
Delimiters:
|
||||
- pb
|
||||
- PB
|
||||
- proto
|
||||
- PROTO
|
||||
EnclosingFunctions:
|
||||
- EqualsProto
|
||||
- EquivToProto
|
||||
- PARSE_PARTIAL_TEXT_PROTO
|
||||
- PARSE_TEST_PROTO
|
||||
- PARSE_TEXT_PROTO
|
||||
- ParseTextOrDie
|
||||
- ParseTextProtoOrDie
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ Jacky Chen <jackychen@google.com>
|
|||
Jim Bankoski <jimbankoski@google.com>
|
||||
Johann Koenig <johannkoenig@google.com>
|
||||
Johann Koenig <johannkoenig@google.com> <johann.koenig@duck.com>
|
||||
Johann Koenig <johannkoenig@google.com> <johann.koenig@gmail.com>
|
||||
Johann Koenig <johannkoenig@google.com> <johannkoenig@chromium.org>
|
||||
Johann <johann@duck.com> <johann.koenig@gmail.com>
|
||||
John Koleszar <jkoleszar@google.com>
|
||||
Joshua Litt <joshualitt@google.com> <joshualitt@chromium.org>
|
||||
Marco Paniconi <marpan@google.com>
|
||||
|
|
|
@ -23,6 +23,7 @@ Andrew Lewis <andrewlewis@google.com>
|
|||
Andrew Russell <anrussell@google.com>
|
||||
Angie Chen <yunqi@google.com>
|
||||
Angie Chiang <angiebird@google.com>
|
||||
Anton Venema <anton.venema@liveswitch.com>
|
||||
Aron Rosenberg <arosenberg@logitech.com>
|
||||
Attila Nagy <attilanagy@google.com>
|
||||
Birk Magnussen <birk.magnussen@googlemail.com>
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
## be found in the AUTHORS file in the root of the source tree.
|
||||
##
|
||||
|
||||
# Ignore this file during non-NDK builds.
|
||||
ifdef NDK_ROOT
|
||||
#
|
||||
# This file is to be used for compiling libvpx for Android using the NDK.
|
||||
# In an Android project place a libvpx checkout in the jni directory.
|
||||
|
@ -212,3 +214,4 @@ endif
|
|||
ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
|
||||
$(call import-module,android/cpufeatures)
|
||||
endif
|
||||
endif # NDK_ROOT
|
||||
|
|
|
@ -791,7 +791,7 @@ process_common_toolchain() {
|
|||
tgt_isa=x86_64
|
||||
tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'`
|
||||
;;
|
||||
*darwin2[0-1]*)
|
||||
*darwin2[0-2]*)
|
||||
tgt_isa=`uname -m`
|
||||
tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'`
|
||||
;;
|
||||
|
@ -940,7 +940,7 @@ process_common_toolchain() {
|
|||
add_cflags "-mmacosx-version-min=10.15"
|
||||
add_ldflags "-mmacosx-version-min=10.15"
|
||||
;;
|
||||
*-darwin2[0-1]-*)
|
||||
*-darwin2[0-2]-*)
|
||||
add_cflags "-arch ${toolchain%%-*}"
|
||||
add_ldflags "-arch ${toolchain%%-*}"
|
||||
;;
|
||||
|
@ -1511,7 +1511,7 @@ EOF
|
|||
|
||||
# Try to find which inline keywords are supported
|
||||
check_cc <<EOF && INLINE="inline"
|
||||
static inline function() {}
|
||||
static inline int function(void) {}
|
||||
EOF
|
||||
|
||||
# Almost every platform uses pthreads.
|
||||
|
|
|
@ -42,7 +42,7 @@ done
|
|||
|
||||
[ -n "$srcfile" ] || show_help
|
||||
sfx=${sfx:-asm}
|
||||
includes=$(LC_ALL=C egrep -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
|
||||
includes=$(LC_ALL=C grep -E -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
|
||||
perl -p -e "s;.*?([a-z0-9_/]+.${sfx}).*;\1;")
|
||||
#" restore editor state
|
||||
for inc in ${includes}; do
|
||||
|
|
|
@ -488,7 +488,8 @@ if ($opts{arch} eq 'x86') {
|
|||
arm;
|
||||
} elsif ($opts{arch} eq 'armv8' || $opts{arch} eq 'arm64' ) {
|
||||
@ALL_ARCHS = filter(qw/neon/);
|
||||
&require("neon");
|
||||
@REQUIRES = filter(qw/neon/);
|
||||
&require(@REQUIRES);
|
||||
arm;
|
||||
} elsif ($opts{arch} =~ /^ppc/ ) {
|
||||
@ALL_ARCHS = filter(qw/vsx/);
|
||||
|
|
|
@ -101,9 +101,12 @@ all_platforms="${all_platforms} arm64-android-gcc"
|
|||
all_platforms="${all_platforms} arm64-darwin-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin20-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin21-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin22-gcc"
|
||||
all_platforms="${all_platforms} arm64-linux-gcc"
|
||||
all_platforms="${all_platforms} arm64-win64-gcc"
|
||||
all_platforms="${all_platforms} arm64-win64-vs15"
|
||||
all_platforms="${all_platforms} arm64-win64-vs16"
|
||||
all_platforms="${all_platforms} arm64-win64-vs17"
|
||||
all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
|
||||
|
@ -112,6 +115,8 @@ all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
|
|||
all_platforms="${all_platforms} armv7-win32-gcc"
|
||||
all_platforms="${all_platforms} armv7-win32-vs14"
|
||||
all_platforms="${all_platforms} armv7-win32-vs15"
|
||||
all_platforms="${all_platforms} armv7-win32-vs16"
|
||||
all_platforms="${all_platforms} armv7-win32-vs17"
|
||||
all_platforms="${all_platforms} armv7s-darwin-gcc"
|
||||
all_platforms="${all_platforms} armv8-linux-gcc"
|
||||
all_platforms="${all_platforms} loongarch32-linux-gcc"
|
||||
|
@ -157,6 +162,7 @@ all_platforms="${all_platforms} x86_64-darwin18-gcc"
|
|||
all_platforms="${all_platforms} x86_64-darwin19-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin20-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin21-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin22-gcc"
|
||||
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-icc"
|
||||
|
@ -666,11 +672,18 @@ process_toolchain() {
|
|||
check_add_cxxflags -Wno-psabi
|
||||
fi
|
||||
|
||||
# Enforce C++11 compatibility.
|
||||
check_add_cxxflags -Wc++14-extensions
|
||||
check_add_cxxflags -Wc++17-extensions
|
||||
check_add_cxxflags -Wc++20-extensions
|
||||
|
||||
# disable some warnings specific to libyuv.
|
||||
check_cxxflags -Wno-missing-declarations \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-missing-declarations"
|
||||
check_cxxflags -Wno-missing-prototypes \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-missing-prototypes"
|
||||
check_cxxflags -Wno-pass-failed \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-pass-failed"
|
||||
check_cxxflags -Wno-unused-parameter \
|
||||
&& LIBYUV_CXXFLAGS="${LIBYUV_CXXFLAGS} -Wno-unused-parameter"
|
||||
fi
|
||||
|
|
|
@ -552,11 +552,8 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
|
|||
iter = NULL;
|
||||
while ((cx_pkt = vpx_codec_get_cx_data(codec_ctx, &iter))) {
|
||||
switch (cx_pkt->kind) {
|
||||
case VPX_CODEC_PSNR_PKT: {
|
||||
}
|
||||
++si->psnr_pkt_received;
|
||||
break;
|
||||
default: { break; }
|
||||
case VPX_CODEC_PSNR_PKT: ++si->psnr_pkt_received; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1146,7 +1146,9 @@ int main(int argc, const char **argv) {
|
|||
cx_pkt->data.twopass_stats.sz);
|
||||
break;
|
||||
}
|
||||
default: { break; }
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_DECODER && !SIMULCAST_MODE
|
||||
|
|
|
@ -1097,15 +1097,6 @@ EXTERNAL_GROUPS = YES
|
|||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
|
||||
# generate a inheritance diagram (in HTML, RTF and la_te_x) for classes with base
|
||||
# or super classes. Setting the tag to NO turns the diagrams off. Note that
|
||||
# this option is superseded by the HAVE_DOT option below. This is only a
|
||||
# fallback. It is recommended to install and use dot, since it yields more
|
||||
# powerful graphs.
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
# or is not a class.
|
||||
|
@ -1119,10 +1110,14 @@ HIDE_UNDOC_RELATIONS = YES
|
|||
|
||||
HAVE_DOT = NO
|
||||
|
||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect inheritance relations. Setting this tag to YES will force the
|
||||
# the CLASS_DIAGRAMS tag to NO.
|
||||
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect inheritance
|
||||
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
|
||||
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
|
||||
# to TEXT the direct and indirect inheritance relations will be shown as texts /
|
||||
# links.
|
||||
# Possible values are: NO, YES, TEXT and GRAPH.
|
||||
# The default value is: YES.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
|
||||
|
|
|
@ -446,13 +446,13 @@ ifeq ($(VPX_ARCH_X86)$(VPX_ARCH_X86_64),yes)
|
|||
# YASM
|
||||
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
|
||||
@echo " [CREATE] $@"
|
||||
@LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
|
||||
@LC_ALL=C grep -E "#define [A-Z0-9_]+ [01]" $< \
|
||||
| awk '{print $$2 " equ " $$3}' > $@
|
||||
else
|
||||
ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
|
||||
$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
|
||||
@echo " [CREATE] $@"
|
||||
@LC_ALL=C egrep "#define [A-Z0-9_]+ [01]" $< \
|
||||
@LC_ALL=C grep -E "#define [A-Z0-9_]+ [01]" $< \
|
||||
| awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
|
||||
@echo " END" $(ADS2GAS) >> $@
|
||||
CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
|
||||
|
|
|
@ -151,8 +151,8 @@ void MD5Final(md5byte digest[16], struct MD5Context *ctx) {
|
|||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
VPX_NO_UNSIGNED_OVERFLOW_CHECK void MD5Transform(UWORD32 buf[4],
|
||||
UWORD32 const in[16]) {
|
||||
VPX_NO_UNSIGNED_OVERFLOW_CHECK VPX_NO_UNSIGNED_SHIFT_CHECK void MD5Transform(
|
||||
UWORD32 buf[4], UWORD32 const in[16]) {
|
||||
UWORD32 a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
|
|
|
@ -28,43 +28,43 @@ class ACMRandom {
|
|||
explicit ACMRandom(int seed) : random_(seed) {}
|
||||
|
||||
void Reset(int seed) { random_.Reseed(seed); }
|
||||
uint16_t Rand16(void) {
|
||||
uint16_t Rand16() {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
return (value >> 15) & 0xffff;
|
||||
}
|
||||
|
||||
int32_t Rand20Signed(void) {
|
||||
int32_t Rand20Signed() {
|
||||
// Use 20 bits: values between 524287 and -524288.
|
||||
const uint32_t value = random_.Generate(1048576);
|
||||
return static_cast<int32_t>(value) - 524288;
|
||||
}
|
||||
|
||||
int16_t Rand16Signed(void) {
|
||||
int16_t Rand16Signed() {
|
||||
// Use 16 bits: values between 32767 and -32768.
|
||||
return static_cast<int16_t>(random_.Generate(65536));
|
||||
}
|
||||
|
||||
int16_t Rand13Signed(void) {
|
||||
int16_t Rand13Signed() {
|
||||
// Use 13 bits: values between 4095 and -4096.
|
||||
const uint32_t value = random_.Generate(8192);
|
||||
return static_cast<int16_t>(value) - 4096;
|
||||
}
|
||||
|
||||
int16_t Rand9Signed(void) {
|
||||
int16_t Rand9Signed() {
|
||||
// Use 9 bits: values between 255 (0x0FF) and -256 (0x100).
|
||||
const uint32_t value = random_.Generate(512);
|
||||
return static_cast<int16_t>(value) - 256;
|
||||
}
|
||||
|
||||
uint8_t Rand8(void) {
|
||||
uint8_t Rand8() {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
// There's a bit more entropy in the upper bits of this implementation.
|
||||
return (value >> 23) & 0xff;
|
||||
}
|
||||
|
||||
uint8_t Rand8Extremes(void) {
|
||||
uint8_t Rand8Extremes() {
|
||||
// Returns a random value near 0 or near 255, to better exercise
|
||||
// saturation behavior.
|
||||
const uint8_t r = Rand8();
|
||||
|
@ -82,7 +82,7 @@ class ACMRandom {
|
|||
|
||||
int operator()(int n) { return PseudoUniform(n); }
|
||||
|
||||
static int DeterministicSeed(void) { return 0xbaba; }
|
||||
static int DeterministicSeed() { return 0xbaba; }
|
||||
|
||||
private:
|
||||
testing::internal::Random random_;
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
# The test app itself runs on the command line through adb shell
|
||||
# The paths are really messed up as the libvpx make file
|
||||
# expects to be made from a parent directory.
|
||||
|
||||
# Ignore this file during non-NDK builds.
|
||||
ifdef NDK_ROOT
|
||||
CUR_WD := $(call my-dir)
|
||||
BINDINGS_DIR := $(CUR_WD)/../../..
|
||||
LOCAL_PATH := $(CUR_WD)/../../..
|
||||
|
@ -61,3 +64,4 @@ LOCAL_SRC_FILES := $(addprefix ./test/, $(FILTERED_SRC))
|
|||
# some test files depend on *_rtcd.h, ensure they're generated first.
|
||||
$(eval $(call rtcd_dep_template))
|
||||
include $(BUILD_EXECUTABLE)
|
||||
endif # NDK_ROOT
|
||||
|
|
|
@ -22,13 +22,14 @@ namespace {
|
|||
using ::libvpx_test::ACMRandom;
|
||||
using ::libvpx_test::Buffer;
|
||||
|
||||
typedef void (*AvgPredFunc)(uint8_t *a, const uint8_t *b, int w, int h,
|
||||
const uint8_t *c, int c_stride);
|
||||
template <typename Pixel>
|
||||
Pixel avg_with_rounding(Pixel a, Pixel b) {
|
||||
return (a + b + 1) >> 1;
|
||||
}
|
||||
|
||||
uint8_t avg_with_rounding(uint8_t a, uint8_t b) { return (a + b + 1) >> 1; }
|
||||
|
||||
void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
|
||||
int width, int height, Buffer<uint8_t> *avg) {
|
||||
template <typename Pixel>
|
||||
void reference_pred(const Buffer<Pixel> &pred, const Buffer<Pixel> &ref,
|
||||
int width, int height, Buffer<Pixel> *avg) {
|
||||
ASSERT_NE(avg->TopLeftPixel(), nullptr);
|
||||
ASSERT_NE(pred.TopLeftPixel(), nullptr);
|
||||
ASSERT_NE(ref.TopLeftPixel(), nullptr);
|
||||
|
@ -36,12 +37,16 @@ void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
|
|||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
avg->TopLeftPixel()[y * avg->stride() + x] =
|
||||
avg_with_rounding(pred.TopLeftPixel()[y * pred.stride() + x],
|
||||
ref.TopLeftPixel()[y * ref.stride() + x]);
|
||||
avg_with_rounding<Pixel>(pred.TopLeftPixel()[y * pred.stride() + x],
|
||||
ref.TopLeftPixel()[y * ref.stride() + x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using AvgPredFunc = void (*)(uint8_t *a, const uint8_t *b, int w, int h,
|
||||
const uint8_t *c, int c_stride);
|
||||
|
||||
template <int bitdepth, typename Pixel>
|
||||
class AvgPredTest : public ::testing::TestWithParam<AvgPredFunc> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
|
@ -49,15 +54,19 @@ class AvgPredTest : public ::testing::TestWithParam<AvgPredFunc> {
|
|||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
void TestSizeCombinations();
|
||||
void TestCompareReferenceRandom();
|
||||
void TestSpeed();
|
||||
|
||||
protected:
|
||||
AvgPredFunc avg_pred_func_;
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
TEST_P(AvgPredTest, SizeCombinations) {
|
||||
template <int bitdepth, typename Pixel>
|
||||
void AvgPredTest<bitdepth, Pixel>::TestSizeCombinations() {
|
||||
// This is called as part of the sub pixel variance. As such it must be one of
|
||||
// the variance block sizes.
|
||||
|
||||
for (int width_pow = 2; width_pow <= 6; ++width_pow) {
|
||||
for (int height_pow = width_pow - 1; height_pow <= width_pow + 1;
|
||||
++height_pow) {
|
||||
|
@ -70,23 +79,30 @@ TEST_P(AvgPredTest, SizeCombinations) {
|
|||
const int width = 1 << width_pow;
|
||||
const int height = 1 << height_pow;
|
||||
// Only the reference buffer may have a stride not equal to width.
|
||||
Buffer<uint8_t> ref =
|
||||
Buffer<uint8_t>(width, height, ref_padding ? 8 : 0);
|
||||
Buffer<Pixel> ref = Buffer<Pixel>(width, height, ref_padding ? 8 : 0);
|
||||
ASSERT_TRUE(ref.Init());
|
||||
Buffer<uint8_t> pred = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(pred.Init());
|
||||
Buffer<uint8_t> avg_ref = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(avg_ref.Init());
|
||||
Buffer<uint8_t> avg_chk = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(avg_chk.Init());
|
||||
const int bitdepth_mask = (1 << bitdepth) - 1;
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
ref.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
pred.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
|
||||
ref.Set(&rnd_, &ACMRandom::Rand8);
|
||||
pred.Set(&rnd_, &ACMRandom::Rand8);
|
||||
|
||||
reference_pred(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
avg_pred_func_(avg_chk.TopLeftPixel(), pred.TopLeftPixel(), width,
|
||||
height, ref.TopLeftPixel(), ref.stride()));
|
||||
reference_pred<Pixel>(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(avg_pred_func_(
|
||||
(uint8_t *)avg_chk.TopLeftPixel(), (uint8_t *)pred.TopLeftPixel(),
|
||||
width, height, (uint8_t *)ref.TopLeftPixel(), ref.stride()));
|
||||
|
||||
EXPECT_TRUE(avg_chk.CheckValues(avg_ref));
|
||||
if (HasFailure()) {
|
||||
|
@ -99,26 +115,36 @@ TEST_P(AvgPredTest, SizeCombinations) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_P(AvgPredTest, CompareReferenceRandom) {
|
||||
template <int bitdepth, typename Pixel>
|
||||
void AvgPredTest<bitdepth, Pixel>::TestCompareReferenceRandom() {
|
||||
const int width = 64;
|
||||
const int height = 32;
|
||||
Buffer<uint8_t> ref = Buffer<uint8_t>(width, height, 8);
|
||||
Buffer<Pixel> ref = Buffer<Pixel>(width, height, 8);
|
||||
ASSERT_TRUE(ref.Init());
|
||||
Buffer<uint8_t> pred = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(pred.Init());
|
||||
Buffer<uint8_t> avg_ref = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(avg_ref.Init());
|
||||
Buffer<uint8_t> avg_chk = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(avg_chk.Init());
|
||||
|
||||
for (int i = 0; i < 500; ++i) {
|
||||
ref.Set(&rnd_, &ACMRandom::Rand8);
|
||||
pred.Set(&rnd_, &ACMRandom::Rand8);
|
||||
const int bitdepth_mask = (1 << bitdepth) - 1;
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
ref.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
pred.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
|
||||
reference_pred(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(avg_pred_func_(avg_chk.TopLeftPixel(),
|
||||
pred.TopLeftPixel(), width, height,
|
||||
ref.TopLeftPixel(), ref.stride()));
|
||||
reference_pred<Pixel>(pred, ref, width, height, &avg_ref);
|
||||
ASM_REGISTER_STATE_CHECK(avg_pred_func_(
|
||||
(uint8_t *)avg_chk.TopLeftPixel(), (uint8_t *)pred.TopLeftPixel(),
|
||||
width, height, (uint8_t *)ref.TopLeftPixel(), ref.stride()));
|
||||
EXPECT_TRUE(avg_chk.CheckValues(avg_ref));
|
||||
if (HasFailure()) {
|
||||
printf("Width: %d Height: %d\n", width, height);
|
||||
|
@ -128,7 +154,8 @@ TEST_P(AvgPredTest, CompareReferenceRandom) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_P(AvgPredTest, DISABLED_Speed) {
|
||||
template <int bitdepth, typename Pixel>
|
||||
void AvgPredTest<bitdepth, Pixel>::TestSpeed() {
|
||||
for (int width_pow = 2; width_pow <= 6; ++width_pow) {
|
||||
for (int height_pow = width_pow - 1; height_pow <= width_pow + 1;
|
||||
++height_pow) {
|
||||
|
@ -138,22 +165,30 @@ TEST_P(AvgPredTest, DISABLED_Speed) {
|
|||
for (int ref_padding = 0; ref_padding < 2; ref_padding++) {
|
||||
const int width = 1 << width_pow;
|
||||
const int height = 1 << height_pow;
|
||||
Buffer<uint8_t> ref =
|
||||
Buffer<uint8_t>(width, height, ref_padding ? 8 : 0);
|
||||
Buffer<Pixel> ref = Buffer<Pixel>(width, height, ref_padding ? 8 : 0);
|
||||
ASSERT_TRUE(ref.Init());
|
||||
Buffer<uint8_t> pred = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(pred.Init());
|
||||
Buffer<uint8_t> avg = Buffer<uint8_t>(width, height, 0, 16);
|
||||
Buffer<Pixel> avg = Buffer<Pixel>(width, height, 0, 16);
|
||||
ASSERT_TRUE(avg.Init());
|
||||
|
||||
ref.Set(&rnd_, &ACMRandom::Rand8);
|
||||
pred.Set(&rnd_, &ACMRandom::Rand8);
|
||||
const int bitdepth_mask = (1 << bitdepth) - 1;
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
ref.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
pred.TopLeftPixel()[w + h * width] = rnd_.Rand16() & bitdepth_mask;
|
||||
}
|
||||
}
|
||||
|
||||
vpx_usec_timer timer;
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int i = 0; i < 10000000 / (width * height); ++i) {
|
||||
avg_pred_func_(avg.TopLeftPixel(), pred.TopLeftPixel(), width, height,
|
||||
ref.TopLeftPixel(), ref.stride());
|
||||
for (int i = 0; i < 100000000 / (width * height); ++i) {
|
||||
avg_pred_func_((uint8_t *)avg.TopLeftPixel(),
|
||||
(uint8_t *)pred.TopLeftPixel(), width, height,
|
||||
(uint8_t *)ref.TopLeftPixel(), ref.stride());
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
|
||||
|
@ -166,26 +201,64 @@ TEST_P(AvgPredTest, DISABLED_Speed) {
|
|||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, AvgPredTest,
|
||||
using AvgPredTestLBD = AvgPredTest<8, uint8_t>;
|
||||
|
||||
TEST_P(AvgPredTestLBD, SizeCombinations) { TestSizeCombinations(); }
|
||||
|
||||
TEST_P(AvgPredTestLBD, CompareReferenceRandom) { TestCompareReferenceRandom(); }
|
||||
|
||||
TEST_P(AvgPredTestLBD, DISABLED_Speed) { TestSpeed(); }
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(C, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_c));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_sse2));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_neon));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_VSX
|
||||
INSTANTIATE_TEST_SUITE_P(VSX, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(VSX, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_vsx));
|
||||
#endif // HAVE_VSX
|
||||
|
||||
#if HAVE_LSX
|
||||
INSTANTIATE_TEST_SUITE_P(LSX, AvgPredTest,
|
||||
INSTANTIATE_TEST_SUITE_P(LSX, AvgPredTestLBD,
|
||||
::testing::Values(&vpx_comp_avg_pred_lsx));
|
||||
#endif // HAVE_LSX
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
using HighbdAvgPredFunc = void (*)(uint16_t *a, const uint16_t *b, int w, int h,
|
||||
const uint16_t *c, int c_stride);
|
||||
|
||||
template <HighbdAvgPredFunc fn>
|
||||
void highbd_wrapper(uint8_t *a, const uint8_t *b, int w, int h,
|
||||
const uint8_t *c, int c_stride) {
|
||||
fn((uint16_t *)a, (const uint16_t *)b, w, h, (const uint16_t *)c, c_stride);
|
||||
}
|
||||
|
||||
using AvgPredTestHBD = AvgPredTest<12, uint16_t>;
|
||||
|
||||
TEST_P(AvgPredTestHBD, SizeCombinations) { TestSizeCombinations(); }
|
||||
|
||||
TEST_P(AvgPredTestHBD, CompareReferenceRandom) { TestCompareReferenceRandom(); }
|
||||
|
||||
TEST_P(AvgPredTestHBD, DISABLED_Speed) { TestSpeed(); }
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
C, AvgPredTestHBD,
|
||||
::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_c>));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, AvgPredTestHBD,
|
||||
::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_sse2>));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} // namespace
|
||||
|
|
|
@ -789,13 +789,23 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, Trans16x16DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_neon,
|
||||
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_NEON && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_fdct16x16_neon, &idct16x16_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct16x16_neon, &idct16x16_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct16x16_neon, &vpx_idct16x16_256_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
|
|
|
@ -145,11 +145,17 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, PartialFdctTest,
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_1_neon, 32, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct16x16_1_neon, 16, VPX_BITS_8),
|
||||
::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_neon, 32, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct32x32_1_neon, 32, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct32x32_1_neon, 32, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_fdct16x16_1_neon, 16, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct16x16_1_neon, 16, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct16x16_1_neon, 16, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_10),
|
||||
make_tuple(&vpx_fdct8x8_1_neon, 8, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_10),
|
||||
make_tuple(&vpx_fdct4x4_1_neon, 4, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
|
|
|
@ -539,6 +539,18 @@ INSTANTIATE_TEST_SUITE_P(AVX2, TransDCT,
|
|||
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static const FuncInfo dct_neon_func_info[] = {
|
||||
{ &fdct_wrapper<vpx_highbd_fdct4x4_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct4x4_16_add_neon>, 4, 2 },
|
||||
{ &fdct_wrapper<vpx_highbd_fdct8x8_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct8x8_64_add_neon>, 8, 2 },
|
||||
{ &fdct_wrapper<vpx_highbd_fdct16x16_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct16x16_256_add_neon>, 16, 2 },
|
||||
/* { &fdct_wrapper<vpx_highbd_fdct32x32_neon>,
|
||||
&highbd_idct_wrapper<vpx_highbd_idct32x32_1024_add_neon>, 32, 2 },*/
|
||||
};
|
||||
#else
|
||||
static const FuncInfo dct_neon_func_info[4] = {
|
||||
{ &fdct_wrapper<vpx_fdct4x4_neon>, &idct_wrapper<vpx_idct4x4_16_add_neon>, 4,
|
||||
1 },
|
||||
|
@ -549,12 +561,15 @@ static const FuncInfo dct_neon_func_info[4] = {
|
|||
{ &fdct_wrapper<vpx_fdct32x32_neon>,
|
||||
&idct_wrapper<vpx_idct32x32_1024_add_neon>, 32, 1 }
|
||||
};
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, TransDCT,
|
||||
::testing::Combine(::testing::Range(0, 4),
|
||||
::testing::Values(dct_neon_func_info),
|
||||
::testing::Values(0), ::testing::Values(VPX_BITS_8)));
|
||||
::testing::Combine(
|
||||
::testing::Range(0, static_cast<int>(sizeof(dct_neon_func_info) /
|
||||
sizeof(dct_neon_func_info[0]))),
|
||||
::testing::Values(dct_neon_func_info), ::testing::Values(0),
|
||||
::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
|
||||
|
@ -652,10 +667,16 @@ static const FuncInfo ht_neon_func_info[] = {
|
|||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{ &vp9_highbd_fht4x4_c, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_neon>, 4,
|
||||
2 },
|
||||
{ &vp9_highbd_fht4x4_neon, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_neon>,
|
||||
4, 2 },
|
||||
{ &vp9_highbd_fht8x8_c, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>, 8,
|
||||
2 },
|
||||
{ &vp9_highbd_fht8x8_neon, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>,
|
||||
8, 2 },
|
||||
{ &vp9_highbd_fht16x16_c,
|
||||
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
|
||||
{ &vp9_highbd_fht16x16_neon,
|
||||
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
|
||||
#endif
|
||||
{ &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
|
||||
{ &vp9_fht4x4_neon, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
|
||||
|
|
|
@ -233,8 +233,8 @@ TEST(EncodeAPI, SetRoi) {
|
|||
roi.roi_map = roi_map;
|
||||
// VP8 only. This value isn't range checked.
|
||||
roi.static_threshold[1] = 1000;
|
||||
roi.static_threshold[2] = INT_MIN;
|
||||
roi.static_threshold[3] = INT_MAX;
|
||||
roi.static_threshold[2] = UINT_MAX / 2 + 1;
|
||||
roi.static_threshold[3] = UINT_MAX;
|
||||
|
||||
for (const auto delta : { -63, -1, 0, 1, 63 }) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
|
@ -336,7 +336,7 @@ TEST(EncodeAPI, ConfigChangeThreadCount) {
|
|||
for (const auto *iface : kCodecIfaces) {
|
||||
SCOPED_TRACE(vpx_codec_iface_name(iface));
|
||||
for (int i = 0; i < (IsVP9(iface) ? 2 : 1); ++i) {
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
vpx_codec_enc_cfg_t cfg = {};
|
||||
struct Encoder {
|
||||
~Encoder() { EXPECT_EQ(vpx_codec_destroy(&ctx), VPX_CODEC_OK); }
|
||||
vpx_codec_ctx_t ctx = {};
|
||||
|
|
|
@ -52,7 +52,8 @@ void Encoder::InitEncoder(VideoSource *video) {
|
|||
}
|
||||
}
|
||||
|
||||
void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
void Encoder::EncodeFrame(VideoSource *video,
|
||||
const vpx_enc_frame_flags_t frame_flags) {
|
||||
if (video->img()) {
|
||||
EncodeFrameInternal(*video, frame_flags);
|
||||
} else {
|
||||
|
@ -70,7 +71,7 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
|||
}
|
||||
|
||||
void Encoder::EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags) {
|
||||
const vpx_enc_frame_flags_t frame_flags) {
|
||||
vpx_codec_err_t res;
|
||||
const vpx_image_t *img = video.img();
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class Encoder {
|
|||
}
|
||||
// This is a thin wrapper around vpx_codec_encode(), so refer to
|
||||
// vpx_encoder.h for its semantics.
|
||||
void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
|
||||
void EncodeFrame(VideoSource *video, vpx_enc_frame_flags_t frame_flags);
|
||||
|
||||
// Convenience wrapper for EncodeFrame()
|
||||
void EncodeFrame(VideoSource *video) { EncodeFrame(video, 0); }
|
||||
|
@ -184,7 +184,7 @@ class Encoder {
|
|||
|
||||
// Encode an image
|
||||
void EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags);
|
||||
vpx_enc_frame_flags_t frame_flags);
|
||||
|
||||
// Flush the encoder on EOS
|
||||
void Flush();
|
||||
|
@ -289,7 +289,7 @@ class EncoderTest {
|
|||
unsigned long deadline_;
|
||||
TwopassStatsStore stats_;
|
||||
unsigned long init_flags_;
|
||||
unsigned long frame_flags_;
|
||||
vpx_enc_frame_flags_t frame_flags_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
|
|
@ -496,7 +496,7 @@ class ErrorResilienceTestLargeCodecControls
|
|||
++tot_frame_number_;
|
||||
}
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
virtual void EndPassHook() {
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
|
||||
|
|
|
@ -264,7 +264,8 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, HadamardLowbdTest,
|
||||
::testing::Values(HadamardFuncWithSize(&vpx_hadamard_8x8_neon, 8),
|
||||
HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16)));
|
||||
HadamardFuncWithSize(&vpx_hadamard_16x16_neon, 16),
|
||||
HadamardFuncWithSize(&vpx_hadamard_32x32_neon, 32)));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
// TODO(jingning): Remove highbitdepth flag when the SIMD functions are
|
||||
|
|
|
@ -47,7 +47,7 @@ class MD5 {
|
|||
MD5Update(&md5_, data, static_cast<uint32_t>(size));
|
||||
}
|
||||
|
||||
const char *Get(void) {
|
||||
const char *Get() {
|
||||
static const char hex[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
|
@ -458,14 +462,13 @@ TEST_P(VpxMbPostProcDownTest, CheckLowFilterOutput) {
|
|||
|
||||
SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
|
||||
|
||||
unsigned char *expected_output = new unsigned char[rows_ * cols_];
|
||||
std::unique_ptr<unsigned char[]> expected_output(
|
||||
new unsigned char[rows_ * cols_]);
|
||||
ASSERT_NE(expected_output, nullptr);
|
||||
SetRows(expected_output, rows_, cols_, cols_);
|
||||
SetRows(expected_output.get(), rows_, cols_, cols_);
|
||||
|
||||
RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(), q2mbl(0),
|
||||
expected_output);
|
||||
|
||||
delete[] expected_output;
|
||||
expected_output.get());
|
||||
}
|
||||
|
||||
TEST_P(VpxMbPostProcDownTest, CheckCvsAssembly) {
|
||||
|
|
|
@ -95,10 +95,11 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
unsigned int initial_h, unsigned int *w,
|
||||
unsigned int *h, bool flag_codec,
|
||||
bool smaller_width_larger_size_) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
|
||||
if (smaller_width_larger_size_) {
|
||||
if (frame < 30) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 100) {
|
||||
|
@ -109,8 +110,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 10) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 20) {
|
||||
|
@ -124,8 +123,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 40) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 50) {
|
||||
|
@ -139,8 +136,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 70) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 80) {
|
||||
|
@ -159,8 +154,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 110) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 120) {
|
||||
|
@ -179,8 +172,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 150) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 160) {
|
||||
|
@ -199,8 +190,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 190) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 200) {
|
||||
|
@ -219,8 +208,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 230) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
if (frame < 240) {
|
||||
|
@ -234,8 +221,6 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
return;
|
||||
}
|
||||
if (frame < 260) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
return;
|
||||
}
|
||||
// Go down very low.
|
||||
|
@ -248,13 +233,9 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
|||
// Cases that only works for VP9.
|
||||
// For VP9: Swap width and height of original.
|
||||
if (frame < 320) {
|
||||
*w = initial_h;
|
||||
*h = initial_w;
|
||||
return;
|
||||
}
|
||||
}
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
}
|
||||
|
||||
class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
|
||||
|
@ -796,10 +777,7 @@ TEST_P(ResizeCspTest, TestResizeCspWorks) {
|
|||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES);
|
||||
// TODO(https://crbug.com/webm/1768): VP9 should use ONE_PASS_TEST_MODES for
|
||||
// the ResizeTest instantiation after segfault is fixed.
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeTest,
|
||||
::testing::Values(::libvpx_test::kRealTime));
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeInternalTest,
|
||||
::testing::Values(::libvpx_test::kOnePassBest));
|
||||
VP9_INSTANTIATE_TEST_SUITE(ResizeRealtimeTest,
|
||||
|
|
|
@ -311,13 +311,13 @@ class SADTest : public AbstractBench, public SADTestBase<SadMxNParam> {
|
|||
ASSERT_EQ(reference_sad, exp_sad);
|
||||
}
|
||||
|
||||
void Run() {
|
||||
void Run() override {
|
||||
params_.func(source_data_, source_stride_, reference_data_,
|
||||
reference_stride_);
|
||||
}
|
||||
};
|
||||
|
||||
class SADavgTest : public SADTestBase<SadMxNAvgParam> {
|
||||
class SADavgTest : public AbstractBench, public SADTestBase<SadMxNAvgParam> {
|
||||
public:
|
||||
SADavgTest() : SADTestBase(GetParam()) {}
|
||||
|
||||
|
@ -338,6 +338,11 @@ class SADavgTest : public SADTestBase<SadMxNAvgParam> {
|
|||
|
||||
ASSERT_EQ(reference_sad, exp_sad);
|
||||
}
|
||||
|
||||
void Run() override {
|
||||
params_.func(source_data_, source_stride_, reference_data_,
|
||||
reference_stride_, second_pred_);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(SADTest, MaxRef) {
|
||||
|
@ -437,6 +442,19 @@ TEST_P(SADavgTest, ShortSrc) {
|
|||
source_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADavgTest, DISABLED_Speed) {
|
||||
const int kCountSpeedTestBlock = 50000000 / (params_.width * params_.height);
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(reference_data_, reference_stride_);
|
||||
FillRandom(second_pred_, params_.width);
|
||||
|
||||
RunNTimes(kCountSpeedTestBlock);
|
||||
|
||||
char title[16];
|
||||
snprintf(title, sizeof(title), "%dx%d", params_.width, params_.height);
|
||||
PrintMedian(title);
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, MaxRef) {
|
||||
FillConstant(source_data_, source_stride_, 0);
|
||||
FillConstant(GetReference(0), reference_stride_, mask_);
|
||||
|
@ -517,14 +535,12 @@ TEST_P(SADx4Test, DISABLED_Speed) {
|
|||
uint32_t reference_sad[4];
|
||||
DECLARE_ALIGNED(kDataAlignment, uint32_t, exp_sad[4]);
|
||||
vpx_usec_timer timer;
|
||||
|
||||
memset(reference_sad, 0, sizeof(reference_sad));
|
||||
SADs(exp_sad);
|
||||
for (int block = 0; block < 4; ++block) {
|
||||
reference_sad[block] = ReferenceSAD(GetBlockRefOffset(block));
|
||||
}
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int i = 0; i < kCountSpeedTestBlock; ++i) {
|
||||
for (int block = 0; block < 4; ++block) {
|
||||
reference_sad[block] = ReferenceSAD(GetBlockRefOffset(block));
|
||||
}
|
||||
SADs(exp_sad);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
for (int block = 0; block < 4; ++block) {
|
||||
|
@ -729,6 +745,45 @@ const SadMxNParam neon_tests[] = {
|
|||
SadMxNParam(8, 4, &vpx_sad8x4_neon),
|
||||
SadMxNParam(4, 8, &vpx_sad4x8_neon),
|
||||
SadMxNParam(4, 4, &vpx_sad4x4_neon),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
SadMxNParam(4, 4, &vpx_highbd_sad4x4_neon, 8),
|
||||
SadMxNParam(4, 8, &vpx_highbd_sad4x8_neon, 8),
|
||||
SadMxNParam(8, 4, &vpx_highbd_sad8x4_neon, 8),
|
||||
SadMxNParam(8, 8, &vpx_highbd_sad8x8_neon, 8),
|
||||
SadMxNParam(8, 16, &vpx_highbd_sad8x16_neon, 8),
|
||||
SadMxNParam(16, 8, &vpx_highbd_sad16x8_neon, 8),
|
||||
SadMxNParam(16, 16, &vpx_highbd_sad16x16_neon, 8),
|
||||
SadMxNParam(16, 32, &vpx_highbd_sad16x32_neon, 8),
|
||||
SadMxNParam(32, 32, &vpx_highbd_sad32x32_neon, 8),
|
||||
SadMxNParam(32, 64, &vpx_highbd_sad32x64_neon, 8),
|
||||
SadMxNParam(64, 32, &vpx_highbd_sad64x32_neon, 8),
|
||||
SadMxNParam(64, 64, &vpx_highbd_sad64x64_neon, 8),
|
||||
SadMxNParam(4, 4, &vpx_highbd_sad4x4_neon, 10),
|
||||
SadMxNParam(4, 8, &vpx_highbd_sad4x8_neon, 10),
|
||||
SadMxNParam(8, 4, &vpx_highbd_sad8x4_neon, 10),
|
||||
SadMxNParam(8, 8, &vpx_highbd_sad8x8_neon, 10),
|
||||
SadMxNParam(8, 16, &vpx_highbd_sad8x16_neon, 10),
|
||||
SadMxNParam(16, 8, &vpx_highbd_sad16x8_neon, 10),
|
||||
SadMxNParam(16, 16, &vpx_highbd_sad16x16_neon, 10),
|
||||
SadMxNParam(16, 32, &vpx_highbd_sad16x32_neon, 10),
|
||||
SadMxNParam(32, 32, &vpx_highbd_sad32x32_neon, 10),
|
||||
SadMxNParam(32, 64, &vpx_highbd_sad32x64_neon, 10),
|
||||
SadMxNParam(64, 32, &vpx_highbd_sad64x32_neon, 10),
|
||||
SadMxNParam(64, 64, &vpx_highbd_sad64x64_neon, 10),
|
||||
SadMxNParam(4, 4, &vpx_highbd_sad4x4_neon, 12),
|
||||
SadMxNParam(4, 8, &vpx_highbd_sad4x8_neon, 12),
|
||||
SadMxNParam(8, 4, &vpx_highbd_sad8x4_neon, 12),
|
||||
SadMxNParam(8, 8, &vpx_highbd_sad8x8_neon, 12),
|
||||
SadMxNParam(8, 16, &vpx_highbd_sad8x16_neon, 12),
|
||||
SadMxNParam(16, 8, &vpx_highbd_sad16x8_neon, 12),
|
||||
SadMxNParam(16, 16, &vpx_highbd_sad16x16_neon, 12),
|
||||
SadMxNParam(16, 32, &vpx_highbd_sad16x32_neon, 12),
|
||||
SadMxNParam(32, 32, &vpx_highbd_sad32x32_neon, 12),
|
||||
SadMxNParam(32, 64, &vpx_highbd_sad32x64_neon, 12),
|
||||
SadMxNParam(64, 32, &vpx_highbd_sad64x32_neon, 12),
|
||||
SadMxNParam(64, 64, &vpx_highbd_sad64x64_neon, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
|
||||
|
||||
|
@ -746,6 +801,47 @@ const SadMxNAvgParam avg_neon_tests[] = {
|
|||
SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_neon),
|
||||
SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_neon),
|
||||
SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_neon),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_neon, 8),
|
||||
SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_neon, 8),
|
||||
SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_neon, 8),
|
||||
SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_neon, 8),
|
||||
SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_neon, 8),
|
||||
SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_neon, 8),
|
||||
SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_neon, 8),
|
||||
SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_neon, 8),
|
||||
SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_neon, 8),
|
||||
SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_neon, 8),
|
||||
SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_neon, 8),
|
||||
SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_neon, 8),
|
||||
SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_neon, 8),
|
||||
SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_neon, 10),
|
||||
SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_neon, 10),
|
||||
SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_neon, 10),
|
||||
SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_neon, 10),
|
||||
SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_neon, 10),
|
||||
SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_neon, 10),
|
||||
SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_neon, 10),
|
||||
SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_neon, 10),
|
||||
SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_neon, 10),
|
||||
SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_neon, 10),
|
||||
SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_neon, 10),
|
||||
SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_neon, 10),
|
||||
SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_neon, 10),
|
||||
SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_neon, 12),
|
||||
SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_neon, 12),
|
||||
SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_neon, 12),
|
||||
SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_neon, 12),
|
||||
SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_neon, 12),
|
||||
SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_neon, 12),
|
||||
SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_neon, 12),
|
||||
SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_neon, 12),
|
||||
SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_neon, 12),
|
||||
SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_neon, 12),
|
||||
SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_neon, 12),
|
||||
SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_neon, 12),
|
||||
SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_neon, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests));
|
||||
|
||||
|
@ -763,6 +859,44 @@ const SadMxNx4Param x4d_neon_tests[] = {
|
|||
SadMxNx4Param(8, 4, &vpx_sad8x4x4d_neon),
|
||||
SadMxNx4Param(4, 8, &vpx_sad4x8x4d_neon),
|
||||
SadMxNx4Param(4, 4, &vpx_sad4x4x4d_neon),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_neon, 8),
|
||||
SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_neon, 8),
|
||||
SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_neon, 8),
|
||||
SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_neon, 8),
|
||||
SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_neon, 8),
|
||||
SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_neon, 8),
|
||||
SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_neon, 8),
|
||||
SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_neon, 8),
|
||||
SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_neon, 8),
|
||||
SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_neon, 8),
|
||||
SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_neon, 8),
|
||||
SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_neon, 8),
|
||||
SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_neon, 10),
|
||||
SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_neon, 10),
|
||||
SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_neon, 10),
|
||||
SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_neon, 10),
|
||||
SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_neon, 10),
|
||||
SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_neon, 10),
|
||||
SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_neon, 10),
|
||||
SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_neon, 10),
|
||||
SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_neon, 10),
|
||||
SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_neon, 10),
|
||||
SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_neon, 10),
|
||||
SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_neon, 10),
|
||||
SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_neon, 12),
|
||||
SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_neon, 12),
|
||||
SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_neon, 12),
|
||||
SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_neon, 12),
|
||||
SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_neon, 12),
|
||||
SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_neon, 12),
|
||||
SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_neon, 12),
|
||||
SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_neon, 12),
|
||||
SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_neon, 12),
|
||||
SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_neon, 12),
|
||||
SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_neon, 12),
|
||||
SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_neon, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
|
||||
#endif // HAVE_NEON
|
||||
|
@ -948,6 +1082,34 @@ const SadMxNParam avx2_tests[] = {
|
|||
SadMxNParam(32, 64, &vpx_sad32x64_avx2),
|
||||
SadMxNParam(32, 32, &vpx_sad32x32_avx2),
|
||||
SadMxNParam(32, 16, &vpx_sad32x16_avx2),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
SadMxNParam(64, 64, &vpx_highbd_sad64x64_avx2, 8),
|
||||
SadMxNParam(64, 32, &vpx_highbd_sad64x32_avx2, 8),
|
||||
SadMxNParam(32, 64, &vpx_highbd_sad32x64_avx2, 8),
|
||||
SadMxNParam(32, 32, &vpx_highbd_sad32x32_avx2, 8),
|
||||
SadMxNParam(32, 16, &vpx_highbd_sad32x16_avx2, 8),
|
||||
SadMxNParam(16, 32, &vpx_highbd_sad16x32_avx2, 8),
|
||||
SadMxNParam(16, 16, &vpx_highbd_sad16x16_avx2, 8),
|
||||
SadMxNParam(16, 8, &vpx_highbd_sad16x8_avx2, 8),
|
||||
|
||||
SadMxNParam(64, 64, &vpx_highbd_sad64x64_avx2, 10),
|
||||
SadMxNParam(64, 32, &vpx_highbd_sad64x32_avx2, 10),
|
||||
SadMxNParam(32, 64, &vpx_highbd_sad32x64_avx2, 10),
|
||||
SadMxNParam(32, 32, &vpx_highbd_sad32x32_avx2, 10),
|
||||
SadMxNParam(32, 16, &vpx_highbd_sad32x16_avx2, 10),
|
||||
SadMxNParam(16, 32, &vpx_highbd_sad16x32_avx2, 10),
|
||||
SadMxNParam(16, 16, &vpx_highbd_sad16x16_avx2, 10),
|
||||
SadMxNParam(16, 8, &vpx_highbd_sad16x8_avx2, 10),
|
||||
|
||||
SadMxNParam(64, 64, &vpx_highbd_sad64x64_avx2, 12),
|
||||
SadMxNParam(64, 32, &vpx_highbd_sad64x32_avx2, 12),
|
||||
SadMxNParam(32, 64, &vpx_highbd_sad32x64_avx2, 12),
|
||||
SadMxNParam(32, 32, &vpx_highbd_sad32x32_avx2, 12),
|
||||
SadMxNParam(32, 16, &vpx_highbd_sad32x16_avx2, 12),
|
||||
SadMxNParam(16, 32, &vpx_highbd_sad16x32_avx2, 12),
|
||||
SadMxNParam(16, 16, &vpx_highbd_sad16x16_avx2, 12),
|
||||
SadMxNParam(16, 8, &vpx_highbd_sad16x8_avx2, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
|
||||
|
||||
|
@ -957,12 +1119,64 @@ const SadMxNAvgParam avg_avx2_tests[] = {
|
|||
SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_avx2),
|
||||
SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_avx2),
|
||||
SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_avx2),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_avx2, 8),
|
||||
SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_avx2, 8),
|
||||
SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_avx2, 8),
|
||||
SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_avx2, 8),
|
||||
SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_avx2, 8),
|
||||
SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_avx2, 8),
|
||||
SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_avx2, 8),
|
||||
SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_avx2, 8),
|
||||
SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_avx2, 10),
|
||||
SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_avx2, 10),
|
||||
SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_avx2, 10),
|
||||
SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_avx2, 10),
|
||||
SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_avx2, 10),
|
||||
SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_avx2, 10),
|
||||
SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_avx2, 10),
|
||||
SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_avx2, 10),
|
||||
SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_avx2, 12),
|
||||
SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_avx2, 12),
|
||||
SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_avx2, 12),
|
||||
SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_avx2, 12),
|
||||
SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_avx2, 12),
|
||||
SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_avx2, 12),
|
||||
SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_avx2, 12),
|
||||
SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_avx2, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
|
||||
|
||||
const SadMxNx4Param x4d_avx2_tests[] = {
|
||||
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx2),
|
||||
SadMxNx4Param(32, 32, &vpx_sad32x32x4d_avx2),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_avx2, 8),
|
||||
SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_avx2, 8),
|
||||
SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_avx2, 8),
|
||||
SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_avx2, 8),
|
||||
SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_avx2, 8),
|
||||
SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_avx2, 8),
|
||||
SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_avx2, 8),
|
||||
SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_avx2, 8),
|
||||
SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_avx2, 10),
|
||||
SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_avx2, 10),
|
||||
SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_avx2, 10),
|
||||
SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_avx2, 10),
|
||||
SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_avx2, 10),
|
||||
SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_avx2, 10),
|
||||
SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_avx2, 10),
|
||||
SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_avx2, 10),
|
||||
SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_avx2, 12),
|
||||
SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_avx2, 12),
|
||||
SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_avx2, 12),
|
||||
SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_avx2, 12),
|
||||
SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_avx2, 12),
|
||||
SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_avx2, 12),
|
||||
SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_avx2, 12),
|
||||
SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_avx2, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
|
||||
|
||||
|
|
|
@ -571,7 +571,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
virtual void EndPassHook() {
|
||||
if (change_bitrate_) last_pts_ = last_pts_ - last_pts_ref_;
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
for (int sl = 0; sl < number_spatial_layers_; ++sl) {
|
||||
|
@ -1203,6 +1203,37 @@ TEST_P(DatarateOnePassCbrSvcMultiBR, OnePassCbrSvc2SL3TL) {
|
|||
#endif
|
||||
}
|
||||
|
||||
// Check basic rate targeting for 1 pass VBR SVC: 2 spatial layers and
|
||||
// 3 temporal layers. Run VGA clip with 1 thread.
|
||||
TEST_P(DatarateOnePassCbrSvcMultiBR, OnePassVbrSvc2SL3TL) {
|
||||
SetSvcConfig(2, 3);
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_buf_optimal_sz = 500;
|
||||
cfg_.rc_buf_sz = 1000;
|
||||
cfg_.rc_min_quantizer = 2;
|
||||
cfg_.rc_max_quantizer = 56;
|
||||
cfg_.g_threads = 1;
|
||||
cfg_.rc_dropframe_thresh = 30;
|
||||
cfg_.kf_max_dist = 9999;
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
|
||||
0, 400);
|
||||
top_sl_width_ = 640;
|
||||
top_sl_height_ = 480;
|
||||
const int bitrates[3] = { 200, 400, 600 };
|
||||
cfg_.rc_target_bitrate = bitrates[GET_PARAM(2)];
|
||||
ResetModel();
|
||||
AssignLayerBitrates();
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
CheckLayerRateTargeting(number_spatial_layers_, number_temporal_layers_, 0.70,
|
||||
1.3);
|
||||
#if CONFIG_VP9_DECODER
|
||||
// The non-reference frames are expected to be mismatched frames as the
|
||||
// encoder will avoid loopfilter on these frames.
|
||||
EXPECT_EQ(GetNonRefFrames(), GetMismatchFrames());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Params: speed setting, layer framedrop control and index for bitrate array.
|
||||
class DatarateOnePassCbrSvcFrameDropMultiBR
|
||||
: public DatarateOnePassCbrSvc,
|
||||
|
|
|
@ -59,6 +59,7 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.h
|
|||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_end_to_end_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += timestamp_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_ext_ratectrl_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += ../vp9/simple_encode.h
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.h
|
||||
|
|
|
@ -133,7 +133,7 @@ vpx_config_option_enabled() {
|
|||
vpx_config_option="${1}"
|
||||
vpx_config_file="${LIBVPX_CONFIG_PATH}/vpx_config.h"
|
||||
config_line=$(grep "${vpx_config_option}" "${vpx_config_file}")
|
||||
if echo "${config_line}" | egrep -q '1$'; then
|
||||
if echo "${config_line}" | grep -E -q '1$'; then
|
||||
echo yes
|
||||
fi
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ filter_strings() {
|
|||
|
||||
if [ -n "${filter}" ]; then
|
||||
for s in ${strings}; do
|
||||
if echo "${s}" | egrep -q ${exclude} "${filter}" > /dev/null 2>&1; then
|
||||
if echo "${s}" | grep -E -q ${exclude} "${filter}" > /dev/null 2>&1; then
|
||||
filtered_strings="${filtered_strings} ${s}"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -488,8 +488,8 @@ void MainTestClass<VarianceFunctionType>::SpeedTest() {
|
|||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
|
||||
printf("Variance %dx%d time: %5d ms\n", width(), height(),
|
||||
elapsed_time / 1000);
|
||||
printf("Variance %dx%d %dbpp time: %5d ms\n", width(), height(),
|
||||
params_.bit_depth, elapsed_time / 1000);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -499,14 +499,21 @@ template <typename FunctionType>
|
|||
void MainTestClass<FunctionType>::RefTestMse() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
for (int j = 0; j < block_size(); ++j) {
|
||||
src_[j] = rnd_.Rand8();
|
||||
ref_[j] = rnd_.Rand8();
|
||||
if (!use_high_bit_depth()) {
|
||||
src_[j] = rnd_.Rand8();
|
||||
ref_[j] = rnd_.Rand8();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask();
|
||||
CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask();
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
const int stride = width();
|
||||
ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
|
||||
variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
|
||||
stride, &sse2, false, VPX_BITS_8);
|
||||
stride, &sse2, use_high_bit_depth(), params_.bit_depth);
|
||||
EXPECT_EQ(sse1, sse2);
|
||||
}
|
||||
}
|
||||
|
@ -530,8 +537,15 @@ void MainTestClass<FunctionType>::RefTestSse() {
|
|||
|
||||
template <typename FunctionType>
|
||||
void MainTestClass<FunctionType>::MaxTestMse() {
|
||||
memset(src_, 255, block_size());
|
||||
memset(ref_, 0, block_size());
|
||||
if (!use_high_bit_depth()) {
|
||||
memset(src_, 255, block_size());
|
||||
memset(ref_, 0, block_size());
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << byte_shift(), block_size());
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 0, block_size());
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
unsigned int sse;
|
||||
ASM_REGISTER_STATE_CHECK(params_.func(src_, width(), ref_, width(), &sse));
|
||||
const unsigned int expected = block_size() * 255 * 255;
|
||||
|
@ -854,25 +868,25 @@ TEST_P(VpxHBDSubpelVarianceTest, Ref) { RefTest(); }
|
|||
TEST_P(VpxHBDSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
|
||||
TEST_P(VpxHBDSubpelAvgVarianceTest, Ref) { RefTest(); }
|
||||
|
||||
/* TODO(debargha): This test does not support the highbd version
|
||||
typedef MainTestClass<vpx_variance_fn_t> VpxHBDMseTest;
|
||||
TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
|
||||
TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
|
||||
TEST_P(VpxHBDMseTest, DISABLED_Speed) { SpeedTest(); }
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
C, VpxHBDMseTest,
|
||||
::testing::Values(MseParams(4, 4, &vpx_highbd_12_mse16x16_c),
|
||||
MseParams(4, 4, &vpx_highbd_12_mse16x8_c),
|
||||
MseParams(4, 4, &vpx_highbd_12_mse8x16_c),
|
||||
MseParams(4, 4, &vpx_highbd_12_mse8x8_c),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse16x16_c),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse16x8_c),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse8x16_c),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse8x8_c),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse16x16_c),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse16x8_c),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse8x16_c),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse8x8_c)));
|
||||
*/
|
||||
::testing::Values(MseParams(4, 4, &vpx_highbd_12_mse16x16_c, VPX_BITS_12),
|
||||
MseParams(4, 3, &vpx_highbd_12_mse16x8_c, VPX_BITS_12),
|
||||
MseParams(3, 4, &vpx_highbd_12_mse8x16_c, VPX_BITS_12),
|
||||
MseParams(3, 3, &vpx_highbd_12_mse8x8_c, VPX_BITS_12),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse16x16_c, VPX_BITS_10),
|
||||
MseParams(4, 3, &vpx_highbd_10_mse16x8_c, VPX_BITS_10),
|
||||
MseParams(3, 4, &vpx_highbd_10_mse8x16_c, VPX_BITS_10),
|
||||
MseParams(3, 3, &vpx_highbd_10_mse8x8_c, VPX_BITS_10),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse16x16_c, VPX_BITS_8),
|
||||
MseParams(4, 3, &vpx_highbd_8_mse16x8_c, VPX_BITS_8),
|
||||
MseParams(3, 4, &vpx_highbd_8_mse8x16_c, VPX_BITS_8),
|
||||
MseParams(3, 3, &vpx_highbd_8_mse8x8_c, VPX_BITS_8)));
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VpxHBDMseTest);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
|
@ -1138,22 +1152,15 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
SubpelAvgVarianceParams(2, 2, &vpx_sub_pixel_avg_variance4x4_sse2, 0)));
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
/* TODO(debargha): This test does not support the highbd version
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, VpxHBDMseTest,
|
||||
::testing::Values(MseParams(4, 4, &vpx_highbd_12_mse16x16_sse2),
|
||||
MseParams(4, 3, &vpx_highbd_12_mse16x8_sse2),
|
||||
MseParams(3, 4, &vpx_highbd_12_mse8x16_sse2),
|
||||
MseParams(3, 3, &vpx_highbd_12_mse8x8_sse2),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse16x16_sse2),
|
||||
MseParams(4, 3, &vpx_highbd_10_mse16x8_sse2),
|
||||
MseParams(3, 4, &vpx_highbd_10_mse8x16_sse2),
|
||||
MseParams(3, 3, &vpx_highbd_10_mse8x8_sse2),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse16x16_sse2),
|
||||
MseParams(4, 3, &vpx_highbd_8_mse16x8_sse2),
|
||||
MseParams(3, 4, &vpx_highbd_8_mse8x16_sse2),
|
||||
MseParams(3, 3, &vpx_highbd_8_mse8x8_sse2)));
|
||||
*/
|
||||
::testing::Values(
|
||||
MseParams(4, 4, &vpx_highbd_12_mse16x16_sse2, VPX_BITS_12),
|
||||
MseParams(3, 3, &vpx_highbd_12_mse8x8_sse2, VPX_BITS_12),
|
||||
MseParams(4, 4, &vpx_highbd_10_mse16x16_sse2, VPX_BITS_10),
|
||||
MseParams(3, 3, &vpx_highbd_10_mse8x8_sse2, VPX_BITS_10),
|
||||
MseParams(4, 4, &vpx_highbd_8_mse16x16_sse2, VPX_BITS_8),
|
||||
MseParams(3, 3, &vpx_highbd_8_mse8x8_sse2, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSE2, VpxHBDVarianceTest,
|
||||
|
@ -1495,6 +1502,224 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
SubpelAvgVarianceParams(3, 2, &vpx_sub_pixel_avg_variance8x4_neon, 0),
|
||||
SubpelAvgVarianceParams(2, 3, &vpx_sub_pixel_avg_variance4x8_neon, 0),
|
||||
SubpelAvgVarianceParams(2, 2, &vpx_sub_pixel_avg_variance4x4_neon, 0)));
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, VpxHBDVarianceTest,
|
||||
::testing::Values(
|
||||
VarianceParams(6, 6, &vpx_highbd_12_variance64x64_neon, 12),
|
||||
VarianceParams(6, 5, &vpx_highbd_12_variance64x32_neon, 12),
|
||||
VarianceParams(5, 6, &vpx_highbd_12_variance32x64_neon, 12),
|
||||
VarianceParams(5, 5, &vpx_highbd_12_variance32x32_neon, 12),
|
||||
VarianceParams(5, 4, &vpx_highbd_12_variance32x16_neon, 12),
|
||||
VarianceParams(4, 5, &vpx_highbd_12_variance16x32_neon, 12),
|
||||
VarianceParams(4, 4, &vpx_highbd_12_variance16x16_neon, 12),
|
||||
VarianceParams(4, 3, &vpx_highbd_12_variance16x8_neon, 12),
|
||||
VarianceParams(3, 4, &vpx_highbd_12_variance8x16_neon, 12),
|
||||
VarianceParams(3, 3, &vpx_highbd_12_variance8x8_neon, 12),
|
||||
VarianceParams(3, 2, &vpx_highbd_12_variance8x4_neon, 12),
|
||||
VarianceParams(2, 3, &vpx_highbd_12_variance4x8_neon, 12),
|
||||
VarianceParams(2, 2, &vpx_highbd_12_variance4x4_neon, 12),
|
||||
VarianceParams(6, 6, &vpx_highbd_10_variance64x64_neon, 10),
|
||||
VarianceParams(6, 5, &vpx_highbd_10_variance64x32_neon, 10),
|
||||
VarianceParams(5, 6, &vpx_highbd_10_variance32x64_neon, 10),
|
||||
VarianceParams(5, 5, &vpx_highbd_10_variance32x32_neon, 10),
|
||||
VarianceParams(5, 4, &vpx_highbd_10_variance32x16_neon, 10),
|
||||
VarianceParams(4, 5, &vpx_highbd_10_variance16x32_neon, 10),
|
||||
VarianceParams(4, 4, &vpx_highbd_10_variance16x16_neon, 10),
|
||||
VarianceParams(4, 3, &vpx_highbd_10_variance16x8_neon, 10),
|
||||
VarianceParams(3, 4, &vpx_highbd_10_variance8x16_neon, 10),
|
||||
VarianceParams(3, 3, &vpx_highbd_10_variance8x8_neon, 10),
|
||||
VarianceParams(3, 2, &vpx_highbd_10_variance8x4_neon, 10),
|
||||
VarianceParams(2, 3, &vpx_highbd_10_variance4x8_neon, 10),
|
||||
VarianceParams(2, 2, &vpx_highbd_10_variance4x4_neon, 10),
|
||||
VarianceParams(6, 6, &vpx_highbd_8_variance64x64_neon, 8),
|
||||
VarianceParams(6, 5, &vpx_highbd_8_variance64x32_neon, 8),
|
||||
VarianceParams(5, 6, &vpx_highbd_8_variance32x64_neon, 8),
|
||||
VarianceParams(5, 5, &vpx_highbd_8_variance32x32_neon, 8),
|
||||
VarianceParams(5, 4, &vpx_highbd_8_variance32x16_neon, 8),
|
||||
VarianceParams(4, 5, &vpx_highbd_8_variance16x32_neon, 8),
|
||||
VarianceParams(4, 4, &vpx_highbd_8_variance16x16_neon, 8),
|
||||
VarianceParams(4, 3, &vpx_highbd_8_variance16x8_neon, 8),
|
||||
VarianceParams(3, 4, &vpx_highbd_8_variance8x16_neon, 8),
|
||||
VarianceParams(3, 3, &vpx_highbd_8_variance8x8_neon, 8),
|
||||
VarianceParams(3, 2, &vpx_highbd_8_variance8x4_neon, 8),
|
||||
VarianceParams(2, 3, &vpx_highbd_8_variance4x8_neon, 8),
|
||||
VarianceParams(2, 2, &vpx_highbd_8_variance4x4_neon, 8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, VpxHBDSubpelVarianceTest,
|
||||
::testing::Values(
|
||||
SubpelVarianceParams(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_neon,
|
||||
12),
|
||||
SubpelVarianceParams(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_neon,
|
||||
12),
|
||||
SubpelVarianceParams(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_neon,
|
||||
12),
|
||||
SubpelVarianceParams(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_neon,
|
||||
12),
|
||||
SubpelVarianceParams(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_neon,
|
||||
12),
|
||||
SubpelVarianceParams(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_neon,
|
||||
12),
|
||||
SubpelVarianceParams(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_neon,
|
||||
12),
|
||||
SubpelVarianceParams(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_neon,
|
||||
12),
|
||||
SubpelVarianceParams(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_neon,
|
||||
12),
|
||||
SubpelVarianceParams(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_neon,
|
||||
12),
|
||||
SubpelVarianceParams(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_neon,
|
||||
12),
|
||||
SubpelVarianceParams(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_neon,
|
||||
10),
|
||||
SubpelVarianceParams(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_neon,
|
||||
10),
|
||||
SubpelVarianceParams(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_neon,
|
||||
10),
|
||||
SubpelVarianceParams(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_neon,
|
||||
10),
|
||||
SubpelVarianceParams(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_neon,
|
||||
10),
|
||||
SubpelVarianceParams(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_neon,
|
||||
10),
|
||||
SubpelVarianceParams(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_neon,
|
||||
10),
|
||||
SubpelVarianceParams(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_neon,
|
||||
10),
|
||||
SubpelVarianceParams(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_neon,
|
||||
10),
|
||||
SubpelVarianceParams(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_neon,
|
||||
10),
|
||||
SubpelVarianceParams(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_neon,
|
||||
10),
|
||||
SubpelVarianceParams(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_neon,
|
||||
8),
|
||||
SubpelVarianceParams(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_neon,
|
||||
8),
|
||||
SubpelVarianceParams(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_neon,
|
||||
8),
|
||||
SubpelVarianceParams(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_neon,
|
||||
8),
|
||||
SubpelVarianceParams(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_neon,
|
||||
8),
|
||||
SubpelVarianceParams(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_neon,
|
||||
8),
|
||||
SubpelVarianceParams(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_neon,
|
||||
8),
|
||||
SubpelVarianceParams(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_neon,
|
||||
8),
|
||||
SubpelVarianceParams(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_neon,
|
||||
8),
|
||||
SubpelVarianceParams(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_neon, 8),
|
||||
SubpelVarianceParams(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_neon,
|
||||
8)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, VpxHBDSubpelAvgVarianceTest,
|
||||
::testing::Values(
|
||||
SubpelAvgVarianceParams(6, 6,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance64x64_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(6, 5,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance64x32_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(5, 6,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance32x64_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(5, 5,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance32x32_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(5, 4,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance32x16_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(4, 5,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance16x32_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(4, 4,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance16x16_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(4, 3,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance16x8_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(3, 4,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance8x16_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(3, 3,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance8x8_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(3, 2,
|
||||
&vpx_highbd_12_sub_pixel_avg_variance8x4_neon,
|
||||
12),
|
||||
SubpelAvgVarianceParams(6, 6,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance64x64_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(6, 5,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance64x32_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(5, 6,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance32x64_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(5, 5,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance32x32_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(5, 4,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance32x16_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(4, 5,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance16x32_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(4, 4,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance16x16_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(4, 3,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance16x8_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(3, 4,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance8x16_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(3, 3,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance8x8_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(3, 2,
|
||||
&vpx_highbd_10_sub_pixel_avg_variance8x4_neon,
|
||||
10),
|
||||
SubpelAvgVarianceParams(6, 6,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance64x64_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(6, 5,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance64x32_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(5, 6,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance32x64_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(5, 5,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance32x32_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(5, 4,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance32x16_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(4, 5,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance16x32_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(4, 4,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance16x16_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(4, 3,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance16x8_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(3, 4,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance8x16_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(3, 3,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance8x8_neon,
|
||||
8),
|
||||
SubpelAvgVarianceParams(3, 2,
|
||||
&vpx_highbd_8_sub_pixel_avg_variance8x4_neon,
|
||||
8)));
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_MSA
|
||||
|
|
|
@ -121,7 +121,7 @@ class DatarateTestLarge
|
|||
++frame_number_;
|
||||
}
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
virtual void EndPassHook() {
|
||||
if (bits_total_) {
|
||||
const double file_size_in_kb = bits_total_ / 1000.; // bits per kilobit
|
||||
|
||||
|
|
|
@ -127,8 +127,7 @@ class Vp8RcInterfaceTest
|
|||
encoder->Control(VP8E_SET_CPUUSED, -6);
|
||||
encoder->Control(VP8E_SET_RTC_EXTERNAL_RATECTRL, 1);
|
||||
encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 1000);
|
||||
}
|
||||
if (frame_params_.frame_type == INTER_FRAME) {
|
||||
} else if (frame_params_.frame_type == INTER_FRAME) {
|
||||
// Disable golden frame update.
|
||||
frame_flags_ |= VP8_EFLAG_NO_UPD_GF;
|
||||
frame_flags_ |= VP8_EFLAG_NO_UPD_ARF;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
#include "./vpx_config.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
|
@ -147,14 +148,16 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest {
|
|||
if (video->frame() == 0) {
|
||||
encoder->Control(VP9E_SET_SVC, 1);
|
||||
}
|
||||
vpx_svc_layer_id_t layer_id;
|
||||
layer_id.spatial_layer_id = 0;
|
||||
frame_flags_ = GetFrameFlags(video->frame(), cfg_.ts_number_layers);
|
||||
layer_id.temporal_layer_id =
|
||||
SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
layer_id.temporal_layer_id_per_spatial[0] =
|
||||
SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
|
||||
if (cfg_.temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
|
||||
vpx_svc_layer_id_t layer_id;
|
||||
frame_flags_ = GetFrameFlags(video->frame(), cfg_.ts_number_layers);
|
||||
layer_id.spatial_layer_id = 0;
|
||||
layer_id.temporal_layer_id =
|
||||
SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
layer_id.temporal_layer_id_per_spatial[0] =
|
||||
SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
|
||||
}
|
||||
}
|
||||
const vpx_rational_t tb = video->timebase();
|
||||
timebase_ = static_cast<double>(tb.num) / tb.den;
|
||||
|
@ -199,7 +202,7 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest {
|
|||
++tot_frame_number_;
|
||||
}
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
virtual void EndPassHook() {
|
||||
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
|
||||
++layer) {
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
|
@ -809,6 +812,135 @@ TEST_P(DatarateTestVP9PostEncodeDrop, PostEncodeDropScreenContent) {
|
|||
<< " The datarate for the file is greater than target by too much!";
|
||||
}
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
class DatarateTestVP9FrameQp
|
||||
: public DatarateTestVP9,
|
||||
public ::testing::TestWithParam<const libvpx_test::CodecFactory *> {
|
||||
public:
|
||||
DatarateTestVP9FrameQp() : DatarateTestVP9(GetParam()), frame_(0) {}
|
||||
virtual ~DatarateTestVP9FrameQp() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kRealTime);
|
||||
ResetModel();
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
set_cpu_used_ = 7;
|
||||
DatarateTestVP9::PreEncodeFrameHook(video, encoder);
|
||||
frame_qp_ = static_cast<int>(rnd_.RandRange(64));
|
||||
encoder->Control(VP9E_SET_QUANTIZER_ONE_PASS, frame_qp_);
|
||||
frame_++;
|
||||
}
|
||||
|
||||
virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
|
||||
int qp = 0;
|
||||
vpx_svc_layer_id_t layer_id;
|
||||
if (frame_ >= total_frame_) return;
|
||||
encoder->Control(VP8E_GET_LAST_QUANTIZER_64, &qp);
|
||||
ASSERT_EQ(frame_qp_, qp);
|
||||
encoder->Control(VP9E_GET_SVC_LAYER_ID, &layer_id);
|
||||
temporal_layer_id_ = layer_id.temporal_layer_id;
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t * /*img1*/,
|
||||
const vpx_image_t * /*img2*/) {
|
||||
if (frame_ >= total_frame_) return;
|
||||
ASSERT_TRUE(cfg_.temporal_layering_mode ==
|
||||
VP9E_TEMPORAL_LAYERING_MODE_0212 &&
|
||||
temporal_layer_id_ == 2);
|
||||
}
|
||||
|
||||
protected:
|
||||
int total_frame_;
|
||||
|
||||
private:
|
||||
ACMRandom rnd_;
|
||||
int frame_qp_;
|
||||
int frame_;
|
||||
int temporal_layer_id_;
|
||||
};
|
||||
|
||||
TEST_P(DatarateTestVP9FrameQp, VP9SetFrameQp) {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_buf_optimal_sz = 500;
|
||||
cfg_.rc_buf_sz = 1000;
|
||||
cfg_.rc_dropframe_thresh = 0;
|
||||
cfg_.rc_min_quantizer = 0;
|
||||
cfg_.rc_max_quantizer = 63;
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
|
||||
total_frame_ = 400;
|
||||
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
|
||||
0, total_frame_);
|
||||
ResetModel();
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
TEST_P(DatarateTestVP9FrameQp, VP9SetFrameQp3TemporalLayersBypass) {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_buf_optimal_sz = 500;
|
||||
cfg_.rc_buf_sz = 1000;
|
||||
cfg_.rc_dropframe_thresh = 0;
|
||||
cfg_.rc_max_quantizer = 63;
|
||||
cfg_.rc_min_quantizer = 0;
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
|
||||
// 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1).
|
||||
cfg_.ss_number_layers = 1;
|
||||
cfg_.ts_number_layers = 3;
|
||||
cfg_.ts_rate_decimator[0] = 4;
|
||||
cfg_.ts_rate_decimator[1] = 2;
|
||||
cfg_.ts_rate_decimator[2] = 1;
|
||||
|
||||
cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
|
||||
cfg_.rc_target_bitrate = 200;
|
||||
total_frame_ = 400;
|
||||
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
|
||||
0, total_frame_);
|
||||
ResetModel();
|
||||
cfg_.layer_target_bitrate[0] = 40 * cfg_.rc_target_bitrate / 100;
|
||||
cfg_.layer_target_bitrate[1] = 60 * cfg_.rc_target_bitrate / 100;
|
||||
cfg_.layer_target_bitrate[2] = cfg_.rc_target_bitrate;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
TEST_P(DatarateTestVP9FrameQp, VP9SetFrameQp3TemporalLayersFixedMode) {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_buf_optimal_sz = 500;
|
||||
cfg_.rc_buf_sz = 1000;
|
||||
cfg_.rc_dropframe_thresh = 0;
|
||||
cfg_.rc_max_quantizer = 63;
|
||||
cfg_.rc_min_quantizer = 0;
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
|
||||
// 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1).
|
||||
cfg_.ss_number_layers = 1;
|
||||
cfg_.ts_number_layers = 3;
|
||||
cfg_.ts_rate_decimator[0] = 4;
|
||||
cfg_.ts_rate_decimator[1] = 2;
|
||||
cfg_.ts_rate_decimator[2] = 1;
|
||||
|
||||
cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_0212;
|
||||
cfg_.rc_target_bitrate = 200;
|
||||
cfg_.g_error_resilient = 1;
|
||||
total_frame_ = 400;
|
||||
::libvpx_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
|
||||
0, total_frame_);
|
||||
ResetModel();
|
||||
cfg_.layer_target_bitrate[0] = 40 * cfg_.rc_target_bitrate / 100;
|
||||
cfg_.layer_target_bitrate[1] = 60 * cfg_.rc_target_bitrate / 100;
|
||||
cfg_.layer_target_bitrate[2] = cfg_.rc_target_bitrate;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_TEMPORAL_DENOISING
|
||||
// Params: speed setting.
|
||||
class DatarateTestVP9RealTimeDenoiser : public DatarateTestVP9RealTime {
|
||||
|
@ -943,6 +1075,13 @@ VP9_INSTANTIATE_TEST_SUITE(DatarateTestVP9LargeVBR, ::testing::Range(5, 9),
|
|||
|
||||
VP9_INSTANTIATE_TEST_SUITE(DatarateTestVP9RealTime, ::testing::Range(5, 10));
|
||||
|
||||
#if CONFIG_VP9
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
VP9, DatarateTestVP9FrameQp,
|
||||
::testing::Values(
|
||||
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)));
|
||||
#endif
|
||||
|
||||
VP9_INSTANTIATE_TEST_SUITE(DatarateTestVP9RealTimeDeltaQUV,
|
||||
::testing::Range(5, 10),
|
||||
::testing::Values(-5, -10, -15));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "test/util.h"
|
||||
#include "test/yuv_video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vp9/simple_encode.h"
|
||||
#include "vpx/vpx_ext_ratectrl.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
|
||||
|
@ -25,6 +26,7 @@ constexpr int kModelMagicNumber = 51396;
|
|||
constexpr uintptr_t PrivMagicNumber = 5566;
|
||||
constexpr int kFrameNum = 5;
|
||||
constexpr int kFrameNumGOP = 30;
|
||||
constexpr int kFrameNumGOPShort = 4;
|
||||
constexpr int kLosslessCodingIndex = 2;
|
||||
constexpr int kFixedGOPSize = 9;
|
||||
// The range check in vp9_cx_iface.c shows that the max
|
||||
|
@ -38,6 +40,8 @@ constexpr int kDefaultMaxGfInterval = 16;
|
|||
// The numbers below are from manual inspection.
|
||||
constexpr int kReadMinGfInterval = 5;
|
||||
constexpr int kReadMaxGfInterval = 13;
|
||||
const char kTestFileName[] = "bus_352x288_420_f20_b8.yuv";
|
||||
const double kPsnrThreshold = 30.50;
|
||||
|
||||
struct ToyRateCtrl {
|
||||
int magic_number;
|
||||
|
@ -50,12 +54,12 @@ struct ToyRateCtrl {
|
|||
|
||||
vpx_rc_status_t rc_create_model(void *priv,
|
||||
const vpx_rc_config_t *ratectrl_config,
|
||||
vpx_rc_model_t *rate_ctrl_model_pt) {
|
||||
vpx_rc_model_t *rate_ctrl_model_ptr) {
|
||||
ToyRateCtrl *toy_rate_ctrl = new (std::nothrow) ToyRateCtrl;
|
||||
if (toy_rate_ctrl == nullptr) return VPX_RC_ERROR;
|
||||
toy_rate_ctrl->magic_number = kModelMagicNumber;
|
||||
toy_rate_ctrl->coding_index = -1;
|
||||
*rate_ctrl_model_pt = toy_rate_ctrl;
|
||||
*rate_ctrl_model_ptr = toy_rate_ctrl;
|
||||
EXPECT_EQ(priv, reinterpret_cast<void *>(PrivMagicNumber));
|
||||
EXPECT_EQ(ratectrl_config->frame_width, 352);
|
||||
EXPECT_EQ(ratectrl_config->frame_height, 288);
|
||||
|
@ -68,7 +72,7 @@ vpx_rc_status_t rc_create_model(void *priv,
|
|||
|
||||
vpx_rc_status_t rc_create_model_gop(void *priv,
|
||||
const vpx_rc_config_t *ratectrl_config,
|
||||
vpx_rc_model_t *rate_ctrl_model_pt) {
|
||||
vpx_rc_model_t *rate_ctrl_model_ptr) {
|
||||
ToyRateCtrl *toy_rate_ctrl = new (std::nothrow) ToyRateCtrl;
|
||||
if (toy_rate_ctrl == nullptr) return VPX_RC_ERROR;
|
||||
toy_rate_ctrl->magic_number = kModelMagicNumber;
|
||||
|
@ -76,7 +80,7 @@ vpx_rc_status_t rc_create_model_gop(void *priv,
|
|||
toy_rate_ctrl->frames_since_key = 0;
|
||||
toy_rate_ctrl->show_index = 0;
|
||||
toy_rate_ctrl->coding_index = 0;
|
||||
*rate_ctrl_model_pt = toy_rate_ctrl;
|
||||
*rate_ctrl_model_ptr = toy_rate_ctrl;
|
||||
EXPECT_EQ(priv, reinterpret_cast<void *>(PrivMagicNumber));
|
||||
EXPECT_EQ(ratectrl_config->frame_width, 640);
|
||||
EXPECT_EQ(ratectrl_config->frame_height, 360);
|
||||
|
@ -87,6 +91,27 @@ vpx_rc_status_t rc_create_model_gop(void *priv,
|
|||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_create_model_gop_short(
|
||||
void *priv, const vpx_rc_config_t *ratectrl_config,
|
||||
vpx_rc_model_t *rate_ctrl_model_ptr) {
|
||||
ToyRateCtrl *toy_rate_ctrl = new (std::nothrow) ToyRateCtrl;
|
||||
if (toy_rate_ctrl == nullptr) return VPX_RC_ERROR;
|
||||
toy_rate_ctrl->magic_number = kModelMagicNumber;
|
||||
toy_rate_ctrl->gop_global_index = 0;
|
||||
toy_rate_ctrl->frames_since_key = 0;
|
||||
toy_rate_ctrl->show_index = 0;
|
||||
toy_rate_ctrl->coding_index = 0;
|
||||
*rate_ctrl_model_ptr = toy_rate_ctrl;
|
||||
EXPECT_EQ(priv, reinterpret_cast<void *>(PrivMagicNumber));
|
||||
EXPECT_EQ(ratectrl_config->frame_width, 352);
|
||||
EXPECT_EQ(ratectrl_config->frame_height, 288);
|
||||
EXPECT_EQ(ratectrl_config->show_frame_count, kFrameNumGOPShort);
|
||||
EXPECT_EQ(ratectrl_config->target_bitrate_kbps, 500);
|
||||
EXPECT_EQ(ratectrl_config->frame_rate_num, 30);
|
||||
EXPECT_EQ(ratectrl_config->frame_rate_den, 1);
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_send_firstpass_stats(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_firstpass_stats_t *first_pass_stats) {
|
||||
|
@ -113,6 +138,19 @@ vpx_rc_status_t rc_send_firstpass_stats_gop(
|
|||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_send_firstpass_stats_gop_short(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_firstpass_stats_t *first_pass_stats) {
|
||||
const ToyRateCtrl *toy_rate_ctrl =
|
||||
static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_EQ(first_pass_stats->num_frames, kFrameNumGOPShort);
|
||||
for (int i = 0; i < first_pass_stats->num_frames; ++i) {
|
||||
EXPECT_DOUBLE_EQ(first_pass_stats->frame_stats[i].frame, i);
|
||||
}
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_get_encodeframe_decision(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_info_t *encode_frame_info,
|
||||
|
@ -128,19 +166,17 @@ vpx_rc_status_t rc_get_encodeframe_decision(
|
|||
if (encode_frame_info->coding_index == 0) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 0 /*kFrameTypeKey*/);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeKey);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index == 1) {
|
||||
} else if (encode_frame_info->coding_index == 1) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 4);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 2 /*kFrameTypeAltRef*/);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeAltRef);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
1); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
|
@ -149,19 +185,15 @@ vpx_rc_status_t rc_get_encodeframe_decision(
|
|||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_coding_indexes[0],
|
||||
0); // kRefFrameTypeLast
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index >= 2 &&
|
||||
encode_frame_info->coding_index < 5) {
|
||||
} else if (encode_frame_info->coding_index >= 2 &&
|
||||
encode_frame_info->coding_index < 5) {
|
||||
// In the first group of pictures, coding_index and gop_index are equal.
|
||||
EXPECT_EQ(encode_frame_info->gop_index, encode_frame_info->coding_index);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 1 /*kFrameTypeInter*/);
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index == 5) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
} else if (encode_frame_info->coding_index == 5) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 4);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 3 /*kFrameTypeOverlay*/);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeOverlay);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
1); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
|
@ -197,19 +229,17 @@ vpx_rc_status_t rc_get_encodeframe_decision_gop(
|
|||
if (encode_frame_info->coding_index == 0) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 0 /*kFrameTypeKey*/);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeKey);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index == 1) {
|
||||
} else if (encode_frame_info->coding_index == 1) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 1 /*kFrameTypeInter*/);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
1); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
|
@ -218,36 +248,198 @@ vpx_rc_status_t rc_get_encodeframe_decision_gop(
|
|||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_coding_indexes[0],
|
||||
0); // kRefFrameTypeLast
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index == 2) {
|
||||
} else if (encode_frame_info->coding_index == 2) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 0 /*kFrameTypeKey*/);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeKey);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index == 3 ||
|
||||
encode_frame_info->coding_index == 12 ||
|
||||
encode_frame_info->coding_index == 21) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 2 /*kFrameTypeAltRef*/);
|
||||
} else if (encode_frame_info->coding_index == 3 ||
|
||||
encode_frame_info->coding_index == 12 ||
|
||||
encode_frame_info->coding_index == 21) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeAltRef);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 1);
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index == 11 ||
|
||||
encode_frame_info->coding_index == 20 ||
|
||||
encode_frame_info->coding_index == 29) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 3 /*kFrameTypeOverlay*/);
|
||||
} else if (encode_frame_info->coding_index == 11 ||
|
||||
encode_frame_info->coding_index == 20 ||
|
||||
encode_frame_info->coding_index == 29) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeOverlay);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
} else if (encode_frame_info->coding_index >= 30) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
}
|
||||
|
||||
if (encode_frame_info->coding_index >= 30) {
|
||||
EXPECT_EQ(encode_frame_info->frame_type, 1 /*kFrameTypeInter*/);
|
||||
// When the model recommends an invalid q, valid range [0, 255],
|
||||
// the encoder will ignore it and use the default q selected
|
||||
// by libvpx rate control strategy.
|
||||
frame_decision->q_index = VPX_DEFAULT_Q;
|
||||
frame_decision->max_frame_size = 0;
|
||||
|
||||
toy_rate_ctrl->coding_index += 1;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_get_encodeframe_decision_gop_short(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_info_t *encode_frame_info,
|
||||
vpx_rc_encodeframe_decision_t *frame_decision) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_LT(encode_frame_info->show_index, kFrameNumGOPShort);
|
||||
EXPECT_EQ(encode_frame_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
if (encode_frame_info->coding_index == 0) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeKey);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 1) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
1); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_coding_indexes[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 2) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 3) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 3);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeGolden);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 2);
|
||||
}
|
||||
|
||||
// When the model recommends an invalid q, valid range [0, 255],
|
||||
// the encoder will ignore it and use the default q selected
|
||||
// by libvpx rate control strategy.
|
||||
frame_decision->q_index = VPX_DEFAULT_Q;
|
||||
frame_decision->max_frame_size = 0;
|
||||
|
||||
toy_rate_ctrl->coding_index += 1;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_get_encodeframe_decision_gop_short_overlay(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_info_t *encode_frame_info,
|
||||
vpx_rc_encodeframe_decision_t *frame_decision) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_LT(encode_frame_info->show_index, kFrameNumGOPShort);
|
||||
EXPECT_EQ(encode_frame_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
if (encode_frame_info->coding_index == 0) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeKey);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 1) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 3);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeAltRef);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
1); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_coding_indexes[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 2) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 3) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 3);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 4) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 3);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeOverlay);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 2);
|
||||
}
|
||||
|
||||
// When the model recommends an invalid q, valid range [0, 255],
|
||||
// the encoder will ignore it and use the default q selected
|
||||
// by libvpx rate control strategy.
|
||||
frame_decision->q_index = VPX_DEFAULT_Q;
|
||||
frame_decision->max_frame_size = 0;
|
||||
|
||||
toy_rate_ctrl->coding_index += 1;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_get_encodeframe_decision_gop_short_no_arf(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_info_t *encode_frame_info,
|
||||
vpx_rc_encodeframe_decision_t *frame_decision) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_LT(encode_frame_info->show_index, kFrameNumGOPShort);
|
||||
EXPECT_EQ(encode_frame_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
if (encode_frame_info->coding_index == 0) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 0);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeKey);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 1) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 1);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
|
||||
1); // kRefFrameTypeLast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[1],
|
||||
0); // kRefFrameTypePast
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_valid_list[2],
|
||||
0); // kRefFrameTypeFuture
|
||||
EXPECT_EQ(encode_frame_info->ref_frame_coding_indexes[0],
|
||||
0); // kRefFrameTypeLast
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 2) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 2);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
} else if (encode_frame_info->coding_index == 3) {
|
||||
EXPECT_EQ(encode_frame_info->show_index, 3);
|
||||
EXPECT_EQ(encode_frame_info->gop_index, 3);
|
||||
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeInter);
|
||||
EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
|
||||
}
|
||||
|
||||
// When the model recommends an invalid q, valid range [0, 255],
|
||||
|
@ -296,6 +488,117 @@ vpx_rc_status_t rc_get_gop_decision(vpx_rc_model_t rate_ctrl_model,
|
|||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
// Test on a 4 frame video.
|
||||
// Test a setting of 2 GOPs.
|
||||
// The first GOP has 3 coding frames, no alt ref.
|
||||
// The second GOP has 1 coding frame, no alt ref.
|
||||
vpx_rc_status_t rc_get_gop_decision_short(vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_gop_info_t *gop_info,
|
||||
vpx_rc_gop_decision_t *gop_decision) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_EQ(gop_info->lag_in_frames, kMaxLagInFrames - 1);
|
||||
EXPECT_EQ(gop_info->min_gf_interval, kDefaultMinGfInterval);
|
||||
EXPECT_EQ(gop_info->max_gf_interval, kDefaultMaxGfInterval);
|
||||
EXPECT_EQ(gop_info->allow_alt_ref, 1);
|
||||
if (gop_info->is_key_frame) {
|
||||
EXPECT_EQ(gop_info->last_gop_use_alt_ref, 0);
|
||||
EXPECT_EQ(gop_info->frames_since_key, 0);
|
||||
EXPECT_EQ(gop_info->gop_global_index, 0);
|
||||
toy_rate_ctrl->gop_global_index = 0;
|
||||
toy_rate_ctrl->frames_since_key = 0;
|
||||
} else {
|
||||
EXPECT_EQ(gop_info->last_gop_use_alt_ref, 0);
|
||||
}
|
||||
EXPECT_EQ(gop_info->gop_global_index, toy_rate_ctrl->gop_global_index);
|
||||
EXPECT_EQ(gop_info->frames_since_key, toy_rate_ctrl->frames_since_key);
|
||||
EXPECT_EQ(gop_info->show_index, toy_rate_ctrl->show_index);
|
||||
EXPECT_EQ(gop_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
gop_decision->gop_coding_frames = gop_info->gop_global_index == 0 ? 3 : 1;
|
||||
gop_decision->use_alt_ref = 0;
|
||||
toy_rate_ctrl->frames_since_key +=
|
||||
gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
|
||||
toy_rate_ctrl->show_index +=
|
||||
gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
|
||||
++toy_rate_ctrl->gop_global_index;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
// Test on a 4 frame video.
|
||||
// Test a setting of 2 GOPs.
|
||||
// The first GOP has 4 coding frames. Use alt ref.
|
||||
// The second GOP only contains the overlay frame of the first GOP's alt ref
|
||||
// frame.
|
||||
vpx_rc_status_t rc_get_gop_decision_short_overlay(
|
||||
vpx_rc_model_t rate_ctrl_model, const vpx_rc_gop_info_t *gop_info,
|
||||
vpx_rc_gop_decision_t *gop_decision) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_EQ(gop_info->lag_in_frames, kMaxLagInFrames - 1);
|
||||
EXPECT_EQ(gop_info->min_gf_interval, kDefaultMinGfInterval);
|
||||
EXPECT_EQ(gop_info->max_gf_interval, kDefaultMaxGfInterval);
|
||||
EXPECT_EQ(gop_info->allow_alt_ref, 1);
|
||||
if (gop_info->is_key_frame) {
|
||||
EXPECT_EQ(gop_info->last_gop_use_alt_ref, 0);
|
||||
EXPECT_EQ(gop_info->frames_since_key, 0);
|
||||
EXPECT_EQ(gop_info->gop_global_index, 0);
|
||||
toy_rate_ctrl->gop_global_index = 0;
|
||||
toy_rate_ctrl->frames_since_key = 0;
|
||||
} else {
|
||||
EXPECT_EQ(gop_info->last_gop_use_alt_ref, 1);
|
||||
}
|
||||
EXPECT_EQ(gop_info->gop_global_index, toy_rate_ctrl->gop_global_index);
|
||||
EXPECT_EQ(gop_info->frames_since_key, toy_rate_ctrl->frames_since_key);
|
||||
EXPECT_EQ(gop_info->show_index, toy_rate_ctrl->show_index);
|
||||
EXPECT_EQ(gop_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
gop_decision->gop_coding_frames = gop_info->gop_global_index == 0 ? 4 : 1;
|
||||
gop_decision->use_alt_ref = gop_info->is_key_frame ? 1 : 0;
|
||||
toy_rate_ctrl->frames_since_key +=
|
||||
gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
|
||||
toy_rate_ctrl->show_index +=
|
||||
gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
|
||||
++toy_rate_ctrl->gop_global_index;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
// Test on a 4 frame video.
|
||||
// Test a setting of 1 GOP.
|
||||
// The GOP has 4 coding frames. Do not use alt ref.
|
||||
vpx_rc_status_t rc_get_gop_decision_short_no_arf(
|
||||
vpx_rc_model_t rate_ctrl_model, const vpx_rc_gop_info_t *gop_info,
|
||||
vpx_rc_gop_decision_t *gop_decision) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_EQ(gop_info->lag_in_frames, kMaxLagInFrames - 1);
|
||||
EXPECT_EQ(gop_info->min_gf_interval, kDefaultMinGfInterval);
|
||||
EXPECT_EQ(gop_info->max_gf_interval, kDefaultMaxGfInterval);
|
||||
EXPECT_EQ(gop_info->allow_alt_ref, 1);
|
||||
if (gop_info->is_key_frame) {
|
||||
EXPECT_EQ(gop_info->last_gop_use_alt_ref, 0);
|
||||
EXPECT_EQ(gop_info->frames_since_key, 0);
|
||||
EXPECT_EQ(gop_info->gop_global_index, 0);
|
||||
toy_rate_ctrl->gop_global_index = 0;
|
||||
toy_rate_ctrl->frames_since_key = 0;
|
||||
} else {
|
||||
EXPECT_EQ(gop_info->last_gop_use_alt_ref, 0);
|
||||
}
|
||||
EXPECT_EQ(gop_info->gop_global_index, toy_rate_ctrl->gop_global_index);
|
||||
EXPECT_EQ(gop_info->frames_since_key, toy_rate_ctrl->frames_since_key);
|
||||
EXPECT_EQ(gop_info->show_index, toy_rate_ctrl->show_index);
|
||||
EXPECT_EQ(gop_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
gop_decision->gop_coding_frames = gop_info->gop_global_index == 0 ? 4 : 1;
|
||||
gop_decision->use_alt_ref = 0;
|
||||
toy_rate_ctrl->frames_since_key +=
|
||||
gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
|
||||
toy_rate_ctrl->show_index +=
|
||||
gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
|
||||
++toy_rate_ctrl->gop_global_index;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_update_encodeframe_result(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_result_t *encode_frame_result) {
|
||||
|
@ -328,6 +631,31 @@ vpx_rc_status_t rc_update_encodeframe_result_gop(
|
|||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_update_encodeframe_result_gop_short(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_result_t *encode_frame_result) {
|
||||
const ToyRateCtrl *toy_rate_ctrl =
|
||||
static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
|
||||
const int64_t ref_pixel_count = 352 * 288 * 3 / 2;
|
||||
EXPECT_EQ(encode_frame_result->pixel_count, ref_pixel_count);
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_get_default_frame_rdmult(
|
||||
vpx_rc_model_t rate_ctrl_model,
|
||||
const vpx_rc_encodeframe_info_t *encode_frame_info, int *rdmult) {
|
||||
const ToyRateCtrl *toy_rate_ctrl =
|
||||
static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
EXPECT_LT(encode_frame_info->show_index, kFrameNumGOPShort);
|
||||
EXPECT_EQ(encode_frame_info->coding_index, toy_rate_ctrl->coding_index);
|
||||
|
||||
*rdmult = VPX_DEFAULT_RDMULT;
|
||||
return VPX_RC_OK;
|
||||
}
|
||||
|
||||
vpx_rc_status_t rc_delete_model(vpx_rc_model_t rate_ctrl_model) {
|
||||
ToyRateCtrl *toy_rate_ctrl = static_cast<ToyRateCtrl *>(rate_ctrl_model);
|
||||
EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
|
||||
|
@ -371,7 +699,7 @@ TEST_F(ExtRateCtrlTest, EncodeTest) {
|
|||
"bus_352x288_420_f20_b8.yuv", VPX_IMG_FMT_I420, 352, 288, 30, 1, 0,
|
||||
kFrameNum));
|
||||
|
||||
ASSERT_NE(video.get(), nullptr);
|
||||
ASSERT_NE(video, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
|
@ -417,8 +745,220 @@ TEST_F(ExtRateCtrlTestGOP, EncodeTest) {
|
|||
"noisy_clip_640_360.y4m", VPX_IMG_FMT_I420, 640, 360, 30, 1, 0,
|
||||
kFrameNumGOP));
|
||||
|
||||
ASSERT_NE(video.get(), nullptr);
|
||||
ASSERT_NE(video, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
class ExtRateCtrlTestGOPShort : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
ExtRateCtrlTestGOPShort() : EncoderTest(&::libvpx_test::kVP9) {}
|
||||
|
||||
~ExtRateCtrlTestGOPShort() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP9E_SET_MIN_GF_INTERVAL, kDefaultMinGfInterval);
|
||||
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
|
||||
encoder->Control(VP9E_SET_TARGET_LEVEL, vp9::LEVEL_AUTO);
|
||||
|
||||
vpx_rc_funcs_t rc_funcs;
|
||||
rc_funcs.rc_type = VPX_RC_GOP_QP;
|
||||
rc_funcs.create_model = rc_create_model_gop_short;
|
||||
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
|
||||
rc_funcs.get_encodeframe_decision = rc_get_encodeframe_decision_gop_short;
|
||||
rc_funcs.get_gop_decision = rc_get_gop_decision_short;
|
||||
rc_funcs.update_encodeframe_result =
|
||||
rc_update_encodeframe_result_gop_short;
|
||||
rc_funcs.delete_model = rc_delete_model;
|
||||
rc_funcs.priv = reinterpret_cast<void *>(PrivMagicNumber);
|
||||
encoder->Control(VP9E_SET_EXTERNAL_RATE_CONTROL, &rc_funcs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ExtRateCtrlTestGOPShort, EncodeTest) {
|
||||
cfg_.rc_target_bitrate = 500;
|
||||
cfg_.g_lag_in_frames = kMaxLagInFrames - 1;
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
|
||||
std::unique_ptr<libvpx_test::VideoSource> video;
|
||||
video.reset(new (std::nothrow) libvpx_test::YUVVideoSource(
|
||||
kTestFileName, VPX_IMG_FMT_I420, 352, 288, 30, 1, 0, kFrameNumGOPShort));
|
||||
|
||||
ASSERT_NE(video, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
class ExtRateCtrlTestGOPShortOverlay
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
ExtRateCtrlTestGOPShortOverlay() : EncoderTest(&::libvpx_test::kVP9) {}
|
||||
|
||||
~ExtRateCtrlTestGOPShortOverlay() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP9E_SET_MIN_GF_INTERVAL, kDefaultMinGfInterval);
|
||||
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
|
||||
encoder->Control(VP9E_SET_TARGET_LEVEL, vp9::LEVEL_AUTO);
|
||||
|
||||
vpx_rc_funcs_t rc_funcs;
|
||||
rc_funcs.rc_type = VPX_RC_GOP_QP;
|
||||
rc_funcs.create_model = rc_create_model_gop_short;
|
||||
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
|
||||
rc_funcs.get_encodeframe_decision =
|
||||
rc_get_encodeframe_decision_gop_short_overlay;
|
||||
rc_funcs.get_gop_decision = rc_get_gop_decision_short_overlay;
|
||||
rc_funcs.update_encodeframe_result =
|
||||
rc_update_encodeframe_result_gop_short;
|
||||
rc_funcs.delete_model = rc_delete_model;
|
||||
rc_funcs.priv = reinterpret_cast<void *>(PrivMagicNumber);
|
||||
encoder->Control(VP9E_SET_EXTERNAL_RATE_CONTROL, &rc_funcs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ExtRateCtrlTestGOPShortOverlay, EncodeTest) {
|
||||
cfg_.rc_target_bitrate = 500;
|
||||
cfg_.g_lag_in_frames = kMaxLagInFrames - 1;
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
|
||||
std::unique_ptr<libvpx_test::VideoSource> video;
|
||||
video.reset(new (std::nothrow) libvpx_test::YUVVideoSource(
|
||||
kTestFileName, VPX_IMG_FMT_I420, 352, 288, 30, 1, 0, kFrameNumGOPShort));
|
||||
|
||||
ASSERT_NE(video, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
class ExtRateCtrlTestGOPShortNoARF
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
ExtRateCtrlTestGOPShortNoARF() : EncoderTest(&::libvpx_test::kVP9) {}
|
||||
|
||||
~ExtRateCtrlTestGOPShortNoARF() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP9E_SET_MIN_GF_INTERVAL, kDefaultMinGfInterval);
|
||||
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
|
||||
encoder->Control(VP9E_SET_TARGET_LEVEL, vp9::LEVEL_AUTO);
|
||||
|
||||
vpx_rc_funcs_t rc_funcs;
|
||||
rc_funcs.rc_type = VPX_RC_GOP_QP;
|
||||
rc_funcs.create_model = rc_create_model_gop_short;
|
||||
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
|
||||
rc_funcs.get_encodeframe_decision =
|
||||
rc_get_encodeframe_decision_gop_short_no_arf;
|
||||
rc_funcs.get_gop_decision = rc_get_gop_decision_short_no_arf;
|
||||
rc_funcs.update_encodeframe_result =
|
||||
rc_update_encodeframe_result_gop_short;
|
||||
rc_funcs.delete_model = rc_delete_model;
|
||||
rc_funcs.priv = reinterpret_cast<void *>(PrivMagicNumber);
|
||||
encoder->Control(VP9E_SET_EXTERNAL_RATE_CONTROL, &rc_funcs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ExtRateCtrlTestGOPShortNoARF, EncodeTest) {
|
||||
cfg_.rc_target_bitrate = 500;
|
||||
cfg_.g_lag_in_frames = kMaxLagInFrames - 1;
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
|
||||
std::unique_ptr<libvpx_test::VideoSource> video;
|
||||
video.reset(new (std::nothrow) libvpx_test::YUVVideoSource(
|
||||
kTestFileName, VPX_IMG_FMT_I420, 352, 288, 30, 1, 0, kFrameNumGOPShort));
|
||||
|
||||
ASSERT_NE(video, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
class ExtRateCtrlTestRdmult : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
protected:
|
||||
ExtRateCtrlTestRdmult() : EncoderTest(&::libvpx_test::kVP9) {}
|
||||
|
||||
~ExtRateCtrlTestRdmult() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
void BeginPassHook(unsigned int) override {
|
||||
psnr_ = 0.0;
|
||||
nframes_ = 0;
|
||||
}
|
||||
|
||||
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
|
||||
psnr_ += pkt->data.psnr.psnr[0];
|
||||
nframes_++;
|
||||
}
|
||||
|
||||
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) override {
|
||||
if (video->frame() == 0) {
|
||||
vpx_rc_funcs_t rc_funcs;
|
||||
rc_funcs.rc_type = VPX_RC_GOP_QP_RDMULT;
|
||||
rc_funcs.create_model = rc_create_model_gop_short;
|
||||
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
|
||||
rc_funcs.get_encodeframe_decision = rc_get_encodeframe_decision_gop_short;
|
||||
rc_funcs.get_gop_decision = rc_get_gop_decision_short;
|
||||
rc_funcs.update_encodeframe_result =
|
||||
rc_update_encodeframe_result_gop_short;
|
||||
rc_funcs.get_frame_rdmult = rc_get_default_frame_rdmult;
|
||||
rc_funcs.delete_model = rc_delete_model;
|
||||
rc_funcs.priv = reinterpret_cast<void *>(PrivMagicNumber);
|
||||
encoder->Control(VP9E_SET_EXTERNAL_RATE_CONTROL, &rc_funcs);
|
||||
}
|
||||
}
|
||||
|
||||
double GetAveragePsnr() const {
|
||||
if (nframes_) return psnr_ / nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
private:
|
||||
double psnr_;
|
||||
unsigned int nframes_;
|
||||
};
|
||||
|
||||
TEST_F(ExtRateCtrlTestRdmult, DefaultRdmult) {
|
||||
cfg_.rc_target_bitrate = 500;
|
||||
cfg_.g_lag_in_frames = kMaxLagInFrames - 1;
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
|
||||
std::unique_ptr<libvpx_test::VideoSource> video;
|
||||
video.reset(new (std::nothrow) libvpx_test::YUVVideoSource(
|
||||
kTestFileName, VPX_IMG_FMT_I420, 352, 288, 30, 1, 0, kFrameNumGOPShort));
|
||||
|
||||
ASSERT_NE(video, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
|
||||
const double psnr = GetAveragePsnr();
|
||||
EXPECT_GT(psnr, kPsnrThreshold);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -512,6 +512,8 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
::testing::Values(
|
||||
make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c, VPX_BITS_8, 16,
|
||||
false),
|
||||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>,
|
||||
&QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, 16, true),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_8, 16, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
|
||||
|
@ -537,7 +539,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
#if VPX_ARCH_X86_64
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSSE3, VP9QuantizeTest,
|
||||
::testing::Values(make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c,
|
||||
|
@ -551,16 +552,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_ssse3>,
|
||||
&QuantFPWrapper<quantize_fp_32x32_nz_c>,
|
||||
VPX_BITS_8, 32, true)));
|
||||
#else
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SSSE3, VP9QuantizeTest,
|
||||
::testing::Values(make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c,
|
||||
VPX_BITS_8, 16, false),
|
||||
make_tuple(&vpx_quantize_b_32x32_ssse3,
|
||||
&vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
|
||||
false)));
|
||||
|
||||
#endif // VPX_ARCH_X86_64
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
#if HAVE_AVX
|
||||
|
@ -574,16 +565,78 @@ INSTANTIATE_TEST_SUITE_P(AVX, VP9QuantizeTest,
|
|||
#endif // HAVE_AVX
|
||||
|
||||
#if VPX_ARCH_X86_64 && HAVE_AVX2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
AVX2, VP9QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_avx2>,
|
||||
&QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, 16, true),
|
||||
make_tuple(&QuantFPWrapper<vp9_highbd_quantize_fp_avx2>,
|
||||
&QuantFPWrapper<vp9_highbd_quantize_fp_c>, VPX_BITS_12, 16,
|
||||
true),
|
||||
make_tuple(&QuantFPWrapper<vp9_highbd_quantize_fp_32x32_avx2>,
|
||||
&QuantFPWrapper<vp9_highbd_quantize_fp_32x32_c>, VPX_BITS_12,
|
||||
32, true),
|
||||
make_tuple(&vpx_quantize_b_avx2, &vpx_quantize_b_c, VPX_BITS_8, 16,
|
||||
false),
|
||||
make_tuple(&vpx_highbd_quantize_b_avx2, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_8, 16, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_avx2, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_10, 16, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_avx2, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_12, 16, false),
|
||||
make_tuple(&vpx_quantize_b_32x32_avx2, &vpx_quantize_b_32x32_c,
|
||||
VPX_BITS_8, 32, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_avx2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_avx2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_avx2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false)));
|
||||
#else
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
AVX2, VP9QuantizeTest,
|
||||
::testing::Values(make_tuple(&QuantFPWrapper<vp9_quantize_fp_avx2>,
|
||||
&QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8,
|
||||
16, true),
|
||||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_avx2>,
|
||||
&QuantFPWrapper<quantize_fp_32x32_nz_c>,
|
||||
VPX_BITS_8, 32, true),
|
||||
make_tuple(&vpx_quantize_b_avx2, &vpx_quantize_b_c,
|
||||
VPX_BITS_8, 16, false)));
|
||||
VPX_BITS_8, 16, false),
|
||||
make_tuple(&vpx_quantize_b_32x32_avx2,
|
||||
&vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
|
||||
false)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#if HAVE_NEON
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, VP9QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c, VPX_BITS_8, 16,
|
||||
false),
|
||||
make_tuple(&vpx_highbd_quantize_b_neon, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_8, 16, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_neon, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_10, 16, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_neon, &vpx_highbd_quantize_b_c,
|
||||
VPX_BITS_12, 16, false),
|
||||
make_tuple(&vpx_quantize_b_32x32_neon, &vpx_quantize_b_32x32_c,
|
||||
VPX_BITS_8, 32, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_neon,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_neon,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_neon,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false),
|
||||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>,
|
||||
&QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16, true),
|
||||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>,
|
||||
&QuantFPWrapper<vp9_quantize_fp_32x32_c>, VPX_BITS_8, 32,
|
||||
true)));
|
||||
#else
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
NEON, VP9QuantizeTest,
|
||||
::testing::Values(make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c,
|
||||
|
@ -597,6 +650,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>,
|
||||
&QuantFPWrapper<vp9_quantize_fp_32x32_c>,
|
||||
VPX_BITS_8, 32, true)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
|
||||
|
|
|
@ -26,7 +26,11 @@ namespace {
|
|||
|
||||
const size_t kNumFrames = 300;
|
||||
|
||||
const int kTemporalId[4] = { 0, 2, 1, 2 };
|
||||
const int kTemporalId3Layer[4] = { 0, 2, 1, 2 };
|
||||
const int kTemporalId2Layer[2] = { 0, 1 };
|
||||
const int kTemporalRateAllocation3Layer[3] = { 50, 70, 100 };
|
||||
const int kTemporalRateAllocation2Layer[2] = { 60, 100 };
|
||||
const int kSpatialLayerBitrate[3] = { 200, 400, 1000 };
|
||||
|
||||
class RcInterfaceTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
|
@ -179,28 +183,73 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
|
|||
encoder->Control(VP9E_SET_SVC, 1);
|
||||
encoder->Control(VP9E_SET_SVC_PARAMETERS, &svc_params_);
|
||||
}
|
||||
|
||||
frame_params_.frame_type = video->frame() == 0 ? KEY_FRAME : INTER_FRAME;
|
||||
if (rc_cfg_.rc_mode == VPX_CBR && frame_params_.frame_type == INTER_FRAME) {
|
||||
// Disable golden frame update.
|
||||
frame_flags_ |= VP8_EFLAG_NO_UPD_GF;
|
||||
frame_flags_ |= VP8_EFLAG_NO_UPD_ARF;
|
||||
}
|
||||
frame_params_.frame_type =
|
||||
video->frame() % key_interval_ == 0 ? KEY_FRAME : INTER_FRAME;
|
||||
encoder_exit_ = video->frame() == kNumFrames;
|
||||
current_superframe_ = video->frame();
|
||||
if (dynamic_spatial_layers_ == 1) {
|
||||
if (video->frame() == 100) {
|
||||
// Go down to 2 spatial layers: set top SL to 0 bitrate.
|
||||
// Update the encoder config.
|
||||
cfg_.rc_target_bitrate -= cfg_.layer_target_bitrate[8];
|
||||
cfg_.layer_target_bitrate[6] = 0;
|
||||
cfg_.layer_target_bitrate[7] = 0;
|
||||
cfg_.layer_target_bitrate[8] = 0;
|
||||
encoder->Config(&cfg_);
|
||||
// Update the RC config.
|
||||
rc_cfg_.target_bandwidth -= rc_cfg_.layer_target_bitrate[8];
|
||||
rc_cfg_.layer_target_bitrate[6] = 0;
|
||||
rc_cfg_.layer_target_bitrate[7] = 0;
|
||||
rc_cfg_.layer_target_bitrate[8] = 0;
|
||||
rc_api_->UpdateRateControl(rc_cfg_);
|
||||
} else if (video->frame() == 200) {
|
||||
// Go down to 1 spatial layer.
|
||||
// Update the encoder config.
|
||||
cfg_.rc_target_bitrate -= cfg_.layer_target_bitrate[5];
|
||||
cfg_.layer_target_bitrate[3] = 0;
|
||||
cfg_.layer_target_bitrate[4] = 0;
|
||||
cfg_.layer_target_bitrate[5] = 0;
|
||||
encoder->Config(&cfg_);
|
||||
// Update the RC config.
|
||||
rc_cfg_.target_bandwidth -= rc_cfg_.layer_target_bitrate[5];
|
||||
rc_cfg_.layer_target_bitrate[3] = 0;
|
||||
rc_cfg_.layer_target_bitrate[4] = 0;
|
||||
rc_cfg_.layer_target_bitrate[5] = 0;
|
||||
rc_api_->UpdateRateControl(rc_cfg_);
|
||||
} else if (0 && video->frame() == 280) {
|
||||
// TODO(marpan): Re-enable this going back up when issue is fixed.
|
||||
// Go back up to 3 spatial layers.
|
||||
// Update the encoder config: use the original bitrates.
|
||||
SetEncoderConfigSvc(3, 3);
|
||||
encoder->Config(&cfg_);
|
||||
// Update the RC config.
|
||||
SetRCConfigSvc(3, 3);
|
||||
rc_api_->UpdateRateControl(rc_cfg_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
|
||||
::libvpx_test::CxDataIterator iter = encoder->GetCxData();
|
||||
for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) sizes_[sl] = 0;
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
ParseSuperframeSizes(static_cast<const uint8_t *>(pkt->data.frame.buf),
|
||||
pkt->data.frame.sz);
|
||||
for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) {
|
||||
frame_params_.spatial_layer_id = sl;
|
||||
frame_params_.temporal_layer_id = kTemporalId[current_superframe_ % 4];
|
||||
rc_api_->ComputeQP(frame_params_);
|
||||
frame_params_.frame_type = INTER_FRAME;
|
||||
rc_api_->PostEncodeUpdate(sizes_[sl]);
|
||||
if (sizes_[sl] > 0) {
|
||||
frame_params_.spatial_layer_id = sl;
|
||||
if (rc_cfg_.ts_number_layers == 3)
|
||||
frame_params_.temporal_layer_id =
|
||||
kTemporalId3Layer[current_superframe_ % 4];
|
||||
else if (rc_cfg_.ts_number_layers == 2)
|
||||
frame_params_.temporal_layer_id =
|
||||
kTemporalId2Layer[current_superframe_ % 2];
|
||||
else
|
||||
frame_params_.temporal_layer_id = 0;
|
||||
rc_api_->ComputeQP(frame_params_);
|
||||
frame_params_.frame_type = INTER_FRAME;
|
||||
rc_api_->PostEncodeUpdate(sizes_[sl]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!encoder_exit_) {
|
||||
|
@ -218,9 +267,37 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
|
|||
const vpx_image_t * /*img2*/) {}
|
||||
|
||||
void RunSvc() {
|
||||
SetConfigSvc();
|
||||
dynamic_spatial_layers_ = 0;
|
||||
SetRCConfigSvc(3, 3);
|
||||
key_interval_ = 10000;
|
||||
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
|
||||
SetEncoderSvc();
|
||||
SetEncoderConfigSvc(3, 3);
|
||||
|
||||
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
|
||||
1280, 720, 30, 1, 0, kNumFrames);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
void RunSvcPeriodicKey() {
|
||||
dynamic_spatial_layers_ = 0;
|
||||
SetRCConfigSvc(3, 3);
|
||||
key_interval_ = 100;
|
||||
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
|
||||
SetEncoderConfigSvc(3, 3);
|
||||
|
||||
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
|
||||
1280, 720, 30, 1, 0, kNumFrames);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
void RunSvcDynamicSpatial() {
|
||||
dynamic_spatial_layers_ = 1;
|
||||
SetRCConfigSvc(3, 3);
|
||||
key_interval_ = 10000;
|
||||
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
|
||||
SetEncoderConfigSvc(3, 3);
|
||||
|
||||
::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
|
||||
1280, 720, 30, 1, 0, kNumFrames);
|
||||
|
@ -256,30 +333,54 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
|
|||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
void SetEncoderSvc() {
|
||||
cfg_.ss_number_layers = 3;
|
||||
cfg_.ts_number_layers = 3;
|
||||
void SetEncoderConfigSvc(int number_spatial_layers,
|
||||
int number_temporal_layers) {
|
||||
cfg_.g_w = 1280;
|
||||
cfg_.g_h = 720;
|
||||
cfg_.ss_number_layers = number_spatial_layers;
|
||||
cfg_.ts_number_layers = number_temporal_layers;
|
||||
cfg_.g_timebase.num = 1;
|
||||
cfg_.g_timebase.den = 30;
|
||||
svc_params_.scaling_factor_num[0] = 72;
|
||||
svc_params_.scaling_factor_den[0] = 288;
|
||||
svc_params_.scaling_factor_num[1] = 144;
|
||||
svc_params_.scaling_factor_den[1] = 288;
|
||||
svc_params_.scaling_factor_num[2] = 288;
|
||||
svc_params_.scaling_factor_den[2] = 288;
|
||||
if (number_spatial_layers == 3) {
|
||||
svc_params_.scaling_factor_num[0] = 1;
|
||||
svc_params_.scaling_factor_den[0] = 4;
|
||||
svc_params_.scaling_factor_num[1] = 2;
|
||||
svc_params_.scaling_factor_den[1] = 4;
|
||||
svc_params_.scaling_factor_num[2] = 4;
|
||||
svc_params_.scaling_factor_den[2] = 4;
|
||||
} else if (number_spatial_layers == 2) {
|
||||
svc_params_.scaling_factor_num[0] = 1;
|
||||
svc_params_.scaling_factor_den[0] = 2;
|
||||
svc_params_.scaling_factor_num[1] = 2;
|
||||
svc_params_.scaling_factor_den[1] = 2;
|
||||
} else if (number_spatial_layers == 1) {
|
||||
svc_params_.scaling_factor_num[0] = 1;
|
||||
svc_params_.scaling_factor_den[0] = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < VPX_MAX_LAYERS; ++i) {
|
||||
svc_params_.max_quantizers[i] = 56;
|
||||
svc_params_.min_quantizers[i] = 2;
|
||||
svc_params_.speed_per_layer[i] = 7;
|
||||
svc_params_.loopfilter_ctrl[i] = LOOPFILTER_ALL;
|
||||
}
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
cfg_.g_lag_in_frames = 0;
|
||||
cfg_.g_error_resilient = 0;
|
||||
// 3 temporal layers
|
||||
cfg_.ts_rate_decimator[0] = 4;
|
||||
cfg_.ts_rate_decimator[1] = 2;
|
||||
cfg_.ts_rate_decimator[2] = 1;
|
||||
cfg_.temporal_layering_mode = 3;
|
||||
|
||||
if (number_temporal_layers == 3) {
|
||||
cfg_.ts_rate_decimator[0] = 4;
|
||||
cfg_.ts_rate_decimator[1] = 2;
|
||||
cfg_.ts_rate_decimator[2] = 1;
|
||||
cfg_.temporal_layering_mode = 3;
|
||||
} else if (number_temporal_layers == 2) {
|
||||
cfg_.ts_rate_decimator[0] = 2;
|
||||
cfg_.ts_rate_decimator[1] = 1;
|
||||
cfg_.temporal_layering_mode = 2;
|
||||
} else if (number_temporal_layers == 1) {
|
||||
cfg_.ts_rate_decimator[0] = 1;
|
||||
cfg_.temporal_layering_mode = 0;
|
||||
}
|
||||
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_buf_optimal_sz = 600;
|
||||
|
@ -288,27 +389,39 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
|
|||
cfg_.rc_max_quantizer = 56;
|
||||
cfg_.g_threads = 1;
|
||||
cfg_.kf_max_dist = 9999;
|
||||
cfg_.rc_target_bitrate = 1600;
|
||||
cfg_.rc_overshoot_pct = 50;
|
||||
cfg_.rc_undershoot_pct = 50;
|
||||
|
||||
cfg_.layer_target_bitrate[0] = 100;
|
||||
cfg_.layer_target_bitrate[1] = 140;
|
||||
cfg_.layer_target_bitrate[2] = 200;
|
||||
cfg_.layer_target_bitrate[3] = 250;
|
||||
cfg_.layer_target_bitrate[4] = 350;
|
||||
cfg_.layer_target_bitrate[5] = 500;
|
||||
cfg_.layer_target_bitrate[6] = 450;
|
||||
cfg_.layer_target_bitrate[7] = 630;
|
||||
cfg_.layer_target_bitrate[8] = 900;
|
||||
cfg_.rc_target_bitrate = 0;
|
||||
for (int sl = 0; sl < number_spatial_layers; sl++) {
|
||||
int spatial_bitrate = 0;
|
||||
if (number_spatial_layers <= 3)
|
||||
spatial_bitrate = kSpatialLayerBitrate[sl];
|
||||
for (int tl = 0; tl < number_temporal_layers; tl++) {
|
||||
int layer = sl * number_temporal_layers + tl;
|
||||
if (number_temporal_layers == 3)
|
||||
cfg_.layer_target_bitrate[layer] =
|
||||
kTemporalRateAllocation3Layer[tl] * spatial_bitrate / 100;
|
||||
else if (number_temporal_layers == 2)
|
||||
cfg_.layer_target_bitrate[layer] =
|
||||
kTemporalRateAllocation2Layer[tl] * spatial_bitrate / 100;
|
||||
else if (number_temporal_layers == 1)
|
||||
cfg_.layer_target_bitrate[layer] = spatial_bitrate;
|
||||
}
|
||||
cfg_.rc_target_bitrate += spatial_bitrate;
|
||||
}
|
||||
|
||||
cfg_.kf_min_dist = key_interval_;
|
||||
cfg_.kf_max_dist = key_interval_;
|
||||
}
|
||||
|
||||
void SetConfigSvc() {
|
||||
void SetRCConfigSvc(int number_spatial_layers, int number_temporal_layers) {
|
||||
rc_cfg_.width = 1280;
|
||||
rc_cfg_.height = 720;
|
||||
rc_cfg_.ss_number_layers = number_spatial_layers;
|
||||
rc_cfg_.ts_number_layers = number_temporal_layers;
|
||||
rc_cfg_.max_quantizer = 56;
|
||||
rc_cfg_.min_quantizer = 2;
|
||||
rc_cfg_.target_bandwidth = 1600;
|
||||
rc_cfg_.buf_initial_sz = 500;
|
||||
rc_cfg_.buf_optimal_sz = 600;
|
||||
rc_cfg_.buf_sz = 1000;
|
||||
|
@ -316,31 +429,55 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
|
|||
rc_cfg_.overshoot_pct = 50;
|
||||
rc_cfg_.max_intra_bitrate_pct = 900;
|
||||
rc_cfg_.framerate = 30.0;
|
||||
rc_cfg_.ss_number_layers = 3;
|
||||
rc_cfg_.ts_number_layers = 3;
|
||||
rc_cfg_.rc_mode = VPX_CBR;
|
||||
rc_cfg_.aq_mode = aq_mode_;
|
||||
|
||||
rc_cfg_.scaling_factor_num[0] = 1;
|
||||
rc_cfg_.scaling_factor_den[0] = 4;
|
||||
rc_cfg_.scaling_factor_num[1] = 2;
|
||||
rc_cfg_.scaling_factor_den[1] = 4;
|
||||
rc_cfg_.scaling_factor_num[2] = 4;
|
||||
rc_cfg_.scaling_factor_den[2] = 4;
|
||||
if (number_spatial_layers == 3) {
|
||||
rc_cfg_.scaling_factor_num[0] = 1;
|
||||
rc_cfg_.scaling_factor_den[0] = 4;
|
||||
rc_cfg_.scaling_factor_num[1] = 2;
|
||||
rc_cfg_.scaling_factor_den[1] = 4;
|
||||
rc_cfg_.scaling_factor_num[2] = 4;
|
||||
rc_cfg_.scaling_factor_den[2] = 4;
|
||||
} else if (number_spatial_layers == 2) {
|
||||
rc_cfg_.scaling_factor_num[0] = 1;
|
||||
rc_cfg_.scaling_factor_den[0] = 2;
|
||||
rc_cfg_.scaling_factor_num[1] = 2;
|
||||
rc_cfg_.scaling_factor_den[1] = 2;
|
||||
} else if (number_spatial_layers == 1) {
|
||||
rc_cfg_.scaling_factor_num[0] = 1;
|
||||
rc_cfg_.scaling_factor_den[0] = 1;
|
||||
}
|
||||
|
||||
rc_cfg_.ts_rate_decimator[0] = 4;
|
||||
rc_cfg_.ts_rate_decimator[1] = 2;
|
||||
rc_cfg_.ts_rate_decimator[2] = 1;
|
||||
if (number_temporal_layers == 3) {
|
||||
rc_cfg_.ts_rate_decimator[0] = 4;
|
||||
rc_cfg_.ts_rate_decimator[1] = 2;
|
||||
rc_cfg_.ts_rate_decimator[2] = 1;
|
||||
} else if (number_temporal_layers == 2) {
|
||||
rc_cfg_.ts_rate_decimator[0] = 2;
|
||||
rc_cfg_.ts_rate_decimator[1] = 1;
|
||||
} else if (number_temporal_layers == 1) {
|
||||
rc_cfg_.ts_rate_decimator[0] = 1;
|
||||
}
|
||||
|
||||
rc_cfg_.layer_target_bitrate[0] = 100;
|
||||
rc_cfg_.layer_target_bitrate[1] = 140;
|
||||
rc_cfg_.layer_target_bitrate[2] = 200;
|
||||
rc_cfg_.layer_target_bitrate[3] = 250;
|
||||
rc_cfg_.layer_target_bitrate[4] = 350;
|
||||
rc_cfg_.layer_target_bitrate[5] = 500;
|
||||
rc_cfg_.layer_target_bitrate[6] = 450;
|
||||
rc_cfg_.layer_target_bitrate[7] = 630;
|
||||
rc_cfg_.layer_target_bitrate[8] = 900;
|
||||
rc_cfg_.target_bandwidth = 0;
|
||||
for (int sl = 0; sl < number_spatial_layers; sl++) {
|
||||
int spatial_bitrate = 0;
|
||||
if (number_spatial_layers <= 3)
|
||||
spatial_bitrate = kSpatialLayerBitrate[sl];
|
||||
for (int tl = 0; tl < number_temporal_layers; tl++) {
|
||||
int layer = sl * number_temporal_layers + tl;
|
||||
if (number_temporal_layers == 3)
|
||||
rc_cfg_.layer_target_bitrate[layer] =
|
||||
kTemporalRateAllocation3Layer[tl] * spatial_bitrate / 100;
|
||||
else if (number_temporal_layers == 2)
|
||||
rc_cfg_.layer_target_bitrate[layer] =
|
||||
kTemporalRateAllocation2Layer[tl] * spatial_bitrate / 100;
|
||||
else if (number_temporal_layers == 1)
|
||||
rc_cfg_.layer_target_bitrate[layer] = spatial_bitrate;
|
||||
}
|
||||
rc_cfg_.target_bandwidth += spatial_bitrate;
|
||||
}
|
||||
|
||||
for (int sl = 0; sl < rc_cfg_.ss_number_layers; ++sl) {
|
||||
for (int tl = 0; tl < rc_cfg_.ts_number_layers; ++tl) {
|
||||
|
@ -359,6 +496,8 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
|
|||
bool encoder_exit_;
|
||||
int current_superframe_;
|
||||
uint32_t sizes_[8];
|
||||
int key_interval_;
|
||||
int dynamic_spatial_layers_;
|
||||
};
|
||||
|
||||
TEST_P(RcInterfaceTest, OneLayer) { RunOneLayer(); }
|
||||
|
@ -367,6 +506,10 @@ TEST_P(RcInterfaceTest, OneLayerVBRPeriodicKey) { RunOneLayerVBRPeriodicKey(); }
|
|||
|
||||
TEST_P(RcInterfaceSvcTest, Svc) { RunSvc(); }
|
||||
|
||||
TEST_P(RcInterfaceSvcTest, SvcPeriodicKey) { RunSvcPeriodicKey(); }
|
||||
|
||||
TEST_P(RcInterfaceSvcTest, SvcDynamicSpatial) { RunSvcDynamicSpatial(); }
|
||||
|
||||
VP9_INSTANTIATE_TEST_SUITE(RcInterfaceTest, ::testing::Values(0, 3),
|
||||
::testing::Values(VPX_CBR, VPX_VBR));
|
||||
VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0, 3));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <tuple>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
|
@ -17,9 +18,11 @@
|
|||
#include "test/bench.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vpx_ports/msvc.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/vpx_timer.h"
|
||||
|
||||
typedef void (*SubtractFunc)(int rows, int cols, int16_t *diff_ptr,
|
||||
ptrdiff_t diff_stride, const uint8_t *src_ptr,
|
||||
|
@ -133,6 +136,10 @@ INSTANTIATE_TEST_SUITE_P(C, VP9SubtractBlockTest,
|
|||
INSTANTIATE_TEST_SUITE_P(SSE2, VP9SubtractBlockTest,
|
||||
::testing::Values(vpx_subtract_block_sse2));
|
||||
#endif
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_SUITE_P(AVX2, VP9SubtractBlockTest,
|
||||
::testing::Values(vpx_subtract_block_avx2));
|
||||
#endif
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_SUITE_P(NEON, VP9SubtractBlockTest,
|
||||
::testing::Values(vpx_subtract_block_neon));
|
||||
|
@ -157,4 +164,158 @@ INSTANTIATE_TEST_SUITE_P(LSX, VP9SubtractBlockTest,
|
|||
::testing::Values(vpx_subtract_block_lsx));
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
typedef void (*HBDSubtractFunc)(int rows, int cols, int16_t *diff_ptr,
|
||||
ptrdiff_t diff_stride, const uint8_t *src_ptr,
|
||||
ptrdiff_t src_stride, const uint8_t *pred_ptr,
|
||||
ptrdiff_t pred_stride, int bd);
|
||||
|
||||
// <BLOCK_SIZE, bit_depth, optimized subtract func, reference subtract func>
|
||||
using Params = std::tuple<BLOCK_SIZE, int, HBDSubtractFunc, HBDSubtractFunc>;
|
||||
|
||||
class VPXHBDSubtractBlockTest : public ::testing::TestWithParam<Params> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
block_width_ = 4 * num_4x4_blocks_wide_lookup[GET_PARAM(0)];
|
||||
block_height_ = 4 * num_4x4_blocks_high_lookup[GET_PARAM(0)];
|
||||
bit_depth_ = static_cast<vpx_bit_depth_t>(GET_PARAM(1));
|
||||
func_ = GET_PARAM(2);
|
||||
ref_func_ = GET_PARAM(3);
|
||||
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
|
||||
constexpr size_t kMaxWidth = 128;
|
||||
constexpr size_t kMaxBlockSize = kMaxWidth * kMaxWidth;
|
||||
src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, kMaxBlockSize * sizeof(uint16_t))));
|
||||
ASSERT_NE(src_, nullptr);
|
||||
pred_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, kMaxBlockSize * sizeof(uint16_t))));
|
||||
ASSERT_NE(pred_, nullptr);
|
||||
diff_ = reinterpret_cast<int16_t *>(
|
||||
vpx_memalign(16, kMaxBlockSize * sizeof(int16_t)));
|
||||
ASSERT_NE(diff_, nullptr);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
vpx_free(CONVERT_TO_SHORTPTR(src_));
|
||||
vpx_free(CONVERT_TO_SHORTPTR(pred_));
|
||||
vpx_free(diff_);
|
||||
}
|
||||
|
||||
protected:
|
||||
void CheckResult();
|
||||
void RunForSpeed();
|
||||
|
||||
private:
|
||||
ACMRandom rnd_;
|
||||
int block_height_;
|
||||
int block_width_;
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
HBDSubtractFunc func_;
|
||||
HBDSubtractFunc ref_func_;
|
||||
uint8_t *src_;
|
||||
uint8_t *pred_;
|
||||
int16_t *diff_;
|
||||
};
|
||||
|
||||
void VPXHBDSubtractBlockTest::CheckResult() {
|
||||
constexpr int kTestNum = 100;
|
||||
constexpr int kMaxWidth = 128;
|
||||
constexpr int kMaxBlockSize = kMaxWidth * kMaxWidth;
|
||||
const int mask = (1 << bit_depth_) - 1;
|
||||
for (int i = 0; i < kTestNum; ++i) {
|
||||
for (int j = 0; j < kMaxBlockSize; ++j) {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask;
|
||||
CONVERT_TO_SHORTPTR(pred_)[j] = rnd_.Rand16() & mask;
|
||||
}
|
||||
|
||||
func_(block_height_, block_width_, diff_, block_width_, src_, block_width_,
|
||||
pred_, block_width_, bit_depth_);
|
||||
|
||||
for (int r = 0; r < block_height_; ++r) {
|
||||
for (int c = 0; c < block_width_; ++c) {
|
||||
EXPECT_EQ(diff_[r * block_width_ + c],
|
||||
(CONVERT_TO_SHORTPTR(src_)[r * block_width_ + c] -
|
||||
CONVERT_TO_SHORTPTR(pred_)[r * block_width_ + c]))
|
||||
<< "r = " << r << ", c = " << c << ", test: " << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(VPXHBDSubtractBlockTest, CheckResult) { CheckResult(); }
|
||||
|
||||
void VPXHBDSubtractBlockTest::RunForSpeed() {
|
||||
constexpr int kTestNum = 200000;
|
||||
constexpr int kMaxWidth = 128;
|
||||
constexpr int kMaxBlockSize = kMaxWidth * kMaxWidth;
|
||||
const int mask = (1 << bit_depth_) - 1;
|
||||
|
||||
if (ref_func_ == func_) GTEST_SKIP();
|
||||
|
||||
for (int j = 0; j < kMaxBlockSize; ++j) {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask;
|
||||
CONVERT_TO_SHORTPTR(pred_)[j] = rnd_.Rand16() & mask;
|
||||
}
|
||||
|
||||
vpx_usec_timer ref_timer;
|
||||
vpx_usec_timer_start(&ref_timer);
|
||||
for (int i = 0; i < kTestNum; ++i) {
|
||||
ref_func_(block_height_, block_width_, diff_, block_width_, src_,
|
||||
block_width_, pred_, block_width_, bit_depth_);
|
||||
}
|
||||
vpx_usec_timer_mark(&ref_timer);
|
||||
const int64_t ref_elapsed_time = vpx_usec_timer_elapsed(&ref_timer);
|
||||
|
||||
for (int j = 0; j < kMaxBlockSize; ++j) {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask;
|
||||
CONVERT_TO_SHORTPTR(pred_)[j] = rnd_.Rand16() & mask;
|
||||
}
|
||||
|
||||
vpx_usec_timer timer;
|
||||
vpx_usec_timer_start(&timer);
|
||||
for (int i = 0; i < kTestNum; ++i) {
|
||||
func_(block_height_, block_width_, diff_, block_width_, src_, block_width_,
|
||||
pred_, block_width_, bit_depth_);
|
||||
}
|
||||
vpx_usec_timer_mark(&timer);
|
||||
const int64_t elapsed_time = vpx_usec_timer_elapsed(&timer);
|
||||
|
||||
printf(
|
||||
"[%dx%d]: "
|
||||
"ref_time=%6" PRId64 " \t simd_time=%6" PRId64
|
||||
" \t "
|
||||
"gain=%f \n",
|
||||
block_width_, block_height_, ref_elapsed_time, elapsed_time,
|
||||
static_cast<double>(ref_elapsed_time) /
|
||||
static_cast<double>(elapsed_time));
|
||||
}
|
||||
|
||||
TEST_P(VPXHBDSubtractBlockTest, DISABLED_Speed) { RunForSpeed(); }
|
||||
|
||||
const BLOCK_SIZE kValidBlockSize[] = { BLOCK_4X4, BLOCK_4X8, BLOCK_8X4,
|
||||
BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
|
||||
BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
|
||||
BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
|
||||
BLOCK_64X64 };
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
C, VPXHBDSubtractBlockTest,
|
||||
::testing::Combine(::testing::ValuesIn(kValidBlockSize),
|
||||
::testing::Values(12),
|
||||
::testing::Values(&vpx_highbd_subtract_block_c),
|
||||
::testing::Values(&vpx_highbd_subtract_block_c)));
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
AVX2, VPXHBDSubtractBlockTest,
|
||||
::testing::Combine(::testing::ValuesIn(kValidBlockSize),
|
||||
::testing::Values(12),
|
||||
::testing::Values(&vpx_highbd_subtract_block_avx2),
|
||||
::testing::Values(&vpx_highbd_subtract_block_c)));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} // namespace vp9
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
URL: https://github.com/google/googletest.git
|
||||
Version: release-1.11.0
|
||||
Version: release-1.12.1
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
@ -13,9 +13,17 @@ generation.
|
|||
|
||||
Local Modifications:
|
||||
- Remove everything but:
|
||||
.clang-format
|
||||
CONTRIBUTORS
|
||||
googletest/
|
||||
include
|
||||
README.md
|
||||
src
|
||||
LICENSE
|
||||
- Move .clang-format, CONTRIBUTORS, and LICENSE into googletest/
|
||||
- In googletest/include/gtest/internal/custom/gtest-port.h, define
|
||||
GTEST_HAS_NOTIFICATION_ as 1 and use a stub Notification class to fix
|
||||
the mingw32 g++ compilation errors caused by the lack of std::mutex
|
||||
and std::condition_variable in the <mutex> and <condition_variable>
|
||||
headers if mingw32 is configured with the win32 threads option. See
|
||||
https://stackoverflow.com/questions/17242516/mingw-w64-threads-posix-vs-win32
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Run manually to reformat a file:
|
||||
# clang-format -i --style=file <file>
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
|
@ -34,6 +34,7 @@ Manuel Klimek <klimek@google.com>
|
|||
Mario Tanev <radix@google.com>
|
||||
Mark Paskin
|
||||
Markus Heule <markus.heule@gmail.com>
|
||||
Martijn Vels <mvels@google.com>
|
||||
Matthew Simmons <simmonmt@acm.org>
|
||||
Mika Raento <mikie@iki.fi>
|
||||
Mike Bland <mbland@google.com>
|
||||
|
@ -55,6 +56,7 @@ Russ Rufer <russ@pentad.com>
|
|||
Sean Mcafee <eefacm@gmail.com>
|
||||
Sigurður Ásgeirsson <siggi@google.com>
|
||||
Sverre Sundsdal <sundsdal@gmail.com>
|
||||
Szymon Sobik <sobik.szymon@gmail.com>
|
||||
Takeshi Yoshino <tyoshino@google.com>
|
||||
Tracy Bialik <tracy@pentad.com>
|
||||
Vadim Berman <vadimb@google.com>
|
||||
|
|
|
@ -25,7 +25,7 @@ When building GoogleTest as a standalone project, the typical workflow starts
|
|||
with
|
||||
|
||||
```
|
||||
git clone https://github.com/google/googletest.git -b release-1.10.0
|
||||
git clone https://github.com/google/googletest.git -b release-1.11.0
|
||||
cd googletest # Main directory of the cloned repository.
|
||||
mkdir build # Create a directory to hold the build output.
|
||||
cd build
|
||||
|
@ -94,7 +94,7 @@ include(FetchContent)
|
|||
FetchContent_Declare(
|
||||
googletest
|
||||
# Specify the commit you depend on and update it regularly.
|
||||
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
|
||||
URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip
|
||||
)
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
@ -203,7 +203,9 @@ add
|
|||
-DGTEST_DONT_DEFINE_FOO=1
|
||||
|
||||
to the compiler flags to tell GoogleTest to change the macro's name from `FOO`
|
||||
to `GTEST_FOO`. Currently `FOO` can be `FAIL`, `SUCCEED`, or `TEST`. For
|
||||
to `GTEST_FOO`. Currently `FOO` can be `ASSERT_EQ`, `ASSERT_FALSE`, `ASSERT_GE`,
|
||||
`ASSERT_GT`, `ASSERT_LE`, `ASSERT_LT`, `ASSERT_NE`, `ASSERT_TRUE`,
|
||||
`EXPECT_FALSE`, `EXPECT_TRUE`, `FAIL`, `SUCCEED`, `TEST`, or `TEST_F`. For
|
||||
example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll need to write
|
||||
|
||||
GTEST_TEST(SomeTest, DoesThis) { ... }
|
||||
|
|
237
media/libvpx/libvpx/third_party/googletest/src/include/gtest/gtest-assertion-result.h
поставляемый
Normal file
237
media/libvpx/libvpx/third_party/googletest/src/include/gtest/gtest-assertion-result.h
поставляемый
Normal file
|
@ -0,0 +1,237 @@
|
|||
// Copyright 2005, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This file implements the AssertionResult type.
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "gtest/gtest-message.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||
|
||||
namespace testing {
|
||||
|
||||
// A class for indicating whether an assertion was successful. When
|
||||
// the assertion wasn't successful, the AssertionResult object
|
||||
// remembers a non-empty message that describes how it failed.
|
||||
//
|
||||
// To create an instance of this class, use one of the factory functions
|
||||
// (AssertionSuccess() and AssertionFailure()).
|
||||
//
|
||||
// This class is useful for two purposes:
|
||||
// 1. Defining predicate functions to be used with Boolean test assertions
|
||||
// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
|
||||
// 2. Defining predicate-format functions to be
|
||||
// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
|
||||
//
|
||||
// For example, if you define IsEven predicate:
|
||||
//
|
||||
// testing::AssertionResult IsEven(int n) {
|
||||
// if ((n % 2) == 0)
|
||||
// return testing::AssertionSuccess();
|
||||
// else
|
||||
// return testing::AssertionFailure() << n << " is odd";
|
||||
// }
|
||||
//
|
||||
// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
|
||||
// will print the message
|
||||
//
|
||||
// Value of: IsEven(Fib(5))
|
||||
// Actual: false (5 is odd)
|
||||
// Expected: true
|
||||
//
|
||||
// instead of a more opaque
|
||||
//
|
||||
// Value of: IsEven(Fib(5))
|
||||
// Actual: false
|
||||
// Expected: true
|
||||
//
|
||||
// in case IsEven is a simple Boolean predicate.
|
||||
//
|
||||
// If you expect your predicate to be reused and want to support informative
|
||||
// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
|
||||
// about half as often as positive ones in our tests), supply messages for
|
||||
// both success and failure cases:
|
||||
//
|
||||
// testing::AssertionResult IsEven(int n) {
|
||||
// if ((n % 2) == 0)
|
||||
// return testing::AssertionSuccess() << n << " is even";
|
||||
// else
|
||||
// return testing::AssertionFailure() << n << " is odd";
|
||||
// }
|
||||
//
|
||||
// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
|
||||
//
|
||||
// Value of: IsEven(Fib(6))
|
||||
// Actual: true (8 is even)
|
||||
// Expected: false
|
||||
//
|
||||
// NB: Predicates that support negative Boolean assertions have reduced
|
||||
// performance in positive ones so be careful not to use them in tests
|
||||
// that have lots (tens of thousands) of positive Boolean assertions.
|
||||
//
|
||||
// To use this class with EXPECT_PRED_FORMAT assertions such as:
|
||||
//
|
||||
// // Verifies that Foo() returns an even number.
|
||||
// EXPECT_PRED_FORMAT1(IsEven, Foo());
|
||||
//
|
||||
// you need to define:
|
||||
//
|
||||
// testing::AssertionResult IsEven(const char* expr, int n) {
|
||||
// if ((n % 2) == 0)
|
||||
// return testing::AssertionSuccess();
|
||||
// else
|
||||
// return testing::AssertionFailure()
|
||||
// << "Expected: " << expr << " is even\n Actual: it's " << n;
|
||||
// }
|
||||
//
|
||||
// If Foo() returns 5, you will see the following message:
|
||||
//
|
||||
// Expected: Foo() is even
|
||||
// Actual: it's 5
|
||||
//
|
||||
class GTEST_API_ AssertionResult {
|
||||
public:
|
||||
// Copy constructor.
|
||||
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
||||
AssertionResult(const AssertionResult& other);
|
||||
|
||||
// C4800 is a level 3 warning in Visual Studio 2015 and earlier.
|
||||
// This warning is not emitted in Visual Studio 2017.
|
||||
// This warning is off by default starting in Visual Studio 2019 but can be
|
||||
// enabled with command-line options.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
||||
#endif
|
||||
|
||||
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
||||
//
|
||||
// T must be contextually convertible to bool.
|
||||
//
|
||||
// The second parameter prevents this overload from being considered if
|
||||
// the argument is implicitly convertible to AssertionResult. In that case
|
||||
// we want AssertionResult's copy constructor to be used.
|
||||
template <typename T>
|
||||
explicit AssertionResult(
|
||||
const T& success,
|
||||
typename std::enable_if<
|
||||
!std::is_convertible<T, AssertionResult>::value>::type*
|
||||
/*enabler*/
|
||||
= nullptr)
|
||||
: success_(success) {}
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
||||
#endif
|
||||
|
||||
// Assignment operator.
|
||||
AssertionResult& operator=(AssertionResult other) {
|
||||
swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Returns true if and only if the assertion succeeded.
|
||||
operator bool() const { return success_; } // NOLINT
|
||||
|
||||
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
||||
AssertionResult operator!() const;
|
||||
|
||||
// Returns the text streamed into this AssertionResult. Test assertions
|
||||
// use it when they fail (i.e., the predicate's outcome doesn't match the
|
||||
// assertion's expectation). When nothing has been streamed into the
|
||||
// object, returns an empty string.
|
||||
const char* message() const {
|
||||
return message_.get() != nullptr ? message_->c_str() : "";
|
||||
}
|
||||
// Deprecated; please use message() instead.
|
||||
const char* failure_message() const { return message(); }
|
||||
|
||||
// Streams a custom failure message into this object.
|
||||
template <typename T>
|
||||
AssertionResult& operator<<(const T& value) {
|
||||
AppendMessage(Message() << value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Allows streaming basic output manipulators such as endl or flush into
|
||||
// this object.
|
||||
AssertionResult& operator<<(
|
||||
::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
|
||||
AppendMessage(Message() << basic_manipulator);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
// Appends the contents of message to message_.
|
||||
void AppendMessage(const Message& a_message) {
|
||||
if (message_.get() == nullptr) message_.reset(new ::std::string);
|
||||
message_->append(a_message.GetString().c_str());
|
||||
}
|
||||
|
||||
// Swap the contents of this AssertionResult with other.
|
||||
void swap(AssertionResult& other);
|
||||
|
||||
// Stores result of the assertion predicate.
|
||||
bool success_;
|
||||
// Stores the message describing the condition in case the expectation
|
||||
// construct is not satisfied with the predicate's outcome.
|
||||
// Referenced via a pointer to avoid taking too much stack frame space
|
||||
// with test assertions.
|
||||
std::unique_ptr< ::std::string> message_;
|
||||
};
|
||||
|
||||
// Makes a successful assertion result.
|
||||
GTEST_API_ AssertionResult AssertionSuccess();
|
||||
|
||||
// Makes a failed assertion result.
|
||||
GTEST_API_ AssertionResult AssertionFailure();
|
||||
|
||||
// Makes a failed assertion result with the given failure message.
|
||||
// Deprecated; use AssertionFailure() << msg.
|
||||
GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
|
||||
|
||||
} // namespace testing
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||
|
||||
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
|
@ -27,21 +27,21 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file defines the public API for death tests. It is
|
||||
// #included by gtest.h so a user doesn't need to include this
|
||||
// directly.
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
||||
|
||||
#include "gtest/internal/gtest-death-test-internal.h"
|
||||
|
||||
namespace testing {
|
||||
|
||||
// This flag controls the style of death tests. Valid values are "threadsafe",
|
||||
// meaning that the death test child process will re-execute the test binary
|
||||
// from the start, running only a single death test, or "fast",
|
||||
|
@ -49,6 +49,8 @@ namespace testing {
|
|||
// after forking.
|
||||
GTEST_DECLARE_string_(death_test_style);
|
||||
|
||||
namespace testing {
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
namespace internal {
|
||||
|
@ -103,7 +105,6 @@ GTEST_API_ bool InDeathTestChild();
|
|||
//
|
||||
// On the regular expressions used in death tests:
|
||||
//
|
||||
// GOOGLETEST_CM0005 DO NOT DELETE
|
||||
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
||||
// which uses the POSIX extended regex syntax.
|
||||
//
|
||||
|
@ -169,24 +170,24 @@ GTEST_API_ bool InDeathTestChild();
|
|||
// Asserts that a given `statement` causes the program to exit, with an
|
||||
// integer exit status that satisfies `predicate`, and emitting error output
|
||||
// that matches `matcher`.
|
||||
# define ASSERT_EXIT(statement, predicate, matcher) \
|
||||
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_FATAL_FAILURE_)
|
||||
#define ASSERT_EXIT(statement, predicate, matcher) \
|
||||
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_FATAL_FAILURE_)
|
||||
|
||||
// Like `ASSERT_EXIT`, but continues on to successive tests in the
|
||||
// test suite, if any:
|
||||
# define EXPECT_EXIT(statement, predicate, matcher) \
|
||||
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
|
||||
#define EXPECT_EXIT(statement, predicate, matcher) \
|
||||
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
|
||||
|
||||
// Asserts that a given `statement` causes the program to exit, either by
|
||||
// explicitly exiting with a nonzero exit code or being killed by a
|
||||
// signal, and emitting error output that matches `matcher`.
|
||||
# define ASSERT_DEATH(statement, matcher) \
|
||||
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
|
||||
#define ASSERT_DEATH(statement, matcher) \
|
||||
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
|
||||
|
||||
// Like `ASSERT_DEATH`, but continues on to successive tests in the
|
||||
// test suite, if any:
|
||||
# define EXPECT_DEATH(statement, matcher) \
|
||||
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
|
||||
#define EXPECT_DEATH(statement, matcher) \
|
||||
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
|
||||
|
||||
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
|
||||
|
||||
|
@ -197,22 +198,23 @@ class GTEST_API_ ExitedWithCode {
|
|||
ExitedWithCode(const ExitedWithCode&) = default;
|
||||
void operator=(const ExitedWithCode& other) = delete;
|
||||
bool operator()(int exit_status) const;
|
||||
|
||||
private:
|
||||
const int exit_code_;
|
||||
};
|
||||
|
||||
# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
|
||||
#if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
|
||||
// Tests that an exit code describes an exit due to termination by a
|
||||
// given signal.
|
||||
// GOOGLETEST_CM0006 DO NOT DELETE
|
||||
class GTEST_API_ KilledBySignal {
|
||||
public:
|
||||
explicit KilledBySignal(int signum);
|
||||
bool operator()(int exit_status) const;
|
||||
|
||||
private:
|
||||
const int signum_;
|
||||
};
|
||||
# endif // !GTEST_OS_WINDOWS
|
||||
#endif // !GTEST_OS_WINDOWS
|
||||
|
||||
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
||||
// The death testing framework causes this to have interesting semantics,
|
||||
|
@ -257,23 +259,21 @@ class GTEST_API_ KilledBySignal {
|
|||
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
|
||||
// }, "death");
|
||||
//
|
||||
# ifdef NDEBUG
|
||||
#ifdef NDEBUG
|
||||
|
||||
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
||||
#define EXPECT_DEBUG_DEATH(statement, regex) \
|
||||
GTEST_EXECUTE_STATEMENT_(statement, regex)
|
||||
|
||||
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
||||
#define ASSERT_DEBUG_DEATH(statement, regex) \
|
||||
GTEST_EXECUTE_STATEMENT_(statement, regex)
|
||||
|
||||
# else
|
||||
#else
|
||||
|
||||
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
||||
EXPECT_DEATH(statement, regex)
|
||||
#define EXPECT_DEBUG_DEATH(statement, regex) EXPECT_DEATH(statement, regex)
|
||||
|
||||
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
||||
ASSERT_DEATH(statement, regex)
|
||||
#define ASSERT_DEBUG_DEATH(statement, regex) ASSERT_DEATH(statement, regex)
|
||||
|
||||
# endif // NDEBUG for EXPECT_DEBUG_DEATH
|
||||
#endif // NDEBUG for EXPECT_DEBUG_DEATH
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
// This macro is used for implementing macros such as
|
||||
|
@ -311,18 +311,17 @@ class GTEST_API_ KilledBySignal {
|
|||
// statement unconditionally returns or throws. The Message constructor at
|
||||
// the end allows the syntax of streaming additional messages into the
|
||||
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
|
||||
# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
GTEST_LOG_(WARNING) \
|
||||
<< "Death tests are not supported on this platform.\n" \
|
||||
<< "Statement '" #statement "' cannot be verified."; \
|
||||
} else if (::testing::internal::AlwaysFalse()) { \
|
||||
::testing::internal::RE::PartialMatch(".*", (regex)); \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
terminator; \
|
||||
} else \
|
||||
::testing::Message()
|
||||
#define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
GTEST_LOG_(WARNING) << "Death tests are not supported on this platform.\n" \
|
||||
<< "Statement '" #statement "' cannot be verified."; \
|
||||
} else if (::testing::internal::AlwaysFalse()) { \
|
||||
::testing::internal::RE::PartialMatch(".*", (regex)); \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
terminator; \
|
||||
} else \
|
||||
::testing::Message()
|
||||
|
||||
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
||||
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
|
||||
|
@ -330,15 +329,15 @@ class GTEST_API_ KilledBySignal {
|
|||
// useful when you are combining death test assertions with normal test
|
||||
// assertions in one test.
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
EXPECT_DEATH(statement, regex)
|
||||
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
ASSERT_DEATH(statement, regex)
|
||||
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
EXPECT_DEATH(statement, regex)
|
||||
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
ASSERT_DEATH(statement, regex)
|
||||
#else
|
||||
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
|
||||
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
|
||||
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
|
||||
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
|
||||
#endif
|
||||
|
||||
} // namespace testing
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
// This file implements just enough of the matcher interface to allow
|
||||
// EXPECT_DEATH and friends to accept a matcher argument.
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
|
||||
|
||||
|
@ -98,11 +102,11 @@ class MatchResultListener {
|
|||
private:
|
||||
::std::ostream* const stream_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
|
||||
MatchResultListener(const MatchResultListener&) = delete;
|
||||
MatchResultListener& operator=(const MatchResultListener&) = delete;
|
||||
};
|
||||
|
||||
inline MatchResultListener::~MatchResultListener() {
|
||||
}
|
||||
inline MatchResultListener::~MatchResultListener() {}
|
||||
|
||||
// An instance of a subclass of this knows how to describe itself as a
|
||||
// matcher.
|
||||
|
@ -176,27 +180,39 @@ namespace internal {
|
|||
|
||||
struct AnyEq {
|
||||
template <typename A, typename B>
|
||||
bool operator()(const A& a, const B& b) const { return a == b; }
|
||||
bool operator()(const A& a, const B& b) const {
|
||||
return a == b;
|
||||
}
|
||||
};
|
||||
struct AnyNe {
|
||||
template <typename A, typename B>
|
||||
bool operator()(const A& a, const B& b) const { return a != b; }
|
||||
bool operator()(const A& a, const B& b) const {
|
||||
return a != b;
|
||||
}
|
||||
};
|
||||
struct AnyLt {
|
||||
template <typename A, typename B>
|
||||
bool operator()(const A& a, const B& b) const { return a < b; }
|
||||
bool operator()(const A& a, const B& b) const {
|
||||
return a < b;
|
||||
}
|
||||
};
|
||||
struct AnyGt {
|
||||
template <typename A, typename B>
|
||||
bool operator()(const A& a, const B& b) const { return a > b; }
|
||||
bool operator()(const A& a, const B& b) const {
|
||||
return a > b;
|
||||
}
|
||||
};
|
||||
struct AnyLe {
|
||||
template <typename A, typename B>
|
||||
bool operator()(const A& a, const B& b) const { return a <= b; }
|
||||
bool operator()(const A& a, const B& b) const {
|
||||
return a <= b;
|
||||
}
|
||||
};
|
||||
struct AnyGe {
|
||||
template <typename A, typename B>
|
||||
bool operator()(const A& a, const B& b) const { return a >= b; }
|
||||
bool operator()(const A& a, const B& b) const {
|
||||
return a >= b;
|
||||
}
|
||||
};
|
||||
|
||||
// A match result listener that ignores the explanation.
|
||||
|
@ -205,7 +221,8 @@ class DummyMatchResultListener : public MatchResultListener {
|
|||
DummyMatchResultListener() : MatchResultListener(nullptr) {}
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
|
||||
DummyMatchResultListener(const DummyMatchResultListener&) = delete;
|
||||
DummyMatchResultListener& operator=(const DummyMatchResultListener&) = delete;
|
||||
};
|
||||
|
||||
// A match result listener that forwards the explanation to a given
|
||||
|
@ -217,7 +234,9 @@ class StreamMatchResultListener : public MatchResultListener {
|
|||
: MatchResultListener(os) {}
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
|
||||
StreamMatchResultListener(const StreamMatchResultListener&) = delete;
|
||||
StreamMatchResultListener& operator=(const StreamMatchResultListener&) =
|
||||
delete;
|
||||
};
|
||||
|
||||
struct SharedPayloadBase {
|
||||
|
@ -284,17 +303,18 @@ class MatcherBase : private MatcherDescriberInterface {
|
|||
}
|
||||
|
||||
protected:
|
||||
MatcherBase() : vtable_(nullptr) {}
|
||||
MatcherBase() : vtable_(nullptr), buffer_() {}
|
||||
|
||||
// Constructs a matcher from its implementation.
|
||||
template <typename U>
|
||||
explicit MatcherBase(const MatcherInterface<U>* impl) {
|
||||
explicit MatcherBase(const MatcherInterface<U>* impl)
|
||||
: vtable_(nullptr), buffer_() {
|
||||
Init(impl);
|
||||
}
|
||||
|
||||
template <typename M, typename = typename std::remove_reference<
|
||||
M>::type::is_gtest_matcher>
|
||||
MatcherBase(M&& m) { // NOLINT
|
||||
MatcherBase(M&& m) : vtable_(nullptr), buffer_() { // NOLINT
|
||||
Init(std::forward<M>(m));
|
||||
}
|
||||
|
||||
|
@ -420,8 +440,8 @@ class MatcherBase : private MatcherDescriberInterface {
|
|||
static const M& Get(const MatcherBase& m) {
|
||||
// When inlined along with Init, need to be explicit to avoid violating
|
||||
// strict aliasing rules.
|
||||
const M *ptr = static_cast<const M*>(
|
||||
static_cast<const void*>(&m.buffer_));
|
||||
const M* ptr =
|
||||
static_cast<const M*>(static_cast<const void*>(&m.buffer_));
|
||||
return *ptr;
|
||||
}
|
||||
static void Init(MatcherBase& m, M impl) {
|
||||
|
@ -741,7 +761,7 @@ template <typename Rhs>
|
|||
class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
|
||||
public:
|
||||
explicit EqMatcher(const Rhs& rhs)
|
||||
: ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
|
||||
: ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) {}
|
||||
static const char* Desc() { return "is equal to"; }
|
||||
static const char* NegatedDesc() { return "isn't equal to"; }
|
||||
};
|
||||
|
@ -749,7 +769,7 @@ template <typename Rhs>
|
|||
class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
|
||||
public:
|
||||
explicit NeMatcher(const Rhs& rhs)
|
||||
: ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
|
||||
: ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) {}
|
||||
static const char* Desc() { return "isn't equal to"; }
|
||||
static const char* NegatedDesc() { return "is equal to"; }
|
||||
};
|
||||
|
@ -757,7 +777,7 @@ template <typename Rhs>
|
|||
class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
|
||||
public:
|
||||
explicit LtMatcher(const Rhs& rhs)
|
||||
: ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
|
||||
: ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) {}
|
||||
static const char* Desc() { return "is <"; }
|
||||
static const char* NegatedDesc() { return "isn't <"; }
|
||||
};
|
||||
|
@ -765,7 +785,7 @@ template <typename Rhs>
|
|||
class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
|
||||
public:
|
||||
explicit GtMatcher(const Rhs& rhs)
|
||||
: ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
|
||||
: ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) {}
|
||||
static const char* Desc() { return "is >"; }
|
||||
static const char* NegatedDesc() { return "isn't >"; }
|
||||
};
|
||||
|
@ -773,7 +793,7 @@ template <typename Rhs>
|
|||
class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
|
||||
public:
|
||||
explicit LeMatcher(const Rhs& rhs)
|
||||
: ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
|
||||
: ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) {}
|
||||
static const char* Desc() { return "is <="; }
|
||||
static const char* NegatedDesc() { return "isn't <="; }
|
||||
};
|
||||
|
@ -781,7 +801,7 @@ template <typename Rhs>
|
|||
class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
|
||||
public:
|
||||
explicit GeMatcher(const Rhs& rhs)
|
||||
: ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
|
||||
: ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) {}
|
||||
static const char* Desc() { return "is >="; }
|
||||
static const char* NegatedDesc() { return "isn't >="; }
|
||||
};
|
||||
|
@ -872,12 +892,16 @@ PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
|
|||
// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
|
||||
// wouldn't compile.
|
||||
template <typename T>
|
||||
inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
|
||||
inline internal::EqMatcher<T> Eq(T x) {
|
||||
return internal::EqMatcher<T>(x);
|
||||
}
|
||||
|
||||
// Constructs a Matcher<T> from a 'value' of type T. The constructed
|
||||
// matcher matches any value that's equal to 'value'.
|
||||
template <typename T>
|
||||
Matcher<T>::Matcher(T value) { *this = Eq(value); }
|
||||
Matcher<T>::Matcher(T value) {
|
||||
*this = Eq(value);
|
||||
}
|
||||
|
||||
// Creates a monomorphic matcher that matches anything with type Lhs
|
||||
// and equal to rhs. A user may need to use this instead of Eq(...)
|
||||
|
@ -892,7 +916,9 @@ Matcher<T>::Matcher(T value) { *this = Eq(value); }
|
|||
// can always write Matcher<T>(Lt(5)) to be explicit about the type,
|
||||
// for example.
|
||||
template <typename Lhs, typename Rhs>
|
||||
inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
|
||||
inline Matcher<Lhs> TypedEq(const Rhs& rhs) {
|
||||
return Eq(rhs);
|
||||
}
|
||||
|
||||
// Creates a polymorphic matcher that matches anything >= x.
|
||||
template <typename Rhs>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file defines the Message class.
|
||||
|
@ -42,7 +41,9 @@
|
|||
// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
|
||||
// program!
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
||||
|
@ -110,8 +111,8 @@ class GTEST_API_ Message {
|
|||
|
||||
// Streams a non-pointer value to this object.
|
||||
template <typename T>
|
||||
inline Message& operator <<(const T& val) {
|
||||
// Some libraries overload << for STL containers. These
|
||||
inline Message& operator<<(const T& val) {
|
||||
// Some libraries overload << for STL containers. These
|
||||
// overloads are defined in the global namespace instead of ::std.
|
||||
//
|
||||
// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
|
||||
|
@ -125,7 +126,7 @@ class GTEST_API_ Message {
|
|||
// from the global namespace. With this using declaration,
|
||||
// overloads of << defined in the global namespace and those
|
||||
// visible via Koenig lookup are both exposed in this function.
|
||||
using ::operator <<;
|
||||
using ::operator<<;
|
||||
*ss_ << val;
|
||||
return *this;
|
||||
}
|
||||
|
@ -144,7 +145,7 @@ class GTEST_API_ Message {
|
|||
// ensure consistent result across compilers, we always treat NULL
|
||||
// as "(null)".
|
||||
template <typename T>
|
||||
inline Message& operator <<(T* const& pointer) { // NOLINT
|
||||
inline Message& operator<<(T* const& pointer) { // NOLINT
|
||||
if (pointer == nullptr) {
|
||||
*ss_ << "(null)";
|
||||
} else {
|
||||
|
@ -159,25 +160,23 @@ class GTEST_API_ Message {
|
|||
// templatized version above. Without this definition, streaming
|
||||
// endl or other basic IO manipulators to Message will confuse the
|
||||
// compiler.
|
||||
Message& operator <<(BasicNarrowIoManip val) {
|
||||
Message& operator<<(BasicNarrowIoManip val) {
|
||||
*ss_ << val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Instead of 1/0, we want to see true/false for bool values.
|
||||
Message& operator <<(bool b) {
|
||||
return *this << (b ? "true" : "false");
|
||||
}
|
||||
Message& operator<<(bool b) { return *this << (b ? "true" : "false"); }
|
||||
|
||||
// These two overloads allow streaming a wide C string to a Message
|
||||
// using the UTF-8 encoding.
|
||||
Message& operator <<(const wchar_t* wide_c_str);
|
||||
Message& operator <<(wchar_t* wide_c_str);
|
||||
Message& operator<<(const wchar_t* wide_c_str);
|
||||
Message& operator<<(wchar_t* wide_c_str);
|
||||
|
||||
#if GTEST_HAS_STD_WSTRING
|
||||
// Converts the given wide string to a narrow string using the UTF-8
|
||||
// encoding, and streams the result to this Message object.
|
||||
Message& operator <<(const ::std::wstring& wstr);
|
||||
Message& operator<<(const ::std::wstring& wstr);
|
||||
#endif // GTEST_HAS_STD_WSTRING
|
||||
|
||||
// Gets the text streamed to this object so far as an std::string.
|
||||
|
@ -196,7 +195,7 @@ class GTEST_API_ Message {
|
|||
};
|
||||
|
||||
// Streams a Message to an ostream.
|
||||
inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
|
||||
inline std::ostream& operator<<(std::ostream& os, const Message& sb) {
|
||||
return os << sb.GetString();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,14 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// Macros and functions for implementing parameterized tests
|
||||
// in Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
||||
|
||||
|
@ -353,9 +356,7 @@ internal::ValueArray<T...> Values(T... v) {
|
|||
// }
|
||||
// INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool());
|
||||
//
|
||||
inline internal::ParamGenerator<bool> Bool() {
|
||||
return Values(false, true);
|
||||
}
|
||||
inline internal::ParamGenerator<bool> Bool() { return Values(false, true); }
|
||||
|
||||
// Combine() allows the user to combine two or more sequences to produce
|
||||
// values of a Cartesian product of those sequences' elements.
|
||||
|
@ -428,8 +429,11 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
|
|||
return 0; \
|
||||
} \
|
||||
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name)); \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||
(const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
|
||||
const GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name) &) = delete; /* NOLINT */ \
|
||||
}; \
|
||||
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name)::gtest_registering_dummy_ = \
|
||||
|
@ -453,43 +457,42 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
|
|||
#define GTEST_GET_FIRST_(first, ...) first
|
||||
#define GTEST_GET_SECOND_(first, second, ...) second
|
||||
|
||||
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
|
||||
static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
|
||||
gtest_##prefix##test_suite_name##_EvalGenerator_() { \
|
||||
return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
|
||||
} \
|
||||
static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
|
||||
const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
|
||||
if (::testing::internal::AlwaysFalse()) { \
|
||||
::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
|
||||
__VA_ARGS__, \
|
||||
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
|
||||
DUMMY_PARAM_))); \
|
||||
auto t = std::make_tuple(__VA_ARGS__); \
|
||||
static_assert(std::tuple_size<decltype(t)>::value <= 2, \
|
||||
"Too Many Args!"); \
|
||||
} \
|
||||
return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
|
||||
__VA_ARGS__, \
|
||||
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
|
||||
DUMMY_PARAM_))))(info); \
|
||||
} \
|
||||
static int gtest_##prefix##test_suite_name##_dummy_ \
|
||||
GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
::testing::UnitTest::GetInstance() \
|
||||
->parameterized_test_registry() \
|
||||
.GetTestSuitePatternHolder<test_suite_name>( \
|
||||
GTEST_STRINGIFY_(test_suite_name), \
|
||||
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
|
||||
->AddTestSuiteInstantiation( \
|
||||
GTEST_STRINGIFY_(prefix), \
|
||||
>est_##prefix##test_suite_name##_EvalGenerator_, \
|
||||
>est_##prefix##test_suite_name##_EvalGenerateName_, \
|
||||
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
|
||||
static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
|
||||
gtest_##prefix##test_suite_name##_EvalGenerator_() { \
|
||||
return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
|
||||
} \
|
||||
static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
|
||||
const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
|
||||
if (::testing::internal::AlwaysFalse()) { \
|
||||
::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
|
||||
__VA_ARGS__, \
|
||||
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
|
||||
DUMMY_PARAM_))); \
|
||||
auto t = std::make_tuple(__VA_ARGS__); \
|
||||
static_assert(std::tuple_size<decltype(t)>::value <= 2, \
|
||||
"Too Many Args!"); \
|
||||
} \
|
||||
return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
|
||||
__VA_ARGS__, \
|
||||
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
|
||||
DUMMY_PARAM_))))(info); \
|
||||
} \
|
||||
static int gtest_##prefix##test_suite_name##_dummy_ \
|
||||
GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
::testing::UnitTest::GetInstance() \
|
||||
->parameterized_test_registry() \
|
||||
.GetTestSuitePatternHolder<test_suite_name>( \
|
||||
GTEST_STRINGIFY_(test_suite_name), \
|
||||
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
|
||||
->AddTestSuiteInstantiation( \
|
||||
GTEST_STRINGIFY_(prefix), \
|
||||
>est_##prefix##test_suite_name##_EvalGenerator_, \
|
||||
>est_##prefix##test_suite_name##_EvalGenerateName_, \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
|
||||
// Allow Marking a Parameterized test class as not needing to be instantiated.
|
||||
#define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
|
||||
#define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
|
||||
namespace gtest_do_not_use_outside_namespace_scope {} \
|
||||
static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \
|
||||
GTEST_STRINGIFY_(T))
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// Google Test - The Google C++ Testing and Mocking Framework
|
||||
//
|
||||
// This file implements a universal value printer that can print a
|
||||
|
@ -95,7 +94,9 @@
|
|||
// being defined as many user-defined container types don't have
|
||||
// value_type.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
||||
|
@ -257,12 +258,10 @@ struct ConvertibleToStringViewPrinter {
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
// Prints the given number of bytes in the given object to the given
|
||||
// ostream.
|
||||
GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
|
||||
size_t count,
|
||||
::std::ostream* os);
|
||||
size_t count, ::std::ostream* os);
|
||||
struct RawBytesPrinter {
|
||||
// SFINAE on `sizeof` to make sure we have a complete type.
|
||||
template <typename T, size_t = sizeof(T)>
|
||||
|
@ -360,7 +359,7 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
|
|||
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
|
||||
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
|
||||
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
|
||||
#ifdef __cpp_char8_t
|
||||
#ifdef __cpp_lib_char8_t
|
||||
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char8_t);
|
||||
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char8_t);
|
||||
#endif
|
||||
|
@ -375,12 +374,12 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char32_t);
|
|||
// to point to a NUL-terminated string, and thus can print it as a string.
|
||||
|
||||
#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
|
||||
template <> \
|
||||
class FormatForComparison<CharType*, OtherStringType> { \
|
||||
public: \
|
||||
static ::std::string Format(CharType* value) { \
|
||||
return ::testing::PrintToString(value); \
|
||||
} \
|
||||
template <> \
|
||||
class FormatForComparison<CharType*, OtherStringType> { \
|
||||
public: \
|
||||
static ::std::string Format(CharType* value) { \
|
||||
return ::testing::PrintToString(value); \
|
||||
} \
|
||||
}
|
||||
|
||||
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
|
||||
|
@ -410,8 +409,8 @@ GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
|
|||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
template <typename T1, typename T2>
|
||||
std::string FormatForComparisonFailureMessage(
|
||||
const T1& value, const T2& /* other_operand */) {
|
||||
std::string FormatForComparisonFailureMessage(const T1& value,
|
||||
const T2& /* other_operand */) {
|
||||
return FormatForComparison<T1, T2>::Format(value);
|
||||
}
|
||||
|
||||
|
@ -479,6 +478,12 @@ inline void PrintTo(char8_t c, ::std::ostream* os) {
|
|||
}
|
||||
#endif
|
||||
|
||||
// gcc/clang __{u,}int128_t
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
GTEST_API_ void PrintTo(__uint128_t v, ::std::ostream* os);
|
||||
GTEST_API_ void PrintTo(__int128_t v, ::std::ostream* os);
|
||||
#endif // __SIZEOF_INT128__
|
||||
|
||||
// Overloads for C strings.
|
||||
GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
|
||||
inline void PrintTo(char* s, ::std::ostream* os) {
|
||||
|
@ -545,7 +550,7 @@ void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
|
|||
}
|
||||
|
||||
// Overloads for ::std::string.
|
||||
GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
|
||||
GTEST_API_ void PrintStringTo(const ::std::string& s, ::std::ostream* os);
|
||||
inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
|
||||
PrintStringTo(s, os);
|
||||
}
|
||||
|
@ -572,7 +577,7 @@ inline void PrintTo(const ::std::u32string& s, ::std::ostream* os) {
|
|||
|
||||
// Overloads for ::std::wstring.
|
||||
#if GTEST_HAS_STD_WSTRING
|
||||
GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
|
||||
GTEST_API_ void PrintWideStringTo(const ::std::wstring& s, ::std::ostream* os);
|
||||
inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
|
||||
PrintWideStringTo(s, os);
|
||||
}
|
||||
|
@ -587,6 +592,12 @@ inline void PrintTo(internal::StringView sp, ::std::ostream* os) {
|
|||
|
||||
inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
|
||||
|
||||
#if GTEST_HAS_RTTI
|
||||
inline void PrintTo(const std::type_info& info, std::ostream* os) {
|
||||
*os << internal::GetTypeName(info);
|
||||
}
|
||||
#endif // GTEST_HAS_RTTI
|
||||
|
||||
template <typename T>
|
||||
void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) {
|
||||
UniversalPrinter<T&>::Print(ref.get(), os);
|
||||
|
@ -744,6 +755,14 @@ class UniversalPrinter<Optional<T>> {
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class UniversalPrinter<decltype(Nullopt())> {
|
||||
public:
|
||||
static void Print(decltype(Nullopt()), ::std::ostream* os) {
|
||||
*os << "(nullopt)";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // GTEST_INTERNAL_HAS_OPTIONAL
|
||||
|
||||
#if GTEST_INTERNAL_HAS_VARIANT
|
||||
|
@ -802,8 +821,8 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
|
|||
}
|
||||
}
|
||||
// This overload prints a (const) char array compactly.
|
||||
GTEST_API_ void UniversalPrintArray(
|
||||
const char* begin, size_t len, ::std::ostream* os);
|
||||
GTEST_API_ void UniversalPrintArray(const char* begin, size_t len,
|
||||
::std::ostream* os);
|
||||
|
||||
#ifdef __cpp_char8_t
|
||||
// This overload prints a (const) char8_t array compactly.
|
||||
|
@ -820,8 +839,8 @@ GTEST_API_ void UniversalPrintArray(const char32_t* begin, size_t len,
|
|||
::std::ostream* os);
|
||||
|
||||
// This overload prints a (const) wchar_t array compactly.
|
||||
GTEST_API_ void UniversalPrintArray(
|
||||
const wchar_t* begin, size_t len, ::std::ostream* os);
|
||||
GTEST_API_ void UniversalPrintArray(const wchar_t* begin, size_t len,
|
||||
::std::ostream* os);
|
||||
|
||||
// Implements printing an array type T[N].
|
||||
template <typename T, size_t N>
|
||||
|
@ -980,10 +999,10 @@ void UniversalPrint(const T& value, ::std::ostream* os) {
|
|||
UniversalPrinter<T1>::Print(value, os);
|
||||
}
|
||||
|
||||
typedef ::std::vector< ::std::string> Strings;
|
||||
typedef ::std::vector<::std::string> Strings;
|
||||
|
||||
// Tersely prints the first N fields of a tuple to a string vector,
|
||||
// one element for each field.
|
||||
// Tersely prints the first N fields of a tuple to a string vector,
|
||||
// one element for each field.
|
||||
template <typename Tuple>
|
||||
void TersePrintPrefixToStrings(const Tuple&, std::integral_constant<size_t, 0>,
|
||||
Strings*) {}
|
||||
|
|
|
@ -27,12 +27,9 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// Utilities for testing Google Test itself and code that uses Google Test
|
||||
// (e.g. frameworks built on top of Google Test).
|
||||
|
||||
// GOOGLETEST_CM0004 DO NOT DELETE
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
|
||||
|
||||
|
@ -88,7 +85,10 @@ class GTEST_API_ ScopedFakeTestPartResultReporter
|
|||
TestPartResultReporterInterface* old_reporter_;
|
||||
TestPartResultArray* const result_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
|
||||
ScopedFakeTestPartResultReporter(const ScopedFakeTestPartResultReporter&) =
|
||||
delete;
|
||||
ScopedFakeTestPartResultReporter& operator=(
|
||||
const ScopedFakeTestPartResultReporter&) = delete;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
@ -104,12 +104,14 @@ class GTEST_API_ SingleFailureChecker {
|
|||
SingleFailureChecker(const TestPartResultArray* results,
|
||||
TestPartResult::Type type, const std::string& substr);
|
||||
~SingleFailureChecker();
|
||||
|
||||
private:
|
||||
const TestPartResultArray* const results_;
|
||||
const TestPartResult::Type type_;
|
||||
const std::string substr_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
|
||||
SingleFailureChecker(const SingleFailureChecker&) = delete;
|
||||
SingleFailureChecker& operator=(const SingleFailureChecker&) = delete;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -119,7 +121,8 @@ class GTEST_API_ SingleFailureChecker {
|
|||
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||
|
||||
// A set of macros for testing Google Test assertions or code that's expected
|
||||
// to generate Google Test fatal failures. It verifies that the given
|
||||
// to generate Google Test fatal failures (e.g. a failure from an ASSERT_EQ, but
|
||||
// not a non-fatal failure, as from EXPECT_EQ). It verifies that the given
|
||||
// statement will cause exactly one fatal Google Test failure with 'substr'
|
||||
// being part of the failure message.
|
||||
//
|
||||
|
@ -141,44 +144,46 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|||
// helper macro, due to some peculiarity in how the preprocessor
|
||||
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
|
||||
// gtest_unittest.cc will fail to compile if we do that.
|
||||
#define EXPECT_FATAL_FAILURE(statement, substr) \
|
||||
do { \
|
||||
class GTestExpectFatalFailureHelper {\
|
||||
public:\
|
||||
static void Execute() { statement; }\
|
||||
};\
|
||||
::testing::TestPartResultArray gtest_failures;\
|
||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
||||
{\
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||
::testing::ScopedFakeTestPartResultReporter:: \
|
||||
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
||||
GTestExpectFatalFailureHelper::Execute();\
|
||||
}\
|
||||
#define EXPECT_FATAL_FAILURE(statement, substr) \
|
||||
do { \
|
||||
class GTestExpectFatalFailureHelper { \
|
||||
public: \
|
||||
static void Execute() { statement; } \
|
||||
}; \
|
||||
::testing::TestPartResultArray gtest_failures; \
|
||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \
|
||||
{ \
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||
::testing::ScopedFakeTestPartResultReporter:: \
|
||||
INTERCEPT_ONLY_CURRENT_THREAD, \
|
||||
>est_failures); \
|
||||
GTestExpectFatalFailureHelper::Execute(); \
|
||||
} \
|
||||
} while (::testing::internal::AlwaysFalse())
|
||||
|
||||
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||
do { \
|
||||
class GTestExpectFatalFailureHelper {\
|
||||
public:\
|
||||
static void Execute() { statement; }\
|
||||
};\
|
||||
::testing::TestPartResultArray gtest_failures;\
|
||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
||||
{\
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||
::testing::ScopedFakeTestPartResultReporter:: \
|
||||
INTERCEPT_ALL_THREADS, >est_failures);\
|
||||
GTestExpectFatalFailureHelper::Execute();\
|
||||
}\
|
||||
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||
do { \
|
||||
class GTestExpectFatalFailureHelper { \
|
||||
public: \
|
||||
static void Execute() { statement; } \
|
||||
}; \
|
||||
::testing::TestPartResultArray gtest_failures; \
|
||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \
|
||||
{ \
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
||||
>est_failures); \
|
||||
GTestExpectFatalFailureHelper::Execute(); \
|
||||
} \
|
||||
} while (::testing::internal::AlwaysFalse())
|
||||
|
||||
// A macro for testing Google Test assertions or code that's expected to
|
||||
// generate Google Test non-fatal failures. It asserts that the given
|
||||
// statement will cause exactly one non-fatal Google Test failure with 'substr'
|
||||
// being part of the failure message.
|
||||
// generate Google Test non-fatal failures (e.g. a failure from an EXPECT_EQ,
|
||||
// but not from an ASSERT_EQ). It asserts that the given statement will cause
|
||||
// exactly one non-fatal Google Test failure with 'substr' being part of the
|
||||
// failure message.
|
||||
//
|
||||
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
|
||||
// affects and considers failures generated in the current thread and
|
||||
|
@ -207,32 +212,37 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|||
// instead of
|
||||
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
||||
// to avoid an MSVC warning on unreachable code.
|
||||
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
||||
do {\
|
||||
::testing::TestPartResultArray gtest_failures;\
|
||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
||||
do { \
|
||||
::testing::TestPartResultArray gtest_failures; \
|
||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
||||
(substr));\
|
||||
{\
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||
::testing::ScopedFakeTestPartResultReporter:: \
|
||||
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
||||
if (::testing::internal::AlwaysTrue()) { statement; }\
|
||||
}\
|
||||
(substr)); \
|
||||
{ \
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||
::testing::ScopedFakeTestPartResultReporter:: \
|
||||
INTERCEPT_ONLY_CURRENT_THREAD, \
|
||||
>est_failures); \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
statement; \
|
||||
} \
|
||||
} \
|
||||
} while (::testing::internal::AlwaysFalse())
|
||||
|
||||
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||
do {\
|
||||
::testing::TestPartResultArray gtest_failures;\
|
||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
||||
(substr));\
|
||||
{\
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||
do { \
|
||||
::testing::TestPartResultArray gtest_failures; \
|
||||
::testing::internal::SingleFailureChecker gtest_checker( \
|
||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
||||
(substr)); \
|
||||
{ \
|
||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter( \
|
||||
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
||||
>est_failures);\
|
||||
if (::testing::internal::AlwaysTrue()) { statement; }\
|
||||
}\
|
||||
>est_failures); \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
statement; \
|
||||
} \
|
||||
} \
|
||||
} while (::testing::internal::AlwaysFalse())
|
||||
|
||||
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
|
||||
|
|
|
@ -26,14 +26,17 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
||||
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-string.h"
|
||||
|
||||
|
@ -142,7 +145,8 @@ class GTEST_API_ TestPartResultArray {
|
|||
private:
|
||||
std::vector<TestPartResult> array_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
|
||||
TestPartResultArray(const TestPartResultArray&) = delete;
|
||||
TestPartResultArray& operator=(const TestPartResultArray&) = delete;
|
||||
};
|
||||
|
||||
// This interface knows how to report a test part result.
|
||||
|
@ -168,11 +172,13 @@ class GTEST_API_ HasNewFatalFailureHelper
|
|||
~HasNewFatalFailureHelper() override;
|
||||
void ReportTestPartResult(const TestPartResult& result) override;
|
||||
bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
|
||||
|
||||
private:
|
||||
bool has_new_fatal_failure_;
|
||||
TestPartResultReporterInterface* original_reporter_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
|
||||
HasNewFatalFailureHelper(const HasNewFatalFailureHelper&) = delete;
|
||||
HasNewFatalFailureHelper& operator=(const HasNewFatalFailureHelper&) = delete;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
||||
|
@ -190,7 +192,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||
typedef ::testing::internal::GenerateTypeList<Types>::type \
|
||||
GTEST_TYPE_PARAMS_(CaseName); \
|
||||
typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
|
||||
GTEST_NAME_GENERATOR_(CaseName)
|
||||
GTEST_NAME_GENERATOR_(CaseName)
|
||||
|
||||
#define TYPED_TEST(CaseName, TestName) \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \
|
||||
|
@ -256,7 +258,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||
// #included in multiple translation units linked together.
|
||||
#define TYPED_TEST_SUITE_P(SuiteName) \
|
||||
static ::testing::internal::TypedTestSuitePState \
|
||||
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
|
||||
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
|
||||
|
||||
// Legacy API is deprecated but still available
|
||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||
|
@ -301,21 +303,21 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||
REGISTER_TYPED_TEST_SUITE_P
|
||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||
|
||||
#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \
|
||||
"test-suit-prefix must not be empty"); \
|
||||
static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
::testing::internal::TypeParameterizedTestSuite< \
|
||||
SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
|
||||
::testing::internal::GenerateTypeList<Types>::type>:: \
|
||||
Register(GTEST_STRINGIFY_(Prefix), \
|
||||
::testing::internal::CodeLocation(__FILE__, __LINE__), \
|
||||
>EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
|
||||
GTEST_STRINGIFY_(SuiteName), \
|
||||
GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
|
||||
::testing::internal::GenerateNames< \
|
||||
::testing::internal::NameGeneratorSelector< \
|
||||
__VA_ARGS__>::type, \
|
||||
#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \
|
||||
"test-suit-prefix must not be empty"); \
|
||||
static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
::testing::internal::TypeParameterizedTestSuite< \
|
||||
SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
|
||||
::testing::internal::GenerateTypeList<Types>::type>:: \
|
||||
Register(GTEST_STRINGIFY_(Prefix), \
|
||||
::testing::internal::CodeLocation(__FILE__, __LINE__), \
|
||||
>EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
|
||||
GTEST_STRINGIFY_(SuiteName), \
|
||||
GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
|
||||
::testing::internal::GenerateNames< \
|
||||
::testing::internal::NameGeneratorSelector< \
|
||||
__VA_ARGS__>::type, \
|
||||
::testing::internal::GenerateTypeList<Types>::type>())
|
||||
|
||||
// Legacy API is deprecated but still available
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file defines the public API for Google Test. It should be
|
||||
|
@ -47,8 +46,6 @@
|
|||
// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
|
||||
// easyUnit framework.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
||||
|
||||
|
@ -59,31 +56,22 @@
|
|||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-string.h"
|
||||
#include "gtest/gtest-assertion-result.h"
|
||||
#include "gtest/gtest-death-test.h"
|
||||
#include "gtest/gtest-matchers.h"
|
||||
#include "gtest/gtest-message.h"
|
||||
#include "gtest/gtest-param-test.h"
|
||||
#include "gtest/gtest-printers.h"
|
||||
#include "gtest/gtest_prod.h"
|
||||
#include "gtest/gtest-test-part.h"
|
||||
#include "gtest/gtest-typed-test.h"
|
||||
#include "gtest/gtest_pred_impl.h"
|
||||
#include "gtest/gtest_prod.h"
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-string.h"
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||
|
||||
namespace testing {
|
||||
|
||||
// Silence C4100 (unreferenced formal parameter) and 4805
|
||||
// unsafe mix of type 'const int' and type 'const bool'
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4805)
|
||||
# pragma warning(disable:4100)
|
||||
#endif
|
||||
|
||||
|
||||
// Declares the flags.
|
||||
|
||||
// This flag temporary enables the disabled tests.
|
||||
|
@ -138,6 +126,12 @@ GTEST_DECLARE_int32_(random_seed);
|
|||
// is 1. If the value is -1 the tests are repeating forever.
|
||||
GTEST_DECLARE_int32_(repeat);
|
||||
|
||||
// This flag controls whether Google Test Environments are recreated for each
|
||||
// repeat of the tests. The default value is true. If set to false the global
|
||||
// test Environment objects are only set up once, for the first iteration, and
|
||||
// only torn down once, for the last.
|
||||
GTEST_DECLARE_bool_(recreate_environments_when_repeating);
|
||||
|
||||
// This flag controls whether Google Test includes Google Test internal
|
||||
// stack frames in failure stack traces.
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
|
@ -163,6 +157,16 @@ GTEST_DECLARE_string_(stream_result_to);
|
|||
GTEST_DECLARE_string_(flagfile);
|
||||
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
|
||||
|
||||
namespace testing {
|
||||
|
||||
// Silence C4100 (unreferenced formal parameter) and 4805
|
||||
// unsafe mix of type 'const int' and type 'const bool'
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4805)
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
|
||||
// The upper limit for valid stack trace depths.
|
||||
const int kMaxStackTraceDepth = 100;
|
||||
|
||||
|
@ -201,193 +205,6 @@ using TestCase = TestSuite;
|
|||
class TestInfo;
|
||||
class UnitTest;
|
||||
|
||||
// A class for indicating whether an assertion was successful. When
|
||||
// the assertion wasn't successful, the AssertionResult object
|
||||
// remembers a non-empty message that describes how it failed.
|
||||
//
|
||||
// To create an instance of this class, use one of the factory functions
|
||||
// (AssertionSuccess() and AssertionFailure()).
|
||||
//
|
||||
// This class is useful for two purposes:
|
||||
// 1. Defining predicate functions to be used with Boolean test assertions
|
||||
// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
|
||||
// 2. Defining predicate-format functions to be
|
||||
// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
|
||||
//
|
||||
// For example, if you define IsEven predicate:
|
||||
//
|
||||
// testing::AssertionResult IsEven(int n) {
|
||||
// if ((n % 2) == 0)
|
||||
// return testing::AssertionSuccess();
|
||||
// else
|
||||
// return testing::AssertionFailure() << n << " is odd";
|
||||
// }
|
||||
//
|
||||
// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
|
||||
// will print the message
|
||||
//
|
||||
// Value of: IsEven(Fib(5))
|
||||
// Actual: false (5 is odd)
|
||||
// Expected: true
|
||||
//
|
||||
// instead of a more opaque
|
||||
//
|
||||
// Value of: IsEven(Fib(5))
|
||||
// Actual: false
|
||||
// Expected: true
|
||||
//
|
||||
// in case IsEven is a simple Boolean predicate.
|
||||
//
|
||||
// If you expect your predicate to be reused and want to support informative
|
||||
// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
|
||||
// about half as often as positive ones in our tests), supply messages for
|
||||
// both success and failure cases:
|
||||
//
|
||||
// testing::AssertionResult IsEven(int n) {
|
||||
// if ((n % 2) == 0)
|
||||
// return testing::AssertionSuccess() << n << " is even";
|
||||
// else
|
||||
// return testing::AssertionFailure() << n << " is odd";
|
||||
// }
|
||||
//
|
||||
// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
|
||||
//
|
||||
// Value of: IsEven(Fib(6))
|
||||
// Actual: true (8 is even)
|
||||
// Expected: false
|
||||
//
|
||||
// NB: Predicates that support negative Boolean assertions have reduced
|
||||
// performance in positive ones so be careful not to use them in tests
|
||||
// that have lots (tens of thousands) of positive Boolean assertions.
|
||||
//
|
||||
// To use this class with EXPECT_PRED_FORMAT assertions such as:
|
||||
//
|
||||
// // Verifies that Foo() returns an even number.
|
||||
// EXPECT_PRED_FORMAT1(IsEven, Foo());
|
||||
//
|
||||
// you need to define:
|
||||
//
|
||||
// testing::AssertionResult IsEven(const char* expr, int n) {
|
||||
// if ((n % 2) == 0)
|
||||
// return testing::AssertionSuccess();
|
||||
// else
|
||||
// return testing::AssertionFailure()
|
||||
// << "Expected: " << expr << " is even\n Actual: it's " << n;
|
||||
// }
|
||||
//
|
||||
// If Foo() returns 5, you will see the following message:
|
||||
//
|
||||
// Expected: Foo() is even
|
||||
// Actual: it's 5
|
||||
//
|
||||
class GTEST_API_ AssertionResult {
|
||||
public:
|
||||
// Copy constructor.
|
||||
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
||||
AssertionResult(const AssertionResult& other);
|
||||
|
||||
// C4800 is a level 3 warning in Visual Studio 2015 and earlier.
|
||||
// This warning is not emitted in Visual Studio 2017.
|
||||
// This warning is off by default starting in Visual Studio 2019 but can be
|
||||
// enabled with command-line options.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
||||
#endif
|
||||
|
||||
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
||||
//
|
||||
// T must be contextually convertible to bool.
|
||||
//
|
||||
// The second parameter prevents this overload from being considered if
|
||||
// the argument is implicitly convertible to AssertionResult. In that case
|
||||
// we want AssertionResult's copy constructor to be used.
|
||||
template <typename T>
|
||||
explicit AssertionResult(
|
||||
const T& success,
|
||||
typename std::enable_if<
|
||||
!std::is_convertible<T, AssertionResult>::value>::type*
|
||||
/*enabler*/
|
||||
= nullptr)
|
||||
: success_(success) {}
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
||||
#endif
|
||||
|
||||
// Assignment operator.
|
||||
AssertionResult& operator=(AssertionResult other) {
|
||||
swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Returns true if and only if the assertion succeeded.
|
||||
operator bool() const { return success_; } // NOLINT
|
||||
|
||||
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
||||
AssertionResult operator!() const;
|
||||
|
||||
// Returns the text streamed into this AssertionResult. Test assertions
|
||||
// use it when they fail (i.e., the predicate's outcome doesn't match the
|
||||
// assertion's expectation). When nothing has been streamed into the
|
||||
// object, returns an empty string.
|
||||
const char* message() const {
|
||||
return message_.get() != nullptr ? message_->c_str() : "";
|
||||
}
|
||||
// Deprecated; please use message() instead.
|
||||
const char* failure_message() const { return message(); }
|
||||
|
||||
// Streams a custom failure message into this object.
|
||||
template <typename T> AssertionResult& operator<<(const T& value) {
|
||||
AppendMessage(Message() << value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Allows streaming basic output manipulators such as endl or flush into
|
||||
// this object.
|
||||
AssertionResult& operator<<(
|
||||
::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
|
||||
AppendMessage(Message() << basic_manipulator);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
// Appends the contents of message to message_.
|
||||
void AppendMessage(const Message& a_message) {
|
||||
if (message_.get() == nullptr) message_.reset(new ::std::string);
|
||||
message_->append(a_message.GetString().c_str());
|
||||
}
|
||||
|
||||
// Swap the contents of this AssertionResult with other.
|
||||
void swap(AssertionResult& other);
|
||||
|
||||
// Stores result of the assertion predicate.
|
||||
bool success_;
|
||||
// Stores the message describing the condition in case the expectation
|
||||
// construct is not satisfied with the predicate's outcome.
|
||||
// Referenced via a pointer to avoid taking too much stack frame space
|
||||
// with test assertions.
|
||||
std::unique_ptr< ::std::string> message_;
|
||||
};
|
||||
|
||||
// Makes a successful assertion result.
|
||||
GTEST_API_ AssertionResult AssertionSuccess();
|
||||
|
||||
// Makes a failed assertion result.
|
||||
GTEST_API_ AssertionResult AssertionFailure();
|
||||
|
||||
// Makes a failed assertion result with the given failure message.
|
||||
// Deprecated; use AssertionFailure() << msg.
|
||||
GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
|
||||
|
||||
} // namespace testing
|
||||
|
||||
// Includes the auto-generated header that implements a family of generic
|
||||
// predicate assertion macros. This include comes late because it relies on
|
||||
// APIs declared above.
|
||||
#include "gtest/gtest_pred_impl.h"
|
||||
|
||||
namespace testing {
|
||||
|
||||
// The abstract class that all tests inherit from.
|
||||
//
|
||||
// In Google Test, a unit test program contains one or many TestSuites, and
|
||||
|
@ -522,7 +339,8 @@ class GTEST_API_ Test {
|
|||
virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
|
||||
|
||||
// We disallow copying Tests.
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
|
||||
Test(const Test&) = delete;
|
||||
Test& operator=(const Test&) = delete;
|
||||
};
|
||||
|
||||
typedef internal::TimeInMillis TimeInMillis;
|
||||
|
@ -536,24 +354,17 @@ class TestProperty {
|
|||
// C'tor. TestProperty does NOT have a default constructor.
|
||||
// Always use this constructor (with parameters) to create a
|
||||
// TestProperty object.
|
||||
TestProperty(const std::string& a_key, const std::string& a_value) :
|
||||
key_(a_key), value_(a_value) {
|
||||
}
|
||||
TestProperty(const std::string& a_key, const std::string& a_value)
|
||||
: key_(a_key), value_(a_value) {}
|
||||
|
||||
// Gets the user supplied key.
|
||||
const char* key() const {
|
||||
return key_.c_str();
|
||||
}
|
||||
const char* key() const { return key_.c_str(); }
|
||||
|
||||
// Gets the user supplied value.
|
||||
const char* value() const {
|
||||
return value_.c_str();
|
||||
}
|
||||
const char* value() const { return value_.c_str(); }
|
||||
|
||||
// Sets a new value, overriding the one supplied in the constructor.
|
||||
void SetValue(const std::string& new_value) {
|
||||
value_ = new_value;
|
||||
}
|
||||
void SetValue(const std::string& new_value) { value_ = new_value; }
|
||||
|
||||
private:
|
||||
// The key supplied by the user.
|
||||
|
@ -687,7 +498,8 @@ class GTEST_API_ TestResult {
|
|||
TimeInMillis elapsed_time_;
|
||||
|
||||
// We disallow copying TestResult.
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
|
||||
TestResult(const TestResult&) = delete;
|
||||
TestResult& operator=(const TestResult&) = delete;
|
||||
}; // class TestResult
|
||||
|
||||
// A TestInfo object stores the following information about a test:
|
||||
|
@ -811,8 +623,8 @@ class GTEST_API_ TestInfo {
|
|||
}
|
||||
|
||||
// These fields are immutable properties of the test.
|
||||
const std::string test_suite_name_; // test suite name
|
||||
const std::string name_; // Test name
|
||||
const std::string test_suite_name_; // test suite name
|
||||
const std::string name_; // Test name
|
||||
// Name of the parameter type, or NULL if this is not a typed or a
|
||||
// type-parameterized test.
|
||||
const std::unique_ptr<const ::std::string> type_param_;
|
||||
|
@ -833,7 +645,8 @@ class GTEST_API_ TestInfo {
|
|||
// test for the second time.
|
||||
TestResult result_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
|
||||
TestInfo(const TestInfo&) = delete;
|
||||
TestInfo& operator=(const TestInfo&) = delete;
|
||||
};
|
||||
|
||||
// A test suite, which consists of a vector of TestInfos.
|
||||
|
@ -941,7 +754,7 @@ class GTEST_API_ TestSuite {
|
|||
|
||||
// Adds a TestInfo to this test suite. Will delete the TestInfo upon
|
||||
// destruction of the TestSuite object.
|
||||
void AddTestInfo(TestInfo * test_info);
|
||||
void AddTestInfo(TestInfo* test_info);
|
||||
|
||||
// Clears the results of all tests in this test suite.
|
||||
void ClearResult();
|
||||
|
@ -1042,7 +855,8 @@ class GTEST_API_ TestSuite {
|
|||
TestResult ad_hoc_test_result_;
|
||||
|
||||
// We disallow copying TestSuites.
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestSuite);
|
||||
TestSuite(const TestSuite&) = delete;
|
||||
TestSuite& operator=(const TestSuite&) = delete;
|
||||
};
|
||||
|
||||
// An Environment object is capable of setting up and tearing down an
|
||||
|
@ -1069,6 +883,7 @@ class Environment {
|
|||
|
||||
// Override this to define how to tear down the environment.
|
||||
virtual void TearDown() {}
|
||||
|
||||
private:
|
||||
// If you see an error about overriding the following function or
|
||||
// about it being private, you have mis-spelled SetUp() as Setup().
|
||||
|
@ -1120,6 +935,9 @@ class TestEventListener {
|
|||
// Fired before the test starts.
|
||||
virtual void OnTestStart(const TestInfo& test_info) = 0;
|
||||
|
||||
// Fired when a test is disabled
|
||||
virtual void OnTestDisabled(const TestInfo& /*test_info*/) {}
|
||||
|
||||
// Fired after a failed assertion or a SUCCEED() invocation.
|
||||
// If you want to throw an exception from this function to skip to the next
|
||||
// TEST, it must be AssertionException defined above, or inherited from it.
|
||||
|
@ -1143,8 +961,7 @@ class TestEventListener {
|
|||
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
|
||||
|
||||
// Fired after each iteration of tests finishes.
|
||||
virtual void OnTestIterationEnd(const UnitTest& unit_test,
|
||||
int iteration) = 0;
|
||||
virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) = 0;
|
||||
|
||||
// Fired after all test activities have ended.
|
||||
virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
|
||||
|
@ -1169,6 +986,7 @@ class EmptyTestEventListener : public TestEventListener {
|
|||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||
|
||||
void OnTestStart(const TestInfo& /*test_info*/) override {}
|
||||
void OnTestDisabled(const TestInfo& /*test_info*/) override {}
|
||||
void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
|
||||
void OnTestEnd(const TestInfo& /*test_info*/) override {}
|
||||
void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
|
||||
|
@ -1258,7 +1076,8 @@ class GTEST_API_ TestEventListeners {
|
|||
TestEventListener* default_xml_generator_;
|
||||
|
||||
// We disallow copying TestEventListeners.
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
|
||||
TestEventListeners(const TestEventListeners&) = delete;
|
||||
TestEventListeners& operator=(const TestEventListeners&) = delete;
|
||||
};
|
||||
|
||||
// A UnitTest consists of a vector of TestSuites.
|
||||
|
@ -1301,8 +1120,7 @@ class GTEST_API_ UnitTest {
|
|||
|
||||
// Returns the TestInfo object for the test that's currently running,
|
||||
// or NULL if no test is running.
|
||||
const TestInfo* current_test_info() const
|
||||
GTEST_LOCK_EXCLUDED_(mutex_);
|
||||
const TestInfo* current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_);
|
||||
|
||||
// Returns the random seed used at the start of the current test run.
|
||||
int random_seed() const;
|
||||
|
@ -1408,8 +1226,7 @@ class GTEST_API_ UnitTest {
|
|||
// eventually call this to report their results. The user code
|
||||
// should use the assertion macros instead of calling this directly.
|
||||
void AddTestPartResult(TestPartResult::Type result_type,
|
||||
const char* file_name,
|
||||
int line_number,
|
||||
const char* file_name, int line_number,
|
||||
const std::string& message,
|
||||
const std::string& os_stack_trace)
|
||||
GTEST_LOCK_EXCLUDED_(mutex_);
|
||||
|
@ -1440,8 +1257,7 @@ class GTEST_API_ UnitTest {
|
|||
friend std::set<std::string>* internal::GetIgnoredParameterizedTestSuites();
|
||||
friend internal::UnitTestImpl* internal::GetUnitTestImpl();
|
||||
friend void internal::ReportFailureInUnknownLocation(
|
||||
TestPartResult::Type result_type,
|
||||
const std::string& message);
|
||||
TestPartResult::Type result_type, const std::string& message);
|
||||
|
||||
// Creates an empty UnitTest.
|
||||
UnitTest();
|
||||
|
@ -1455,8 +1271,7 @@ class GTEST_API_ UnitTest {
|
|||
GTEST_LOCK_EXCLUDED_(mutex_);
|
||||
|
||||
// Pops a trace from the per-thread Google Test trace stack.
|
||||
void PopGTestTrace()
|
||||
GTEST_LOCK_EXCLUDED_(mutex_);
|
||||
void PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_);
|
||||
|
||||
// Protects mutable state in *impl_. This is mutable as some const
|
||||
// methods need to lock it too.
|
||||
|
@ -1469,7 +1284,8 @@ class GTEST_API_ UnitTest {
|
|||
internal::UnitTestImpl* impl_;
|
||||
|
||||
// We disallow copying UnitTest.
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
|
||||
UnitTest(const UnitTest&) = delete;
|
||||
UnitTest& operator=(const UnitTest&) = delete;
|
||||
};
|
||||
|
||||
// A convenient wrapper for adding an environment for the test
|
||||
|
@ -1520,13 +1336,11 @@ namespace internal {
|
|||
// when calling EXPECT_* in a tight loop.
|
||||
template <typename T1, typename T2>
|
||||
AssertionResult CmpHelperEQFailure(const char* lhs_expression,
|
||||
const char* rhs_expression,
|
||||
const T1& lhs, const T2& rhs) {
|
||||
return EqFailure(lhs_expression,
|
||||
rhs_expression,
|
||||
const char* rhs_expression, const T1& lhs,
|
||||
const T2& rhs) {
|
||||
return EqFailure(lhs_expression, rhs_expression,
|
||||
FormatForComparisonFailureMessage(lhs, rhs),
|
||||
FormatForComparisonFailureMessage(rhs, lhs),
|
||||
false);
|
||||
FormatForComparisonFailureMessage(rhs, lhs), false);
|
||||
}
|
||||
|
||||
// This block of code defines operator==/!=
|
||||
|
@ -1539,8 +1353,7 @@ inline bool operator!=(faketype, faketype) { return false; }
|
|||
// The helper function for {ASSERT|EXPECT}_EQ.
|
||||
template <typename T1, typename T2>
|
||||
AssertionResult CmpHelperEQ(const char* lhs_expression,
|
||||
const char* rhs_expression,
|
||||
const T1& lhs,
|
||||
const char* rhs_expression, const T1& lhs,
|
||||
const T2& rhs) {
|
||||
if (lhs == rhs) {
|
||||
return AssertionSuccess();
|
||||
|
@ -1571,8 +1384,7 @@ class EqHelper {
|
|||
// Even though its body looks the same as the above version, we
|
||||
// cannot merge the two, as it will make anonymous enums unhappy.
|
||||
static AssertionResult Compare(const char* lhs_expression,
|
||||
const char* rhs_expression,
|
||||
BiggestInt lhs,
|
||||
const char* rhs_expression, BiggestInt lhs,
|
||||
BiggestInt rhs) {
|
||||
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|
||||
}
|
||||
|
@ -1607,16 +1419,16 @@ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
|
|||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
|
||||
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
|
||||
template <typename T1, typename T2>\
|
||||
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
||||
const T1& val1, const T2& val2) {\
|
||||
if (val1 op val2) {\
|
||||
return AssertionSuccess();\
|
||||
} else {\
|
||||
return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
|
||||
}\
|
||||
}
|
||||
#define GTEST_IMPL_CMP_HELPER_(op_name, op) \
|
||||
template <typename T1, typename T2> \
|
||||
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
||||
const T1& val1, const T2& val2) { \
|
||||
if (val1 op val2) { \
|
||||
return AssertionSuccess(); \
|
||||
} else { \
|
||||
return CmpHelperOpFailure(expr1, expr2, val1, val2, #op); \
|
||||
} \
|
||||
}
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
|
||||
|
@ -1638,49 +1450,42 @@ GTEST_IMPL_CMP_HELPER_(GT, >)
|
|||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
||||
const char* s2_expression,
|
||||
const char* s1,
|
||||
const char* s2);
|
||||
const char* s1, const char* s2);
|
||||
|
||||
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
|
||||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
|
||||
const char* s2_expression,
|
||||
const char* s1,
|
||||
const char* s2);
|
||||
const char* s1, const char* s2);
|
||||
|
||||
// The helper function for {ASSERT|EXPECT}_STRNE.
|
||||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
||||
const char* s2_expression,
|
||||
const char* s1,
|
||||
const char* s2);
|
||||
const char* s1, const char* s2);
|
||||
|
||||
// The helper function for {ASSERT|EXPECT}_STRCASENE.
|
||||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
|
||||
const char* s2_expression,
|
||||
const char* s1,
|
||||
const char* s2);
|
||||
|
||||
const char* s1, const char* s2);
|
||||
|
||||
// Helper function for *_STREQ on wide strings.
|
||||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
||||
const char* s2_expression,
|
||||
const wchar_t* s1,
|
||||
const wchar_t* s2);
|
||||
const wchar_t* s1, const wchar_t* s2);
|
||||
|
||||
// Helper function for *_STRNE on wide strings.
|
||||
//
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
||||
const char* s2_expression,
|
||||
const wchar_t* s1,
|
||||
const wchar_t* s2);
|
||||
const wchar_t* s1, const wchar_t* s2);
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
@ -1692,32 +1497,40 @@ GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
|||
//
|
||||
// The {needle,haystack}_expr arguments are the stringified
|
||||
// expressions that generated the two real arguments.
|
||||
GTEST_API_ AssertionResult IsSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const char* needle, const char* haystack);
|
||||
GTEST_API_ AssertionResult IsSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const wchar_t* needle, const wchar_t* haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const char* needle, const char* haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const wchar_t* needle, const wchar_t* haystack);
|
||||
GTEST_API_ AssertionResult IsSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const ::std::string& needle, const ::std::string& haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const ::std::string& needle, const ::std::string& haystack);
|
||||
GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const char* needle,
|
||||
const char* haystack);
|
||||
GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const wchar_t* needle,
|
||||
const wchar_t* haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const char* needle,
|
||||
const char* haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const wchar_t* needle,
|
||||
const wchar_t* haystack);
|
||||
GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const ::std::string& needle,
|
||||
const ::std::string& haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const ::std::string& needle,
|
||||
const ::std::string& haystack);
|
||||
|
||||
#if GTEST_HAS_STD_WSTRING
|
||||
GTEST_API_ AssertionResult IsSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const ::std::wstring& needle, const ::std::wstring& haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(
|
||||
const char* needle_expr, const char* haystack_expr,
|
||||
const ::std::wstring& needle, const ::std::wstring& haystack);
|
||||
GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const ::std::wstring& needle,
|
||||
const ::std::wstring& haystack);
|
||||
GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
||||
const char* haystack_expr,
|
||||
const ::std::wstring& needle,
|
||||
const ::std::wstring& haystack);
|
||||
#endif // GTEST_HAS_STD_WSTRING
|
||||
|
||||
namespace internal {
|
||||
|
@ -1732,8 +1545,7 @@ namespace internal {
|
|||
template <typename RawType>
|
||||
AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
||||
const char* rhs_expression,
|
||||
RawType lhs_value,
|
||||
RawType rhs_value) {
|
||||
RawType lhs_value, RawType rhs_value) {
|
||||
const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
|
||||
|
||||
if (lhs.AlmostEquals(rhs)) {
|
||||
|
@ -1748,10 +1560,8 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
|||
rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
||||
<< rhs_value;
|
||||
|
||||
return EqFailure(lhs_expression,
|
||||
rhs_expression,
|
||||
StringStreamToString(&lhs_ss),
|
||||
StringStreamToString(&rhs_ss),
|
||||
return EqFailure(lhs_expression, rhs_expression,
|
||||
StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss),
|
||||
false);
|
||||
}
|
||||
|
||||
|
@ -1761,8 +1571,7 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
|||
GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
|
||||
const char* expr2,
|
||||
const char* abs_error_expr,
|
||||
double val1,
|
||||
double val2,
|
||||
double val1, double val2,
|
||||
double abs_error);
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
|
@ -1770,9 +1579,7 @@ GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
|
|||
class GTEST_API_ AssertHelper {
|
||||
public:
|
||||
// Constructor.
|
||||
AssertHelper(TestPartResult::Type type,
|
||||
const char* file,
|
||||
int line,
|
||||
AssertHelper(TestPartResult::Type type, const char* file, int line,
|
||||
const char* message);
|
||||
~AssertHelper();
|
||||
|
||||
|
@ -1786,11 +1593,9 @@ class GTEST_API_ AssertHelper {
|
|||
// re-using stack space even for temporary variables, so every EXPECT_EQ
|
||||
// reserves stack space for another AssertHelper.
|
||||
struct AssertHelperData {
|
||||
AssertHelperData(TestPartResult::Type t,
|
||||
const char* srcfile,
|
||||
int line_num,
|
||||
AssertHelperData(TestPartResult::Type t, const char* srcfile, int line_num,
|
||||
const char* msg)
|
||||
: type(t), file(srcfile), line(line_num), message(msg) { }
|
||||
: type(t), file(srcfile), line(line_num), message(msg) {}
|
||||
|
||||
TestPartResult::Type const type;
|
||||
const char* const file;
|
||||
|
@ -1798,12 +1603,14 @@ class GTEST_API_ AssertHelper {
|
|||
std::string const message;
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
|
||||
AssertHelperData(const AssertHelperData&) = delete;
|
||||
AssertHelperData& operator=(const AssertHelperData&) = delete;
|
||||
};
|
||||
|
||||
AssertHelperData* const data_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
|
||||
AssertHelper(const AssertHelper&) = delete;
|
||||
AssertHelper& operator=(const AssertHelper&) = delete;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -1860,15 +1667,14 @@ class WithParamInterface {
|
|||
private:
|
||||
// Sets parameter value. The caller is responsible for making sure the value
|
||||
// remains alive and unchanged throughout the current test.
|
||||
static void SetParam(const ParamType* parameter) {
|
||||
parameter_ = parameter;
|
||||
}
|
||||
static void SetParam(const ParamType* parameter) { parameter_ = parameter; }
|
||||
|
||||
// Static value used for accessing parameter during a test lifetime.
|
||||
static const ParamType* parameter_;
|
||||
|
||||
// TestClass must be a subclass of WithParamInterface<T> and Test.
|
||||
template <class TestClass> friend class internal::ParameterizedTestFactory;
|
||||
template <class TestClass>
|
||||
friend class internal::ParameterizedTestFactory;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -1878,8 +1684,7 @@ const T* WithParamInterface<T>::parameter_ = nullptr;
|
|||
// WithParamInterface, and can just inherit from ::testing::TestWithParam.
|
||||
|
||||
template <typename T>
|
||||
class TestWithParam : public Test, public WithParamInterface<T> {
|
||||
};
|
||||
class TestWithParam : public Test, public WithParamInterface<T> {};
|
||||
|
||||
// Macros for indicating success/failure in test code.
|
||||
|
||||
|
@ -1910,7 +1715,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
|
||||
// Generates a nonfatal failure at the given source file location with
|
||||
// a generic message.
|
||||
#define ADD_FAILURE_AT(file, line) \
|
||||
#define ADD_FAILURE_AT(file, line) \
|
||||
GTEST_MESSAGE_AT_(file, line, "Failed", \
|
||||
::testing::TestPartResult::kNonFatalFailure)
|
||||
|
||||
|
@ -1925,7 +1730,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
// Define this macro to 1 to omit the definition of FAIL(), which is a
|
||||
// generic name and clashes with some other libraries.
|
||||
#if !GTEST_DONT_DEFINE_FAIL
|
||||
# define FAIL() GTEST_FAIL()
|
||||
#define FAIL() GTEST_FAIL()
|
||||
#endif
|
||||
|
||||
// Generates a success with a generic message.
|
||||
|
@ -1934,7 +1739,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
// Define this macro to 1 to omit the definition of SUCCEED(), which
|
||||
// is a generic name and clashes with some other libraries.
|
||||
#if !GTEST_DONT_DEFINE_SUCCEED
|
||||
# define SUCCEED() GTEST_SUCCEED()
|
||||
#define SUCCEED() GTEST_SUCCEED()
|
||||
#endif
|
||||
|
||||
// Macros for testing exceptions.
|
||||
|
@ -1962,16 +1767,15 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
// Boolean assertions. Condition can be either a Boolean expression or an
|
||||
// AssertionResult. For more information on how to use AssertionResult with
|
||||
// these macros see comments on that class.
|
||||
#define GTEST_EXPECT_TRUE(condition) \
|
||||
#define GTEST_EXPECT_TRUE(condition) \
|
||||
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
||||
GTEST_NONFATAL_FAILURE_)
|
||||
#define GTEST_EXPECT_FALSE(condition) \
|
||||
#define GTEST_EXPECT_FALSE(condition) \
|
||||
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
||||
GTEST_NONFATAL_FAILURE_)
|
||||
#define GTEST_ASSERT_TRUE(condition) \
|
||||
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
||||
GTEST_FATAL_FAILURE_)
|
||||
#define GTEST_ASSERT_FALSE(condition) \
|
||||
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, GTEST_FATAL_FAILURE_)
|
||||
#define GTEST_ASSERT_FALSE(condition) \
|
||||
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
||||
GTEST_FATAL_FAILURE_)
|
||||
|
||||
|
@ -2070,27 +1874,27 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
// ASSERT_XY(), which clashes with some users' own code.
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
||||
# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
||||
#define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
||||
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
||||
#define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
||||
# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
||||
#define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
||||
# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
||||
#define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
||||
# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
||||
#define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
||||
# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
||||
#define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
||||
#endif
|
||||
|
||||
// C-string Comparisons. All tests treat NULL and any non-NULL string
|
||||
|
@ -2115,7 +1919,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
||||
#define EXPECT_STRCASEEQ(s1, s2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
||||
#define EXPECT_STRCASENE(s1, s2)\
|
||||
#define EXPECT_STRCASENE(s1, s2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
||||
|
||||
#define ASSERT_STREQ(s1, s2) \
|
||||
|
@ -2124,7 +1928,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
||||
#define ASSERT_STRCASEEQ(s1, s2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
||||
#define ASSERT_STRCASENE(s1, s2)\
|
||||
#define ASSERT_STRCASENE(s1, s2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
||||
|
||||
// Macros for comparing floating-point numbers.
|
||||
|
@ -2141,29 +1945,29 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||
// FloatingPoint template class in gtest-internal.h if you are
|
||||
// interested in the implementation details.
|
||||
|
||||
#define EXPECT_FLOAT_EQ(val1, val2)\
|
||||
#define EXPECT_FLOAT_EQ(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
||||
val1, val2)
|
||||
|
||||
#define EXPECT_DOUBLE_EQ(val1, val2)\
|
||||
#define EXPECT_DOUBLE_EQ(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
||||
val1, val2)
|
||||
|
||||
#define ASSERT_FLOAT_EQ(val1, val2)\
|
||||
#define ASSERT_FLOAT_EQ(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
||||
val1, val2)
|
||||
|
||||
#define ASSERT_DOUBLE_EQ(val1, val2)\
|
||||
#define ASSERT_DOUBLE_EQ(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
||||
val1, val2)
|
||||
|
||||
#define EXPECT_NEAR(val1, val2, abs_error)\
|
||||
EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
|
||||
val1, val2, abs_error)
|
||||
#define EXPECT_NEAR(val1, val2, abs_error) \
|
||||
EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, val1, val2, \
|
||||
abs_error)
|
||||
|
||||
#define ASSERT_NEAR(val1, val2, abs_error)\
|
||||
ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
|
||||
val1, val2, abs_error)
|
||||
#define ASSERT_NEAR(val1, val2, abs_error) \
|
||||
ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, val1, val2, \
|
||||
abs_error)
|
||||
|
||||
// These predicate format functions work on floating-point values, and
|
||||
// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
|
||||
|
@ -2177,7 +1981,6 @@ GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
|
|||
GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
double val1, double val2);
|
||||
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Macros that test for HRESULT failure and success, these are only useful
|
||||
|
@ -2189,17 +1992,17 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||
// expected result and the actual result with both a human-readable
|
||||
// string representation of the error, if available, as well as the
|
||||
// hex result code.
|
||||
# define EXPECT_HRESULT_SUCCEEDED(expr) \
|
||||
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
||||
#define EXPECT_HRESULT_SUCCEEDED(expr) \
|
||||
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
||||
|
||||
# define ASSERT_HRESULT_SUCCEEDED(expr) \
|
||||
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
||||
#define ASSERT_HRESULT_SUCCEEDED(expr) \
|
||||
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
||||
|
||||
# define EXPECT_HRESULT_FAILED(expr) \
|
||||
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
||||
#define EXPECT_HRESULT_FAILED(expr) \
|
||||
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
||||
|
||||
# define ASSERT_HRESULT_FAILED(expr) \
|
||||
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
||||
#define ASSERT_HRESULT_FAILED(expr) \
|
||||
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
||||
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
|
@ -2214,9 +2017,9 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||
// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
|
||||
//
|
||||
#define ASSERT_NO_FATAL_FAILURE(statement) \
|
||||
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
|
||||
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
|
||||
#define EXPECT_NO_FATAL_FAILURE(statement) \
|
||||
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
|
||||
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
|
||||
|
||||
// Causes a trace (including the given source file path and line number,
|
||||
// and the given message) to be included in every test failure message generated
|
||||
|
@ -2258,7 +2061,8 @@ class GTEST_API_ ScopedTrace {
|
|||
private:
|
||||
void PushTrace(const char* file, int line, std::string message);
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
|
||||
ScopedTrace(const ScopedTrace&) = delete;
|
||||
ScopedTrace& operator=(const ScopedTrace&) = delete;
|
||||
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
|
||||
// c'tor and d'tor. Therefore it doesn't
|
||||
// need to be used otherwise.
|
||||
|
@ -2278,9 +2082,9 @@ class GTEST_API_ ScopedTrace {
|
|||
// Assuming that each thread maintains its own stack of traces.
|
||||
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
|
||||
// assertions in its own thread.
|
||||
#define SCOPED_TRACE(message) \
|
||||
::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
||||
__FILE__, __LINE__, (message))
|
||||
#define SCOPED_TRACE(message) \
|
||||
::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
|
||||
__FILE__, __LINE__, (message))
|
||||
|
||||
// Compile-time assertion for type equality.
|
||||
// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2
|
||||
|
@ -2378,20 +2182,19 @@ constexpr bool StaticAssertTypeEq() noexcept {
|
|||
// EXPECT_EQ(a_.size(), 0);
|
||||
// EXPECT_EQ(b_.size(), 1);
|
||||
// }
|
||||
//
|
||||
// GOOGLETEST_CM0011 DO NOT DELETE
|
||||
#if !GTEST_DONT_DEFINE_TEST
|
||||
#define TEST_F(test_fixture, test_name)\
|
||||
#define GTEST_TEST_F(test_fixture, test_name) \
|
||||
GTEST_TEST_(test_fixture, test_name, test_fixture, \
|
||||
::testing::internal::GetTypeId<test_fixture>())
|
||||
#endif // !GTEST_DONT_DEFINE_TEST
|
||||
#if !GTEST_DONT_DEFINE_TEST_F
|
||||
#define TEST_F(test_fixture, test_name) GTEST_TEST_F(test_fixture, test_name)
|
||||
#endif
|
||||
|
||||
// Returns a path to temporary directory.
|
||||
// Tries to determine an appropriate directory for the platform.
|
||||
GTEST_API_ std::string TempDir();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// Dynamically registers a test with the framework.
|
||||
|
@ -2445,6 +2248,7 @@ GTEST_API_ std::string TempDir();
|
|||
// }
|
||||
// ...
|
||||
// int main(int argc, char** argv) {
|
||||
// ::testing::InitGoogleTest(&argc, argv);
|
||||
// std::vector<int> values_to_test = LoadValuesFromConfig();
|
||||
// RegisterMyTests(values_to_test);
|
||||
// ...
|
||||
|
@ -2486,9 +2290,7 @@ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
|
|||
// namespace and has an all-caps name.
|
||||
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
|
||||
|
||||
inline int RUN_ALL_TESTS() {
|
||||
return ::testing::UnitTest::GetInstance()->Run();
|
||||
}
|
||||
inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); }
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||
|
||||
|
|
|
@ -26,17 +26,19 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
|
||||
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
|
||||
//
|
||||
// Implements a family of generic predicate assertion macros.
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "gtest/gtest-assertion-result.h"
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
namespace testing {
|
||||
|
||||
|
@ -72,22 +74,18 @@ namespace testing {
|
|||
// GTEST_ASSERT_ is the basic statement to which all of the assertions
|
||||
// in this file reduce. Don't use this in your code.
|
||||
|
||||
#define GTEST_ASSERT_(expression, on_failure) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
#define GTEST_ASSERT_(expression, on_failure) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const ::testing::AssertionResult gtest_ar = (expression)) \
|
||||
; \
|
||||
else \
|
||||
; \
|
||||
else \
|
||||
on_failure(gtest_ar.failure_message())
|
||||
|
||||
|
||||
// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
|
||||
// this in your code.
|
||||
template <typename Pred,
|
||||
typename T1>
|
||||
AssertionResult AssertPred1Helper(const char* pred_text,
|
||||
const char* e1,
|
||||
Pred pred,
|
||||
const T1& v1) {
|
||||
template <typename Pred, typename T1>
|
||||
AssertionResult AssertPred1Helper(const char* pred_text, const char* e1,
|
||||
Pred pred, const T1& v1) {
|
||||
if (pred(v1)) return AssertionSuccess();
|
||||
|
||||
return AssertionFailure()
|
||||
|
@ -98,40 +96,27 @@ AssertionResult AssertPred1Helper(const char* pred_text,
|
|||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
|
||||
// Don't use this in your code.
|
||||
#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
|
||||
GTEST_ASSERT_(pred_format(#v1, v1), \
|
||||
on_failure)
|
||||
#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure) \
|
||||
GTEST_ASSERT_(pred_format(#v1, v1), on_failure)
|
||||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
|
||||
// this in your code.
|
||||
#define GTEST_PRED1_(pred, v1, on_failure)\
|
||||
GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
|
||||
#v1, \
|
||||
pred, \
|
||||
v1), on_failure)
|
||||
#define GTEST_PRED1_(pred, v1, on_failure) \
|
||||
GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, #v1, pred, v1), on_failure)
|
||||
|
||||
// Unary predicate assertion macros.
|
||||
#define EXPECT_PRED_FORMAT1(pred_format, v1) \
|
||||
GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
|
||||
#define EXPECT_PRED1(pred, v1) \
|
||||
GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
|
||||
#define EXPECT_PRED1(pred, v1) GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
|
||||
#define ASSERT_PRED_FORMAT1(pred_format, v1) \
|
||||
GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
|
||||
#define ASSERT_PRED1(pred, v1) \
|
||||
GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
|
||||
|
||||
|
||||
#define ASSERT_PRED1(pred, v1) GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
|
||||
|
||||
// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
|
||||
// this in your code.
|
||||
template <typename Pred,
|
||||
typename T1,
|
||||
typename T2>
|
||||
AssertionResult AssertPred2Helper(const char* pred_text,
|
||||
const char* e1,
|
||||
const char* e2,
|
||||
Pred pred,
|
||||
const T1& v1,
|
||||
template <typename Pred, typename T1, typename T2>
|
||||
AssertionResult AssertPred2Helper(const char* pred_text, const char* e1,
|
||||
const char* e2, Pred pred, const T1& v1,
|
||||
const T2& v2) {
|
||||
if (pred(v1, v2)) return AssertionSuccess();
|
||||
|
||||
|
@ -145,19 +130,14 @@ AssertionResult AssertPred2Helper(const char* pred_text,
|
|||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
|
||||
// Don't use this in your code.
|
||||
#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
|
||||
on_failure)
|
||||
#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure) \
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
|
||||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
|
||||
// this in your code.
|
||||
#define GTEST_PRED2_(pred, v1, v2, on_failure)\
|
||||
GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
|
||||
#v1, \
|
||||
#v2, \
|
||||
pred, \
|
||||
v1, \
|
||||
v2), on_failure)
|
||||
#define GTEST_PRED2_(pred, v1, v2, on_failure) \
|
||||
GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, #v1, #v2, pred, v1, v2), \
|
||||
on_failure)
|
||||
|
||||
// Binary predicate assertion macros.
|
||||
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
|
||||
|
@ -169,22 +149,12 @@ AssertionResult AssertPred2Helper(const char* pred_text,
|
|||
#define ASSERT_PRED2(pred, v1, v2) \
|
||||
GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
|
||||
|
||||
|
||||
|
||||
// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
|
||||
// this in your code.
|
||||
template <typename Pred,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3>
|
||||
AssertionResult AssertPred3Helper(const char* pred_text,
|
||||
const char* e1,
|
||||
const char* e2,
|
||||
const char* e3,
|
||||
Pred pred,
|
||||
const T1& v1,
|
||||
const T2& v2,
|
||||
const T3& v3) {
|
||||
template <typename Pred, typename T1, typename T2, typename T3>
|
||||
AssertionResult AssertPred3Helper(const char* pred_text, const char* e1,
|
||||
const char* e2, const char* e3, Pred pred,
|
||||
const T1& v1, const T2& v2, const T3& v3) {
|
||||
if (pred(v1, v2, v3)) return AssertionSuccess();
|
||||
|
||||
return AssertionFailure()
|
||||
|
@ -198,21 +168,15 @@ AssertionResult AssertPred3Helper(const char* pred_text,
|
|||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
|
||||
// Don't use this in your code.
|
||||
#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
|
||||
on_failure)
|
||||
#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure) \
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), on_failure)
|
||||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
|
||||
// this in your code.
|
||||
#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
|
||||
GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
|
||||
#v1, \
|
||||
#v2, \
|
||||
#v3, \
|
||||
pred, \
|
||||
v1, \
|
||||
v2, \
|
||||
v3), on_failure)
|
||||
#define GTEST_PRED3_(pred, v1, v2, v3, on_failure) \
|
||||
GTEST_ASSERT_( \
|
||||
::testing::AssertPred3Helper(#pred, #v1, #v2, #v3, pred, v1, v2, v3), \
|
||||
on_failure)
|
||||
|
||||
// Ternary predicate assertion macros.
|
||||
#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
||||
|
@ -224,25 +188,13 @@ AssertionResult AssertPred3Helper(const char* pred_text,
|
|||
#define ASSERT_PRED3(pred, v1, v2, v3) \
|
||||
GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
|
||||
|
||||
|
||||
|
||||
// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
|
||||
// this in your code.
|
||||
template <typename Pred,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4>
|
||||
AssertionResult AssertPred4Helper(const char* pred_text,
|
||||
const char* e1,
|
||||
const char* e2,
|
||||
const char* e3,
|
||||
const char* e4,
|
||||
Pred pred,
|
||||
const T1& v1,
|
||||
const T2& v2,
|
||||
const T3& v3,
|
||||
const T4& v4) {
|
||||
template <typename Pred, typename T1, typename T2, typename T3, typename T4>
|
||||
AssertionResult AssertPred4Helper(const char* pred_text, const char* e1,
|
||||
const char* e2, const char* e3,
|
||||
const char* e4, Pred pred, const T1& v1,
|
||||
const T2& v2, const T3& v3, const T4& v4) {
|
||||
if (pred(v1, v2, v3, v4)) return AssertionSuccess();
|
||||
|
||||
return AssertionFailure()
|
||||
|
@ -257,23 +209,15 @@ AssertionResult AssertPred4Helper(const char* pred_text,
|
|||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
|
||||
// Don't use this in your code.
|
||||
#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
|
||||
on_failure)
|
||||
#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure) \
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), on_failure)
|
||||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
|
||||
// this in your code.
|
||||
#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
|
||||
GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
|
||||
#v1, \
|
||||
#v2, \
|
||||
#v3, \
|
||||
#v4, \
|
||||
pred, \
|
||||
v1, \
|
||||
v2, \
|
||||
v3, \
|
||||
v4), on_failure)
|
||||
#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure) \
|
||||
GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, #v1, #v2, #v3, #v4, pred, \
|
||||
v1, v2, v3, v4), \
|
||||
on_failure)
|
||||
|
||||
// 4-ary predicate assertion macros.
|
||||
#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
||||
|
@ -285,28 +229,15 @@ AssertionResult AssertPred4Helper(const char* pred_text,
|
|||
#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
|
||||
GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
|
||||
|
||||
|
||||
|
||||
// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
|
||||
// this in your code.
|
||||
template <typename Pred,
|
||||
typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4,
|
||||
template <typename Pred, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5>
|
||||
AssertionResult AssertPred5Helper(const char* pred_text,
|
||||
const char* e1,
|
||||
const char* e2,
|
||||
const char* e3,
|
||||
const char* e4,
|
||||
const char* e5,
|
||||
Pred pred,
|
||||
const T1& v1,
|
||||
const T2& v2,
|
||||
const T3& v3,
|
||||
const T4& v4,
|
||||
const T5& v5) {
|
||||
AssertionResult AssertPred5Helper(const char* pred_text, const char* e1,
|
||||
const char* e2, const char* e3,
|
||||
const char* e4, const char* e5, Pred pred,
|
||||
const T1& v1, const T2& v2, const T3& v3,
|
||||
const T4& v4, const T5& v5) {
|
||||
if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
|
||||
|
||||
return AssertionFailure()
|
||||
|
@ -322,25 +253,16 @@ AssertionResult AssertPred5Helper(const char* pred_text,
|
|||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
|
||||
// Don't use this in your code.
|
||||
#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
|
||||
#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure) \
|
||||
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
|
||||
on_failure)
|
||||
|
||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
|
||||
// this in your code.
|
||||
#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
|
||||
GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
|
||||
#v1, \
|
||||
#v2, \
|
||||
#v3, \
|
||||
#v4, \
|
||||
#v5, \
|
||||
pred, \
|
||||
v1, \
|
||||
v2, \
|
||||
v3, \
|
||||
v4, \
|
||||
v5), on_failure)
|
||||
#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure) \
|
||||
GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, #v1, #v2, #v3, #v4, #v5, \
|
||||
pred, v1, v2, v3, v4, v5), \
|
||||
on_failure)
|
||||
|
||||
// 5-ary predicate assertion macros.
|
||||
#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
||||
|
@ -352,8 +274,6 @@ AssertionResult AssertPred5Helper(const char* pred_text,
|
|||
#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
|
||||
GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
|
||||
|
||||
|
||||
|
||||
} // namespace testing
|
||||
|
||||
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// Google C++ Testing and Mocking Framework definitions useful in production code.
|
||||
// GOOGLETEST_CM0003 DO NOT DELETE
|
||||
// Google C++ Testing and Mocking Framework definitions useful in production
|
||||
// code.
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
|
||||
|
@ -55,7 +54,7 @@
|
|||
// Note: The test class must be in the same namespace as the class being tested.
|
||||
// For example, putting MyClassTest in an anonymous namespace will not work.
|
||||
|
||||
#define FRIEND_TEST(test_case_name, test_name)\
|
||||
friend class test_case_name##_##test_name##_Test
|
||||
#define FRIEND_TEST(test_case_name, test_name) \
|
||||
friend class test_case_name##_##test_name##_Test
|
||||
|
||||
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
|
||||
|
|
|
@ -15,18 +15,6 @@ The custom directory is an injection point for custom user configurations.
|
|||
|
||||
The following macros can be defined:
|
||||
|
||||
### Flag related macros:
|
||||
|
||||
* `GTEST_FLAG(flag_name)`
|
||||
* `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its
|
||||
own flagfile flag parsing.
|
||||
* `GTEST_DECLARE_bool_(name)`
|
||||
* `GTEST_DECLARE_int32_(name)`
|
||||
* `GTEST_DECLARE_string_(name)`
|
||||
* `GTEST_DEFINE_bool_(name, default_val, doc)`
|
||||
* `GTEST_DEFINE_int32_(name, default_val, doc)`
|
||||
* `GTEST_DEFINE_string_(name, default_val, doc)`
|
||||
|
||||
### Logging:
|
||||
|
||||
* `GTEST_LOG_(severity)`
|
||||
|
|
|
@ -34,4 +34,35 @@
|
|||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
|
||||
|
||||
// Use a stub Notification class.
|
||||
//
|
||||
// The built-in Notification class in GoogleTest v1.12.1 uses std::mutex and
|
||||
// std::condition_variable. The <mutex> and <condition_variable> headers of
|
||||
// mingw32 g++ (GNU 10.0.0) define std::mutex and std::condition_variable only
|
||||
// when configured with the posix threads option but don't define them when
|
||||
// configured with the win32 threads option. The Notification class is only
|
||||
// used in GoogleTest's internal tests. Since we don't build GoogleTest's
|
||||
// internal tests, we don't need a working Notification class. Although it's
|
||||
// not hard to fix the mingw32 g++ compilation errors by implementing the
|
||||
// Notification class using Windows CRITICAL_SECTION and CONDITION_VARIABLE,
|
||||
// it's simpler to just use a stub Notification class on all platforms.
|
||||
//
|
||||
// The default constructor of the stub class is deleted and the declaration of
|
||||
// the Notify() method is commented out, so that compilation will fail if any
|
||||
// code actually uses the Notification class.
|
||||
|
||||
#define GTEST_HAS_NOTIFICATION_ 1
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
class Notification {
|
||||
public:
|
||||
Notification() = delete;
|
||||
Notification(const Notification&) = delete;
|
||||
Notification& operator=(const Notification&) = delete;
|
||||
// void Notify();
|
||||
void WaitForNotification() {}
|
||||
};
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
|
||||
|
|
|
@ -26,27 +26,31 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file defines internal utilities needed for implementing
|
||||
// death tests. They are subject to change without notice.
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "gtest/gtest-matchers.h"
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <memory>
|
||||
GTEST_DECLARE_string_(internal_run_death_test);
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
GTEST_DECLARE_string_(internal_run_death_test);
|
||||
|
||||
// Names of the flags (needed for parsing Google Test flags).
|
||||
const char kDeathTestStyleFlag[] = "death_test_style";
|
||||
const char kDeathTestUseFork[] = "death_test_use_fork";
|
||||
|
@ -83,16 +87,18 @@ class GTEST_API_ DeathTest {
|
|||
static bool Create(const char* statement, Matcher<const std::string&> matcher,
|
||||
const char* file, int line, DeathTest** test);
|
||||
DeathTest();
|
||||
virtual ~DeathTest() { }
|
||||
virtual ~DeathTest() {}
|
||||
|
||||
// A helper class that aborts a death test when it's deleted.
|
||||
class ReturnSentinel {
|
||||
public:
|
||||
explicit ReturnSentinel(DeathTest* test) : test_(test) { }
|
||||
explicit ReturnSentinel(DeathTest* test) : test_(test) {}
|
||||
~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
|
||||
|
||||
private:
|
||||
DeathTest* const test_;
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
|
||||
ReturnSentinel(const ReturnSentinel&) = delete;
|
||||
ReturnSentinel& operator=(const ReturnSentinel&) = delete;
|
||||
} GTEST_ATTRIBUTE_UNUSED_;
|
||||
|
||||
// An enumeration of possible roles that may be taken when a death
|
||||
|
@ -137,7 +143,8 @@ class GTEST_API_ DeathTest {
|
|||
// A string containing a description of the outcome of the last death test.
|
||||
static std::string last_death_test_message_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
|
||||
DeathTest(const DeathTest&) = delete;
|
||||
DeathTest& operator=(const DeathTest&) = delete;
|
||||
};
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||
|
@ -145,7 +152,7 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|||
// Factory interface for death tests. May be mocked out for testing.
|
||||
class DeathTestFactory {
|
||||
public:
|
||||
virtual ~DeathTestFactory() { }
|
||||
virtual ~DeathTestFactory() {}
|
||||
virtual bool Create(const char* statement,
|
||||
Matcher<const std::string&> matcher, const char* file,
|
||||
int line, DeathTest** test) = 0;
|
||||
|
@ -186,28 +193,28 @@ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
|
|||
|
||||
// Traps C++ exceptions escaping statement and reports them as test
|
||||
// failures. Note that trapping SEH exceptions is not implemented here.
|
||||
# if GTEST_HAS_EXCEPTIONS
|
||||
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
||||
try { \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
} catch (const ::std::exception& gtest_exception) { \
|
||||
fprintf(\
|
||||
stderr, \
|
||||
"\n%s: Caught std::exception-derived exception escaping the " \
|
||||
"death test statement. Exception message: %s\n", \
|
||||
#if GTEST_HAS_EXCEPTIONS
|
||||
#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
||||
try { \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
} catch (const ::std::exception& gtest_exception) { \
|
||||
fprintf( \
|
||||
stderr, \
|
||||
"\n%s: Caught std::exception-derived exception escaping the " \
|
||||
"death test statement. Exception message: %s\n", \
|
||||
::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
|
||||
gtest_exception.what()); \
|
||||
fflush(stderr); \
|
||||
gtest_exception.what()); \
|
||||
fflush(stderr); \
|
||||
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
|
||||
} catch (...) { \
|
||||
} catch (...) { \
|
||||
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
|
||||
}
|
||||
|
||||
# else
|
||||
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
||||
#else
|
||||
#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
|
||||
// ASSERT_EXIT*, and EXPECT_EXIT*.
|
||||
|
@ -236,8 +243,6 @@ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
|
|||
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
||||
break; \
|
||||
} \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} else \
|
||||
|
@ -265,16 +270,12 @@ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
|
|||
// RUN_ALL_TESTS was called.
|
||||
class InternalRunDeathTestFlag {
|
||||
public:
|
||||
InternalRunDeathTestFlag(const std::string& a_file,
|
||||
int a_line,
|
||||
int an_index,
|
||||
InternalRunDeathTestFlag(const std::string& a_file, int a_line, int an_index,
|
||||
int a_write_fd)
|
||||
: file_(a_file), line_(a_line), index_(an_index),
|
||||
write_fd_(a_write_fd) {}
|
||||
: file_(a_file), line_(a_line), index_(an_index), write_fd_(a_write_fd) {}
|
||||
|
||||
~InternalRunDeathTestFlag() {
|
||||
if (write_fd_ >= 0)
|
||||
posix::Close(write_fd_);
|
||||
if (write_fd_ >= 0) posix::Close(write_fd_);
|
||||
}
|
||||
|
||||
const std::string& file() const { return file_; }
|
||||
|
@ -288,7 +289,8 @@ class InternalRunDeathTestFlag {
|
|||
int index_;
|
||||
int write_fd_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
|
||||
InternalRunDeathTestFlag(const InternalRunDeathTestFlag&) = delete;
|
||||
InternalRunDeathTestFlag& operator=(const InternalRunDeathTestFlag&) = delete;
|
||||
};
|
||||
|
||||
// Returns a newly created InternalRunDeathTestFlag object with fields
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// Google Test filepath utilities
|
||||
//
|
||||
// This header file declares classes and functions used internally by
|
||||
|
@ -35,7 +35,9 @@
|
|||
// This file is #included in gtest/internal/gtest-internal.h.
|
||||
// Do not include this header file separately!
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
||||
|
@ -61,8 +63,8 @@ namespace internal {
|
|||
|
||||
class GTEST_API_ FilePath {
|
||||
public:
|
||||
FilePath() : pathname_("") { }
|
||||
FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
|
||||
FilePath() : pathname_("") {}
|
||||
FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) {}
|
||||
|
||||
explicit FilePath(const std::string& pathname) : pathname_(pathname) {
|
||||
Normalize();
|
||||
|
@ -73,9 +75,7 @@ class GTEST_API_ FilePath {
|
|||
return *this;
|
||||
}
|
||||
|
||||
void Set(const FilePath& rhs) {
|
||||
pathname_ = rhs.pathname_;
|
||||
}
|
||||
void Set(const FilePath& rhs) { pathname_ = rhs.pathname_; }
|
||||
|
||||
const std::string& string() const { return pathname_; }
|
||||
const char* c_str() const { return pathname_.c_str(); }
|
||||
|
@ -88,8 +88,7 @@ class GTEST_API_ FilePath {
|
|||
// than zero (e.g., 12), returns "dir/test_12.xml".
|
||||
// On Windows platform, uses \ as the separator rather than /.
|
||||
static FilePath MakeFileName(const FilePath& directory,
|
||||
const FilePath& base_name,
|
||||
int number,
|
||||
const FilePath& base_name, int number,
|
||||
const char* extension);
|
||||
|
||||
// Given directory = "dir", relative_path = "test.xml",
|
||||
|
|
|
@ -26,13 +26,15 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file declares functions and macros used internally by
|
||||
// Google Test. They are subject to change without notice.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
||||
|
@ -40,19 +42,20 @@
|
|||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
#if GTEST_OS_LINUX
|
||||
# include <stdlib.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>
|
||||
# include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#endif // GTEST_OS_LINUX
|
||||
|
||||
#if GTEST_HAS_EXCEPTIONS
|
||||
# include <stdexcept>
|
||||
#include <stdexcept>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
|
@ -76,7 +79,7 @@
|
|||
// the current line number. For more details, see
|
||||
// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
|
||||
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
|
||||
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
|
||||
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo##bar
|
||||
|
||||
// Stringifies its argument.
|
||||
// Work around a bug in visual studio which doesn't accept code like this:
|
||||
|
@ -98,21 +101,21 @@ namespace testing {
|
|||
|
||||
// Forward declarations.
|
||||
|
||||
class AssertionResult; // Result of an assertion.
|
||||
class Message; // Represents a failure message.
|
||||
class Test; // Represents a test.
|
||||
class TestInfo; // Information about a test.
|
||||
class TestPartResult; // Result of a test part.
|
||||
class UnitTest; // A collection of test suites.
|
||||
class AssertionResult; // Result of an assertion.
|
||||
class Message; // Represents a failure message.
|
||||
class Test; // Represents a test.
|
||||
class TestInfo; // Information about a test.
|
||||
class TestPartResult; // Result of a test part.
|
||||
class UnitTest; // A collection of test suites.
|
||||
|
||||
template <typename T>
|
||||
::std::string PrintToString(const T& value);
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct TraceInfo; // Information about a trace point.
|
||||
class TestInfoImpl; // Opaque implementation of TestInfo
|
||||
class UnitTestImpl; // Opaque implementation of UnitTest
|
||||
struct TraceInfo; // Information about a trace point.
|
||||
class TestInfoImpl; // Opaque implementation of TestInfo
|
||||
class UnitTestImpl; // Opaque implementation of UnitTest
|
||||
|
||||
// The text used in failure messages to indicate the start of the
|
||||
// stack trace.
|
||||
|
@ -121,6 +124,7 @@ GTEST_API_ extern const char kStackTraceMarker[];
|
|||
// An IgnoredValue object can be implicitly constructed from ANY value.
|
||||
class IgnoredValue {
|
||||
struct Sink {};
|
||||
|
||||
public:
|
||||
// This constructor template allows any value to be implicitly
|
||||
// converted to IgnoredValue. The object has no data member and
|
||||
|
@ -136,13 +140,13 @@ class IgnoredValue {
|
|||
};
|
||||
|
||||
// Appends the user-supplied message to the Google-Test-generated message.
|
||||
GTEST_API_ std::string AppendUserMessage(
|
||||
const std::string& gtest_msg, const Message& user_msg);
|
||||
GTEST_API_ std::string AppendUserMessage(const std::string& gtest_msg,
|
||||
const Message& user_msg);
|
||||
|
||||
#if GTEST_HAS_EXCEPTIONS
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \
|
||||
/* an exported class was derived from a class that was not exported */)
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(
|
||||
4275 /* an exported class was derived from a class that was not exported */)
|
||||
|
||||
// This exception is thrown by (and only by) a failed Google Test
|
||||
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
|
||||
|
@ -181,14 +185,6 @@ GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
|
|||
|
||||
} // namespace edit_distance
|
||||
|
||||
// Calculate the diff between 'left' and 'right' and return it in unified diff
|
||||
// format.
|
||||
// If not null, stores in 'total_line_count' the total number of lines found
|
||||
// in left + right.
|
||||
GTEST_API_ std::string DiffStrings(const std::string& left,
|
||||
const std::string& right,
|
||||
size_t* total_line_count);
|
||||
|
||||
// Constructs and returns the message for an equality assertion
|
||||
// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
|
||||
//
|
||||
|
@ -212,10 +208,8 @@ GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
|
|||
|
||||
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
|
||||
GTEST_API_ std::string GetBoolAssertionFailureMessage(
|
||||
const AssertionResult& assertion_result,
|
||||
const char* expression_text,
|
||||
const char* actual_predicate_value,
|
||||
const char* expected_predicate_value);
|
||||
const AssertionResult& assertion_result, const char* expression_text,
|
||||
const char* actual_predicate_value, const char* expected_predicate_value);
|
||||
|
||||
// This template class represents an IEEE floating-point number
|
||||
// (either single-precision or double-precision, depending on the
|
||||
|
@ -256,11 +250,11 @@ class FloatingPoint {
|
|||
// Constants.
|
||||
|
||||
// # of bits in a number.
|
||||
static const size_t kBitCount = 8*sizeof(RawType);
|
||||
static const size_t kBitCount = 8 * sizeof(RawType);
|
||||
|
||||
// # of fraction bits in a number.
|
||||
static const size_t kFractionBitCount =
|
||||
std::numeric_limits<RawType>::digits - 1;
|
||||
std::numeric_limits<RawType>::digits - 1;
|
||||
|
||||
// # of exponent bits in a number.
|
||||
static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
|
||||
|
@ -269,8 +263,8 @@ class FloatingPoint {
|
|||
static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
|
||||
|
||||
// The mask for the fraction bits.
|
||||
static const Bits kFractionBitMask =
|
||||
~static_cast<Bits>(0) >> (kExponentBitCount + 1);
|
||||
static const Bits kFractionBitMask = ~static_cast<Bits>(0) >>
|
||||
(kExponentBitCount + 1);
|
||||
|
||||
// The mask for the exponent bits.
|
||||
static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
|
||||
|
@ -309,9 +303,7 @@ class FloatingPoint {
|
|||
}
|
||||
|
||||
// Returns the floating-point number that represent positive infinity.
|
||||
static RawType Infinity() {
|
||||
return ReinterpretBits(kExponentBitMask);
|
||||
}
|
||||
static RawType Infinity() { return ReinterpretBits(kExponentBitMask); }
|
||||
|
||||
// Returns the maximum representable finite floating-point number.
|
||||
static RawType Max();
|
||||
|
@ -319,7 +311,7 @@ class FloatingPoint {
|
|||
// Non-static methods
|
||||
|
||||
// Returns the bits that represents this number.
|
||||
const Bits &bits() const { return u_.bits_; }
|
||||
const Bits& bits() const { return u_.bits_; }
|
||||
|
||||
// Returns the exponent bits of this number.
|
||||
Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
|
||||
|
@ -348,8 +340,8 @@ class FloatingPoint {
|
|||
// a NAN must return false.
|
||||
if (is_nan() || rhs.is_nan()) return false;
|
||||
|
||||
return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
|
||||
<= kMaxUlps;
|
||||
return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) <=
|
||||
kMaxUlps;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -374,7 +366,7 @@ class FloatingPoint {
|
|||
//
|
||||
// Read http://en.wikipedia.org/wiki/Signed_number_representations
|
||||
// for more details on signed number representations.
|
||||
static Bits SignAndMagnitudeToBiased(const Bits &sam) {
|
||||
static Bits SignAndMagnitudeToBiased(const Bits& sam) {
|
||||
if (kSignBitMask & sam) {
|
||||
// sam represents a negative number.
|
||||
return ~sam + 1;
|
||||
|
@ -386,8 +378,8 @@ class FloatingPoint {
|
|||
|
||||
// Given two numbers in the sign-and-magnitude representation,
|
||||
// returns the distance between them as an unsigned number.
|
||||
static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
|
||||
const Bits &sam2) {
|
||||
static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits& sam1,
|
||||
const Bits& sam2) {
|
||||
const Bits biased1 = SignAndMagnitudeToBiased(sam1);
|
||||
const Bits biased2 = SignAndMagnitudeToBiased(sam2);
|
||||
return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
|
||||
|
@ -399,9 +391,13 @@ class FloatingPoint {
|
|||
// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
|
||||
// macro defined by <windows.h>.
|
||||
template <>
|
||||
inline float FloatingPoint<float>::Max() { return FLT_MAX; }
|
||||
inline float FloatingPoint<float>::Max() {
|
||||
return FLT_MAX;
|
||||
}
|
||||
template <>
|
||||
inline double FloatingPoint<double>::Max() { return DBL_MAX; }
|
||||
inline double FloatingPoint<double>::Max() {
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
// Typedefs the instances of the FloatingPoint template class that we
|
||||
// care to use.
|
||||
|
@ -461,7 +457,8 @@ class TestFactoryBase {
|
|||
TestFactoryBase() {}
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
|
||||
TestFactoryBase(const TestFactoryBase&) = delete;
|
||||
TestFactoryBase& operator=(const TestFactoryBase&) = delete;
|
||||
};
|
||||
|
||||
// This class provides implementation of TeastFactoryBase interface.
|
||||
|
@ -510,11 +507,11 @@ inline SetUpTearDownSuiteFuncType GetNotDefaultOrNull(
|
|||
|
||||
template <typename T>
|
||||
// Note that SuiteApiResolver inherits from T because
|
||||
// SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way
|
||||
// SetUpTestSuite()/TearDownTestSuite() could be protected. This way
|
||||
// SuiteApiResolver can access them.
|
||||
struct SuiteApiResolver : T {
|
||||
// testing::Test is only forward declared at this point. So we make it a
|
||||
// dependend class for the compiler to be OK with it.
|
||||
// dependent class for the compiler to be OK with it.
|
||||
using Test =
|
||||
typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
|
||||
|
||||
|
@ -654,7 +651,8 @@ inline const char* SkipComma(const char* str) {
|
|||
if (comma == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
while (IsSpace(*(++comma))) {}
|
||||
while (IsSpace(*(++comma))) {
|
||||
}
|
||||
return comma;
|
||||
}
|
||||
|
||||
|
@ -668,7 +666,7 @@ inline std::string GetPrefixUntilComma(const char* str) {
|
|||
// Splits a given string on a given delimiter, populating a given
|
||||
// vector with the fields.
|
||||
void SplitString(const ::std::string& str, char delimiter,
|
||||
::std::vector< ::std::string>* dest);
|
||||
::std::vector<::std::string>* dest);
|
||||
|
||||
// The default argument to the template below for the case when the user does
|
||||
// not provide a name generator.
|
||||
|
@ -781,13 +779,13 @@ class TypeParameterizedTestSuite {
|
|||
const std::vector<std::string>& type_names =
|
||||
GenerateNames<DefaultNameGenerator, Types>()) {
|
||||
RegisterTypeParameterizedTestSuiteInstantiation(case_name);
|
||||
std::string test_name = StripTrailingSpaces(
|
||||
GetPrefixUntilComma(test_names));
|
||||
std::string test_name =
|
||||
StripTrailingSpaces(GetPrefixUntilComma(test_names));
|
||||
if (!state->TestExists(test_name)) {
|
||||
fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
|
||||
case_name, test_name.c_str(),
|
||||
FormatFileLocation(code_location.file.c_str(),
|
||||
code_location.line).c_str());
|
||||
FormatFileLocation(code_location.file.c_str(), code_location.line)
|
||||
.c_str());
|
||||
fflush(stderr);
|
||||
posix::Abort();
|
||||
}
|
||||
|
@ -831,8 +829,8 @@ class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
|
|||
// For example, if Foo() calls Bar(), which in turn calls
|
||||
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
|
||||
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
|
||||
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
|
||||
UnitTest* unit_test, int skip_count);
|
||||
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
|
||||
int skip_count);
|
||||
|
||||
// Helpers for suppressing warnings on unreachable code or constant
|
||||
// condition.
|
||||
|
@ -881,7 +879,8 @@ class GTEST_API_ Random {
|
|||
|
||||
private:
|
||||
uint32_t state_;
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
|
||||
Random(const Random&) = delete;
|
||||
Random& operator=(const Random&) = delete;
|
||||
};
|
||||
|
||||
// Turns const U&, U&, const U, and U all into U.
|
||||
|
@ -954,7 +953,9 @@ IsContainer IsContainerTest(int /* dummy */) {
|
|||
|
||||
typedef char IsNotContainer;
|
||||
template <class C>
|
||||
IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
|
||||
IsNotContainer IsContainerTest(long /* dummy */) {
|
||||
return '\0';
|
||||
}
|
||||
|
||||
// Trait to detect whether a type T is a hash table.
|
||||
// The heuristic used is that the type contains an inner type `hasher` and does
|
||||
|
@ -1017,11 +1018,13 @@ bool ArrayEq(const T* lhs, size_t size, const U* rhs);
|
|||
|
||||
// This generic version is used when k is 0.
|
||||
template <typename T, typename U>
|
||||
inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
|
||||
inline bool ArrayEq(const T& lhs, const U& rhs) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
|
||||
// This overload is used when k >= 1.
|
||||
template <typename T, typename U, size_t N>
|
||||
inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
|
||||
inline bool ArrayEq(const T (&lhs)[N], const U (&rhs)[N]) {
|
||||
return internal::ArrayEq(lhs, N, rhs);
|
||||
}
|
||||
|
||||
|
@ -1031,8 +1034,7 @@ inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
|
|||
template <typename T, typename U>
|
||||
bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
|
||||
for (size_t i = 0; i != size; i++) {
|
||||
if (!internal::ArrayEq(lhs[i], rhs[i]))
|
||||
return false;
|
||||
if (!internal::ArrayEq(lhs[i], rhs[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1042,8 +1044,7 @@ bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
|
|||
template <typename Iter, typename Element>
|
||||
Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
|
||||
for (Iter it = begin; it != end; ++it) {
|
||||
if (internal::ArrayEq(*it, elem))
|
||||
return it;
|
||||
if (internal::ArrayEq(*it, elem)) return it;
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
@ -1057,11 +1058,13 @@ void CopyArray(const T* from, size_t size, U* to);
|
|||
|
||||
// This generic version is used when k is 0.
|
||||
template <typename T, typename U>
|
||||
inline void CopyArray(const T& from, U* to) { *to = from; }
|
||||
inline void CopyArray(const T& from, U* to) {
|
||||
*to = from;
|
||||
}
|
||||
|
||||
// This overload is used when k >= 1.
|
||||
template <typename T, typename U, size_t N>
|
||||
inline void CopyArray(const T(&from)[N], U(*to)[N]) {
|
||||
inline void CopyArray(const T (&from)[N], U (*to)[N]) {
|
||||
internal::CopyArray(from, N, *to);
|
||||
}
|
||||
|
||||
|
@ -1114,8 +1117,7 @@ class NativeArray {
|
|||
}
|
||||
|
||||
~NativeArray() {
|
||||
if (clone_ != &NativeArray::InitRef)
|
||||
delete[] array_;
|
||||
if (clone_ != &NativeArray::InitRef) delete[] array_;
|
||||
}
|
||||
|
||||
// STL-style container methods.
|
||||
|
@ -1123,8 +1125,7 @@ class NativeArray {
|
|||
const_iterator begin() const { return array_; }
|
||||
const_iterator end() const { return array_ + size_; }
|
||||
bool operator==(const NativeArray& rhs) const {
|
||||
return size() == rhs.size() &&
|
||||
ArrayEq(begin(), size(), rhs.begin());
|
||||
return size() == rhs.size() && ArrayEq(begin(), size(), rhs.begin());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -1335,9 +1336,9 @@ struct tuple_size<testing::internal::FlatTuple<Ts...>>
|
|||
#endif
|
||||
} // namespace std
|
||||
|
||||
#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
|
||||
::testing::internal::AssertHelper(result_type, file, line, message) \
|
||||
= ::testing::Message()
|
||||
#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
|
||||
::testing::internal::AssertHelper(result_type, file, line, message) = \
|
||||
::testing::Message()
|
||||
|
||||
#define GTEST_MESSAGE_(message, result_type) \
|
||||
GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
|
||||
|
@ -1458,103 +1459,112 @@ class NeverThrown {
|
|||
|
||||
#endif // GTEST_HAS_EXCEPTIONS
|
||||
|
||||
#define GTEST_TEST_NO_THROW_(statement, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::TrueWithString gtest_msg{}) { \
|
||||
try { \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
} \
|
||||
GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
|
||||
catch (...) { \
|
||||
gtest_msg.value = "it throws."; \
|
||||
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
|
||||
} \
|
||||
} else \
|
||||
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
|
||||
fail(("Expected: " #statement " doesn't throw an exception.\n" \
|
||||
" Actual: " + gtest_msg.value).c_str())
|
||||
#define GTEST_TEST_NO_THROW_(statement, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::TrueWithString gtest_msg{}) { \
|
||||
try { \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
} \
|
||||
GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
|
||||
catch (...) { \
|
||||
gtest_msg.value = "it throws."; \
|
||||
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
|
||||
} \
|
||||
} else \
|
||||
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__) \
|
||||
: fail(("Expected: " #statement " doesn't throw an exception.\n" \
|
||||
" Actual: " + \
|
||||
gtest_msg.value) \
|
||||
.c_str())
|
||||
|
||||
#define GTEST_TEST_ANY_THROW_(statement, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
bool gtest_caught_any = false; \
|
||||
try { \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
} \
|
||||
catch (...) { \
|
||||
gtest_caught_any = true; \
|
||||
} \
|
||||
if (!gtest_caught_any) { \
|
||||
#define GTEST_TEST_ANY_THROW_(statement, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
bool gtest_caught_any = false; \
|
||||
try { \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
} catch (...) { \
|
||||
gtest_caught_any = true; \
|
||||
} \
|
||||
if (!gtest_caught_any) { \
|
||||
goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
|
||||
} \
|
||||
} else \
|
||||
GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
|
||||
fail("Expected: " #statement " throws an exception.\n" \
|
||||
" Actual: it doesn't.")
|
||||
|
||||
} \
|
||||
} else \
|
||||
GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__) \
|
||||
: fail("Expected: " #statement \
|
||||
" throws an exception.\n" \
|
||||
" Actual: it doesn't.")
|
||||
|
||||
// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
|
||||
// either a boolean expression or an AssertionResult. text is a textual
|
||||
// representation of expression as it was passed into the EXPECT_TRUE.
|
||||
#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const ::testing::AssertionResult gtest_ar_ = \
|
||||
::testing::AssertionResult(expression)) \
|
||||
; \
|
||||
else \
|
||||
fail(::testing::internal::GetBoolAssertionFailureMessage(\
|
||||
gtest_ar_, text, #actual, #expected).c_str())
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const ::testing::AssertionResult gtest_ar_ = \
|
||||
::testing::AssertionResult(expression)) \
|
||||
; \
|
||||
else \
|
||||
fail(::testing::internal::GetBoolAssertionFailureMessage( \
|
||||
gtest_ar_, text, #actual, #expected) \
|
||||
.c_str())
|
||||
|
||||
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (::testing::internal::AlwaysTrue()) { \
|
||||
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
|
||||
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
|
||||
} \
|
||||
} else \
|
||||
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
|
||||
fail("Expected: " #statement " doesn't generate new fatal " \
|
||||
"failures in the current thread.\n" \
|
||||
" Actual: it does.")
|
||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
|
||||
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
|
||||
} \
|
||||
} else \
|
||||
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
|
||||
: fail("Expected: " #statement \
|
||||
" doesn't generate new fatal " \
|
||||
"failures in the current thread.\n" \
|
||||
" Actual: it does.")
|
||||
|
||||
// Expands to the name of the class that implements the given test.
|
||||
#define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||
test_suite_name##_##test_name##_Test
|
||||
|
||||
// Helper macro for defining tests.
|
||||
#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \
|
||||
"test_suite_name must not be empty"); \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \
|
||||
"test_name must not be empty"); \
|
||||
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||
: public parent_class { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \
|
||||
~GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() override = default; \
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name)); \
|
||||
GTEST_DISALLOW_MOVE_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name)); \
|
||||
\
|
||||
private: \
|
||||
void TestBody() override; \
|
||||
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
|
||||
}; \
|
||||
\
|
||||
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name)::test_info_ = \
|
||||
::testing::internal::MakeAndRegisterTestInfo( \
|
||||
#test_suite_name, #test_name, nullptr, nullptr, \
|
||||
::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
|
||||
::testing::internal::SuiteApiResolver< \
|
||||
parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \
|
||||
::testing::internal::SuiteApiResolver< \
|
||||
parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \
|
||||
new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
|
||||
test_suite_name, test_name)>); \
|
||||
#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \
|
||||
"test_suite_name must not be empty"); \
|
||||
static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \
|
||||
"test_name must not be empty"); \
|
||||
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||
: public parent_class { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \
|
||||
~GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() override = default; \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||
(const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
|
||||
const GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name) &) = delete; /* NOLINT */ \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||
(GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &&) noexcept = delete; \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
|
||||
GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name) &&) noexcept = delete; /* NOLINT */ \
|
||||
\
|
||||
private: \
|
||||
void TestBody() override; \
|
||||
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
|
||||
}; \
|
||||
\
|
||||
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||
test_name)::test_info_ = \
|
||||
::testing::internal::MakeAndRegisterTestInfo( \
|
||||
#test_suite_name, #test_name, nullptr, nullptr, \
|
||||
::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
|
||||
::testing::internal::SuiteApiResolver< \
|
||||
parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \
|
||||
::testing::internal::SuiteApiResolver< \
|
||||
parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \
|
||||
new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
|
||||
test_suite_name, test_name)>); \
|
||||
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
|
||||
|
||||
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// Type and function utilities for implementing parameterized tests.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
|
||||
|
@ -46,19 +47,18 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
#include "gtest/gtest-printers.h"
|
||||
#include "gtest/gtest-test-part.h"
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
namespace testing {
|
||||
// Input to a parameterized test name generator, describing a test parameter.
|
||||
// Consists of the parameter value and the integer parameter index.
|
||||
template <class ParamType>
|
||||
struct TestParamInfo {
|
||||
TestParamInfo(const ParamType& a_param, size_t an_index) :
|
||||
param(a_param),
|
||||
index(an_index) {}
|
||||
TestParamInfo(const ParamType& a_param, size_t an_index)
|
||||
: param(a_param), index(an_index) {}
|
||||
ParamType param;
|
||||
size_t index;
|
||||
};
|
||||
|
@ -84,8 +84,10 @@ namespace internal {
|
|||
GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name,
|
||||
CodeLocation code_location);
|
||||
|
||||
template <typename> class ParamGeneratorInterface;
|
||||
template <typename> class ParamGenerator;
|
||||
template <typename>
|
||||
class ParamGeneratorInterface;
|
||||
template <typename>
|
||||
class ParamGenerator;
|
||||
|
||||
// Interface for iterating over elements provided by an implementation
|
||||
// of ParamGeneratorInterface<T>.
|
||||
|
@ -129,8 +131,7 @@ class ParamIterator {
|
|||
// ParamIterator assumes ownership of the impl_ pointer.
|
||||
ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
|
||||
ParamIterator& operator=(const ParamIterator& other) {
|
||||
if (this != &other)
|
||||
impl_.reset(other.impl_->Clone());
|
||||
if (this != &other) impl_.reset(other.impl_->Clone());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -157,7 +158,7 @@ class ParamIterator {
|
|||
private:
|
||||
friend class ParamGenerator<T>;
|
||||
explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
|
||||
std::unique_ptr<ParamIteratorInterface<T> > impl_;
|
||||
std::unique_ptr<ParamIteratorInterface<T>> impl_;
|
||||
};
|
||||
|
||||
// ParamGeneratorInterface<T> is the binary interface to access generators
|
||||
|
@ -179,7 +180,7 @@ class ParamGeneratorInterface {
|
|||
// This class implements copy initialization semantics and the contained
|
||||
// ParamGeneratorInterface<T> instance is shared among all copies
|
||||
// of the original object. This is possible because that instance is immutable.
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
class ParamGenerator {
|
||||
public:
|
||||
typedef ParamIterator<T> iterator;
|
||||
|
@ -196,7 +197,7 @@ class ParamGenerator {
|
|||
iterator end() const { return iterator(impl_->End()); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<const ParamGeneratorInterface<T> > impl_;
|
||||
std::shared_ptr<const ParamGeneratorInterface<T>> impl_;
|
||||
};
|
||||
|
||||
// Generates values from a range of two comparable values. Can be used to
|
||||
|
@ -207,8 +208,10 @@ template <typename T, typename IncrementT>
|
|||
class RangeGenerator : public ParamGeneratorInterface<T> {
|
||||
public:
|
||||
RangeGenerator(T begin, T end, IncrementT step)
|
||||
: begin_(begin), end_(end),
|
||||
step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
|
||||
: begin_(begin),
|
||||
end_(end),
|
||||
step_(step),
|
||||
end_index_(CalculateEndIndex(begin, end, step)) {}
|
||||
~RangeGenerator() override {}
|
||||
|
||||
ParamIteratorInterface<T>* Begin() const override {
|
||||
|
@ -251,7 +254,9 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
|
|||
private:
|
||||
Iterator(const Iterator& other)
|
||||
: ParamIteratorInterface<T>(),
|
||||
base_(other.base_), value_(other.value_), index_(other.index_),
|
||||
base_(other.base_),
|
||||
value_(other.value_),
|
||||
index_(other.index_),
|
||||
step_(other.step_) {}
|
||||
|
||||
// No implementation - assignment is unsupported.
|
||||
|
@ -263,12 +268,10 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
|
|||
const IncrementT step_;
|
||||
}; // class RangeGenerator::Iterator
|
||||
|
||||
static int CalculateEndIndex(const T& begin,
|
||||
const T& end,
|
||||
static int CalculateEndIndex(const T& begin, const T& end,
|
||||
const IncrementT& step) {
|
||||
int end_index = 0;
|
||||
for (T i = begin; i < end; i = static_cast<T>(i + step))
|
||||
end_index++;
|
||||
for (T i = begin; i < end; i = static_cast<T>(i + step)) end_index++;
|
||||
return end_index;
|
||||
}
|
||||
|
||||
|
@ -283,7 +286,6 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
|
|||
const int end_index_;
|
||||
}; // class RangeGenerator
|
||||
|
||||
|
||||
// Generates values from a pair of STL-style iterators. Used in the
|
||||
// ValuesIn() function. The elements are copied from the source range
|
||||
// since the source can be located on the stack, and the generator
|
||||
|
@ -341,13 +343,13 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
|
|||
<< "The program attempted to compare iterators "
|
||||
<< "from different generators." << std::endl;
|
||||
return iterator_ ==
|
||||
CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
|
||||
CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator(const Iterator& other)
|
||||
// The explicit constructor call suppresses a false warning
|
||||
// emitted by gcc when supplied with the -Wextra option.
|
||||
// The explicit constructor call suppresses a false warning
|
||||
// emitted by gcc when supplied with the -Wextra option.
|
||||
: ParamIteratorInterface<T>(),
|
||||
base_(other.base_),
|
||||
iterator_(other.iterator_) {}
|
||||
|
@ -394,8 +396,8 @@ template <class TestClass>
|
|||
class ParameterizedTestFactory : public TestFactoryBase {
|
||||
public:
|
||||
typedef typename TestClass::ParamType ParamType;
|
||||
explicit ParameterizedTestFactory(ParamType parameter) :
|
||||
parameter_(parameter) {}
|
||||
explicit ParameterizedTestFactory(ParamType parameter)
|
||||
: parameter_(parameter) {}
|
||||
Test* CreateTest() override {
|
||||
TestClass::SetParam(¶meter_);
|
||||
return new TestClass();
|
||||
|
@ -404,7 +406,8 @@ class ParameterizedTestFactory : public TestFactoryBase {
|
|||
private:
|
||||
const ParamType parameter_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
|
||||
ParameterizedTestFactory(const ParameterizedTestFactory&) = delete;
|
||||
ParameterizedTestFactory& operator=(const ParameterizedTestFactory&) = delete;
|
||||
};
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
|
@ -440,7 +443,8 @@ class TestMetaFactory
|
|||
}
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
|
||||
TestMetaFactory(const TestMetaFactory&) = delete;
|
||||
TestMetaFactory& operator=(const TestMetaFactory&) = delete;
|
||||
};
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
|
@ -471,7 +475,10 @@ class ParameterizedTestSuiteInfoBase {
|
|||
ParameterizedTestSuiteInfoBase() {}
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase);
|
||||
ParameterizedTestSuiteInfoBase(const ParameterizedTestSuiteInfoBase&) =
|
||||
delete;
|
||||
ParameterizedTestSuiteInfoBase& operator=(
|
||||
const ParameterizedTestSuiteInfoBase&) = delete;
|
||||
};
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
|
@ -547,8 +554,8 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
|
|||
test_it != tests_.end(); ++test_it) {
|
||||
std::shared_ptr<TestInfo> test_info = *test_it;
|
||||
for (typename InstantiationContainer::iterator gen_it =
|
||||
instantiations_.begin(); gen_it != instantiations_.end();
|
||||
++gen_it) {
|
||||
instantiations_.begin();
|
||||
gen_it != instantiations_.end(); ++gen_it) {
|
||||
const std::string& instantiation_name = gen_it->name;
|
||||
ParamGenerator<ParamType> generator((*gen_it->generator)());
|
||||
ParamNameGeneratorFunc* name_func = gen_it->name_func;
|
||||
|
@ -556,7 +563,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
|
|||
int line = gen_it->line;
|
||||
|
||||
std::string test_suite_name;
|
||||
if ( !instantiation_name.empty() )
|
||||
if (!instantiation_name.empty())
|
||||
test_suite_name = instantiation_name + "/";
|
||||
test_suite_name += test_info->test_suite_base_name;
|
||||
|
||||
|
@ -569,17 +576,16 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
|
|||
|
||||
Message test_name_stream;
|
||||
|
||||
std::string param_name = name_func(
|
||||
TestParamInfo<ParamType>(*param_it, i));
|
||||
std::string param_name =
|
||||
name_func(TestParamInfo<ParamType>(*param_it, i));
|
||||
|
||||
GTEST_CHECK_(IsValidParamName(param_name))
|
||||
<< "Parameterized test name '" << param_name
|
||||
<< "' is invalid, in " << file
|
||||
<< " line " << line << std::endl;
|
||||
<< "' is invalid, in " << file << " line " << line << std::endl;
|
||||
|
||||
GTEST_CHECK_(test_param_names.count(param_name) == 0)
|
||||
<< "Duplicate parameterized test name '" << param_name
|
||||
<< "', in " << file << " line " << line << std::endl;
|
||||
<< "Duplicate parameterized test name '" << param_name << "', in "
|
||||
<< file << " line " << line << std::endl;
|
||||
|
||||
test_param_names.insert(param_name);
|
||||
|
||||
|
@ -596,15 +602,15 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
|
|||
SuiteApiResolver<TestSuite>::GetTearDownCaseOrSuite(file, line),
|
||||
test_info->test_meta_factory->CreateTestFactory(*param_it));
|
||||
} // for param_it
|
||||
} // for gen_it
|
||||
} // for test_it
|
||||
} // for gen_it
|
||||
} // for test_it
|
||||
|
||||
if (!generated_instantiations) {
|
||||
// There are no generaotrs, or they all generate nothing ...
|
||||
InsertSyntheticTestCase(GetTestSuiteName(), code_location_,
|
||||
!tests_.empty());
|
||||
}
|
||||
} // RegisterTests
|
||||
} // RegisterTests
|
||||
|
||||
private:
|
||||
// LocalTestInfo structure keeps information about a single test registered
|
||||
|
@ -620,42 +626,39 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
|
|||
|
||||
const std::string test_suite_base_name;
|
||||
const std::string test_base_name;
|
||||
const std::unique_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
|
||||
const std::unique_ptr<TestMetaFactoryBase<ParamType>> test_meta_factory;
|
||||
const CodeLocation code_location;
|
||||
};
|
||||
using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo> >;
|
||||
using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo>>;
|
||||
// Records data received from INSTANTIATE_TEST_SUITE_P macros:
|
||||
// <Instantiation name, Sequence generator creation function,
|
||||
// Name generator function, Source file, Source line>
|
||||
struct InstantiationInfo {
|
||||
InstantiationInfo(const std::string &name_in,
|
||||
GeneratorCreationFunc* generator_in,
|
||||
ParamNameGeneratorFunc* name_func_in,
|
||||
const char* file_in,
|
||||
int line_in)
|
||||
: name(name_in),
|
||||
generator(generator_in),
|
||||
name_func(name_func_in),
|
||||
file(file_in),
|
||||
line(line_in) {}
|
||||
InstantiationInfo(const std::string& name_in,
|
||||
GeneratorCreationFunc* generator_in,
|
||||
ParamNameGeneratorFunc* name_func_in, const char* file_in,
|
||||
int line_in)
|
||||
: name(name_in),
|
||||
generator(generator_in),
|
||||
name_func(name_func_in),
|
||||
file(file_in),
|
||||
line(line_in) {}
|
||||
|
||||
std::string name;
|
||||
GeneratorCreationFunc* generator;
|
||||
ParamNameGeneratorFunc* name_func;
|
||||
const char* file;
|
||||
int line;
|
||||
std::string name;
|
||||
GeneratorCreationFunc* generator;
|
||||
ParamNameGeneratorFunc* name_func;
|
||||
const char* file;
|
||||
int line;
|
||||
};
|
||||
typedef ::std::vector<InstantiationInfo> InstantiationContainer;
|
||||
|
||||
static bool IsValidParamName(const std::string& name) {
|
||||
// Check for empty string
|
||||
if (name.empty())
|
||||
return false;
|
||||
if (name.empty()) return false;
|
||||
|
||||
// Check for invalid characters
|
||||
for (std::string::size_type index = 0; index < name.size(); ++index) {
|
||||
if (!IsAlNum(name[index]) && name[index] != '_')
|
||||
return false;
|
||||
if (!IsAlNum(name[index]) && name[index] != '_') return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -666,7 +669,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
|
|||
TestInfoContainer tests_;
|
||||
InstantiationContainer instantiations_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo);
|
||||
ParameterizedTestSuiteInfo(const ParameterizedTestSuiteInfo&) = delete;
|
||||
ParameterizedTestSuiteInfo& operator=(const ParameterizedTestSuiteInfo&) =
|
||||
delete;
|
||||
}; // class ParameterizedTestSuiteInfo
|
||||
|
||||
// Legacy API is deprecated but still available
|
||||
|
@ -709,7 +714,7 @@ class ParameterizedTestSuiteRegistry {
|
|||
// type we are looking for, so we downcast it to that type
|
||||
// without further checks.
|
||||
typed_test_info = CheckedDowncastToActualType<
|
||||
ParameterizedTestSuiteInfo<TestSuite> >(test_suite_info);
|
||||
ParameterizedTestSuiteInfo<TestSuite>>(test_suite_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -741,7 +746,10 @@ class ParameterizedTestSuiteRegistry {
|
|||
|
||||
TestSuiteInfoContainer test_suite_infos_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteRegistry);
|
||||
ParameterizedTestSuiteRegistry(const ParameterizedTestSuiteRegistry&) =
|
||||
delete;
|
||||
ParameterizedTestSuiteRegistry& operator=(
|
||||
const ParameterizedTestSuiteRegistry&) = delete;
|
||||
};
|
||||
|
||||
// Keep track of what type-parameterized test suite are defined and
|
||||
|
@ -836,7 +844,8 @@ class CartesianProductGenerator
|
|||
: public ParamIteratorInterface<ParamType> {
|
||||
public:
|
||||
IteratorImpl(const ParamGeneratorInterface<ParamType>* base,
|
||||
const std::tuple<ParamGenerator<T>...>& generators, bool is_end)
|
||||
const std::tuple<ParamGenerator<T>...>& generators,
|
||||
bool is_end)
|
||||
: base_(base),
|
||||
begin_(std::get<I>(generators).begin()...),
|
||||
end_(std::get<I>(generators).end()...),
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file defines the GTEST_OS_* macro.
|
||||
|
@ -37,70 +37,72 @@
|
|||
|
||||
// Determines the platform on which Google Test is compiled.
|
||||
#ifdef __CYGWIN__
|
||||
# define GTEST_OS_CYGWIN 1
|
||||
# elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||
# define GTEST_OS_WINDOWS_MINGW 1
|
||||
# define GTEST_OS_WINDOWS 1
|
||||
#define GTEST_OS_CYGWIN 1
|
||||
#elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define GTEST_OS_WINDOWS_MINGW 1
|
||||
#define GTEST_OS_WINDOWS 1
|
||||
#elif defined _WIN32
|
||||
# define GTEST_OS_WINDOWS 1
|
||||
# ifdef _WIN32_WCE
|
||||
# define GTEST_OS_WINDOWS_MOBILE 1
|
||||
# elif defined(WINAPI_FAMILY)
|
||||
# include <winapifamily.h>
|
||||
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
# define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||
# define GTEST_OS_WINDOWS_PHONE 1
|
||||
# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
# define GTEST_OS_WINDOWS_RT 1
|
||||
# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
|
||||
# define GTEST_OS_WINDOWS_PHONE 1
|
||||
# define GTEST_OS_WINDOWS_TV_TITLE 1
|
||||
# else
|
||||
// WINAPI_FAMILY defined but no known partition matched.
|
||||
// Default to desktop.
|
||||
# define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
# endif
|
||||
# else
|
||||
# define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
# endif // _WIN32_WCE
|
||||
#define GTEST_OS_WINDOWS 1
|
||||
#ifdef _WIN32_WCE
|
||||
#define GTEST_OS_WINDOWS_MOBILE 1
|
||||
#elif defined(WINAPI_FAMILY)
|
||||
#include <winapifamily.h>
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
#define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||
#define GTEST_OS_WINDOWS_PHONE 1
|
||||
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
#define GTEST_OS_WINDOWS_RT 1
|
||||
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
|
||||
#define GTEST_OS_WINDOWS_PHONE 1
|
||||
#define GTEST_OS_WINDOWS_TV_TITLE 1
|
||||
#else
|
||||
// WINAPI_FAMILY defined but no known partition matched.
|
||||
// Default to desktop.
|
||||
#define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
#endif
|
||||
#else
|
||||
#define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
#endif // _WIN32_WCE
|
||||
#elif defined __OS2__
|
||||
# define GTEST_OS_OS2 1
|
||||
#define GTEST_OS_OS2 1
|
||||
#elif defined __APPLE__
|
||||
# define GTEST_OS_MAC 1
|
||||
# include <TargetConditionals.h>
|
||||
# if TARGET_OS_IPHONE
|
||||
# define GTEST_OS_IOS 1
|
||||
# endif
|
||||
#define GTEST_OS_MAC 1
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#define GTEST_OS_IOS 1
|
||||
#endif
|
||||
#elif defined __DragonFly__
|
||||
# define GTEST_OS_DRAGONFLY 1
|
||||
#define GTEST_OS_DRAGONFLY 1
|
||||
#elif defined __FreeBSD__
|
||||
# define GTEST_OS_FREEBSD 1
|
||||
#define GTEST_OS_FREEBSD 1
|
||||
#elif defined __Fuchsia__
|
||||
# define GTEST_OS_FUCHSIA 1
|
||||
#define GTEST_OS_FUCHSIA 1
|
||||
#elif defined(__GNU__)
|
||||
#define GTEST_OS_GNU_HURD 1
|
||||
#elif defined(__GLIBC__) && defined(__FreeBSD_kernel__)
|
||||
# define GTEST_OS_GNU_KFREEBSD 1
|
||||
#define GTEST_OS_GNU_KFREEBSD 1
|
||||
#elif defined __linux__
|
||||
# define GTEST_OS_LINUX 1
|
||||
# if defined __ANDROID__
|
||||
# define GTEST_OS_LINUX_ANDROID 1
|
||||
# endif
|
||||
#define GTEST_OS_LINUX 1
|
||||
#if defined __ANDROID__
|
||||
#define GTEST_OS_LINUX_ANDROID 1
|
||||
#endif
|
||||
#elif defined __MVS__
|
||||
# define GTEST_OS_ZOS 1
|
||||
#define GTEST_OS_ZOS 1
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
# define GTEST_OS_SOLARIS 1
|
||||
#define GTEST_OS_SOLARIS 1
|
||||
#elif defined(_AIX)
|
||||
# define GTEST_OS_AIX 1
|
||||
#define GTEST_OS_AIX 1
|
||||
#elif defined(__hpux)
|
||||
# define GTEST_OS_HPUX 1
|
||||
#define GTEST_OS_HPUX 1
|
||||
#elif defined __native_client__
|
||||
# define GTEST_OS_NACL 1
|
||||
#define GTEST_OS_NACL 1
|
||||
#elif defined __NetBSD__
|
||||
# define GTEST_OS_NETBSD 1
|
||||
#define GTEST_OS_NETBSD 1
|
||||
#elif defined __OpenBSD__
|
||||
# define GTEST_OS_OPENBSD 1
|
||||
#define GTEST_OS_OPENBSD 1
|
||||
#elif defined __QNX__
|
||||
# define GTEST_OS_QNX 1
|
||||
#define GTEST_OS_QNX 1
|
||||
#elif defined(__HAIKU__)
|
||||
#define GTEST_OS_HAIKU 1
|
||||
#elif defined ESP8266
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -26,7 +26,7 @@
|
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file declares the String class and functions used internally by
|
||||
|
@ -36,17 +36,20 @@
|
|||
// This header file is #included by gtest-internal.h.
|
||||
// It should not be #included by other files.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
// string.h is not guaranteed to provide strcpy on C++ Builder.
|
||||
# include <mem.h>
|
||||
#include <mem.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
@ -123,8 +126,7 @@ class GTEST_API_ String {
|
|||
// Unlike strcasecmp(), this function can handle NULL argument(s).
|
||||
// A NULL C string is considered different to any non-NULL C string,
|
||||
// including the empty string.
|
||||
static bool CaseInsensitiveCStringEquals(const char* lhs,
|
||||
const char* rhs);
|
||||
static bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs);
|
||||
|
||||
// Compares two wide C strings, ignoring case. Returns true if and only if
|
||||
// they have the same content.
|
||||
|
@ -143,8 +145,8 @@ class GTEST_API_ String {
|
|||
|
||||
// Returns true if and only if the given string ends with the given suffix,
|
||||
// ignoring case. Any string is considered to end with an empty suffix.
|
||||
static bool EndsWithCaseInsensitive(
|
||||
const std::string& str, const std::string& suffix);
|
||||
static bool EndsWithCaseInsensitive(const std::string& str,
|
||||
const std::string& suffix);
|
||||
|
||||
// Formats an int value as "%02d".
|
||||
static std::string FormatIntWidth2(int value); // "%02d" for width == 2
|
||||
|
@ -163,7 +165,7 @@ class GTEST_API_ String {
|
|||
|
||||
private:
|
||||
String(); // Not meant to be instantiated.
|
||||
}; // class String
|
||||
}; // class String
|
||||
|
||||
// Gets the content of the stringstream's buffer as an std::string. Each '\0'
|
||||
// character in the buffer is replaced with "\\0".
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
// Type utilities needed for implementing typed and type-parameterized
|
||||
// tests.
|
||||
|
||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||
// IWYU pragma: private, include "gtest/gtest.h"
|
||||
// IWYU pragma: friend gtest/.*
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
|
||||
|
@ -39,11 +41,11 @@
|
|||
|
||||
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
|
||||
// libstdc++ (which is where cxxabi.h comes from).
|
||||
# if GTEST_HAS_CXXABI_H_
|
||||
# include <cxxabi.h>
|
||||
# elif defined(__HP_aCC)
|
||||
# include <acxx_demangle.h>
|
||||
# endif // GTEST_HASH_CXXABI_H_
|
||||
#if GTEST_HAS_CXXABI_H_
|
||||
#include <cxxabi.h>
|
||||
#elif defined(__HP_aCC)
|
||||
#include <acxx_demangle.h>
|
||||
#endif // GTEST_HASH_CXXABI_H_
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
@ -101,7 +103,9 @@ std::string GetTypeName() {
|
|||
// A unique type indicating an empty node
|
||||
struct None {};
|
||||
|
||||
# define GTEST_TEMPLATE_ template <typename T> class
|
||||
#define GTEST_TEMPLATE_ \
|
||||
template <typename T> \
|
||||
class
|
||||
|
||||
// The template "selector" struct TemplateSel<Tmpl> is used to
|
||||
// represent Tmpl, which must be a class template with one type
|
||||
|
@ -119,8 +123,7 @@ struct TemplateSel {
|
|||
};
|
||||
};
|
||||
|
||||
# define GTEST_BIND_(TmplSel, T) \
|
||||
TmplSel::template Bind<T>::type
|
||||
#define GTEST_BIND_(TmplSel, T) TmplSel::template Bind<T>::type
|
||||
|
||||
template <GTEST_TEMPLATE_ Head_, GTEST_TEMPLATE_... Tail_>
|
||||
struct Templates {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "gtest/gtest.h"
|
||||
|
||||
// The following lines pull in the real gtest *.cc files.
|
||||
#include "src/gtest.cc"
|
||||
#include "src/gtest-assertion-result.cc"
|
||||
#include "src/gtest-death-test.cc"
|
||||
#include "src/gtest-filepath.cc"
|
||||
#include "src/gtest-matchers.cc"
|
||||
|
@ -46,3 +46,4 @@
|
|||
#include "src/gtest-printers.cc"
|
||||
#include "src/gtest-test-part.cc"
|
||||
#include "src/gtest-typed-test.cc"
|
||||
#include "src/gtest.cc"
|
||||
|
|
77
media/libvpx/libvpx/third_party/googletest/src/src/gtest-assertion-result.cc
поставляемый
Normal file
77
media/libvpx/libvpx/third_party/googletest/src/src/gtest-assertion-result.cc
поставляемый
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Copyright 2005, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This file defines the AssertionResult type.
|
||||
|
||||
#include "gtest/gtest-assertion-result.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "gtest/gtest-message.h"
|
||||
|
||||
namespace testing {
|
||||
|
||||
// AssertionResult constructors.
|
||||
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
||||
AssertionResult::AssertionResult(const AssertionResult& other)
|
||||
: success_(other.success_),
|
||||
message_(other.message_.get() != nullptr
|
||||
? new ::std::string(*other.message_)
|
||||
: static_cast< ::std::string*>(nullptr)) {}
|
||||
|
||||
// Swaps two AssertionResults.
|
||||
void AssertionResult::swap(AssertionResult& other) {
|
||||
using std::swap;
|
||||
swap(success_, other.success_);
|
||||
swap(message_, other.message_);
|
||||
}
|
||||
|
||||
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
||||
AssertionResult AssertionResult::operator!() const {
|
||||
AssertionResult negation(!success_);
|
||||
if (message_.get() != nullptr) negation << *message_;
|
||||
return negation;
|
||||
}
|
||||
|
||||
// Makes a successful assertion result.
|
||||
AssertionResult AssertionSuccess() { return AssertionResult(true); }
|
||||
|
||||
// Makes a failed assertion result.
|
||||
AssertionResult AssertionFailure() { return AssertionResult(false); }
|
||||
|
||||
// Makes a failed assertion result with the given failure message.
|
||||
// Deprecated; use AssertionFailure() << message.
|
||||
AssertionResult AssertionFailure(const Message& message) {
|
||||
return AssertionFailure() << message;
|
||||
}
|
||||
|
||||
} // namespace testing
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -30,29 +30,31 @@
|
|||
#include "gtest/internal/gtest-filepath.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
#include "gtest/gtest-message.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
# include <windows.h>
|
||||
#include <windows.h>
|
||||
#elif GTEST_OS_WINDOWS
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#else
|
||||
# include <limits.h>
|
||||
# include <climits> // Some Linux distributions define PATH_MAX here.
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
#include <limits.h>
|
||||
|
||||
#include <climits> // Some Linux distributions define PATH_MAX here.
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
#include "gtest/internal/gtest-string.h"
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
# define GTEST_PATH_MAX_ _MAX_PATH
|
||||
#define GTEST_PATH_MAX_ _MAX_PATH
|
||||
#elif defined(PATH_MAX)
|
||||
# define GTEST_PATH_MAX_ PATH_MAX
|
||||
#define GTEST_PATH_MAX_ PATH_MAX
|
||||
#elif defined(_XOPEN_PATH_MAX)
|
||||
# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
|
||||
#define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
|
||||
#else
|
||||
# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
|
||||
#define GTEST_PATH_MAX_ _POSIX_PATH_MAX
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
namespace testing {
|
||||
|
@ -66,16 +68,16 @@ namespace internal {
|
|||
const char kPathSeparator = '\\';
|
||||
const char kAlternatePathSeparator = '/';
|
||||
const char kAlternatePathSeparatorString[] = "/";
|
||||
# if GTEST_OS_WINDOWS_MOBILE
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
// Windows CE doesn't have a current directory. You should not use
|
||||
// the current directory in tests on Windows CE, but this at least
|
||||
// provides a reasonable fallback.
|
||||
const char kCurrentDirectoryString[] = "\\";
|
||||
// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
|
||||
const DWORD kInvalidFileAttributes = 0xffffffff;
|
||||
# else
|
||||
#else
|
||||
const char kCurrentDirectoryString[] = ".\\";
|
||||
# endif // GTEST_OS_WINDOWS_MOBILE
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
#else
|
||||
const char kPathSeparator = '/';
|
||||
const char kCurrentDirectoryString[] = "./";
|
||||
|
@ -99,17 +101,17 @@ FilePath FilePath::GetCurrentDir() {
|
|||
// something reasonable.
|
||||
return FilePath(kCurrentDirectoryString);
|
||||
#elif GTEST_OS_WINDOWS
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = {'\0'};
|
||||
return FilePath(_getcwd(cwd, sizeof(cwd)) == nullptr ? "" : cwd);
|
||||
#else
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = {'\0'};
|
||||
char* result = getcwd(cwd, sizeof(cwd));
|
||||
# if GTEST_OS_NACL
|
||||
#if GTEST_OS_NACL
|
||||
// getcwd will likely fail in NaCl due to the sandbox, so return something
|
||||
// reasonable. The user may have provided a shim implementation for getcwd,
|
||||
// however, so fallback only when failure is detected.
|
||||
return FilePath(result == nullptr ? kCurrentDirectoryString : cwd);
|
||||
# endif // GTEST_OS_NACL
|
||||
#endif // GTEST_OS_NACL
|
||||
return FilePath(result == nullptr ? "" : cwd);
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
}
|
||||
|
@ -121,8 +123,8 @@ FilePath FilePath::GetCurrentDir() {
|
|||
FilePath FilePath::RemoveExtension(const char* extension) const {
|
||||
const std::string dot_extension = std::string(".") + extension;
|
||||
if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
|
||||
return FilePath(pathname_.substr(
|
||||
0, pathname_.length() - dot_extension.length()));
|
||||
return FilePath(
|
||||
pathname_.substr(0, pathname_.length() - dot_extension.length()));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -178,15 +180,14 @@ FilePath FilePath::RemoveFileName() const {
|
|||
// than zero (e.g., 12), returns "dir/test_12.xml".
|
||||
// On Windows platform, uses \ as the separator rather than /.
|
||||
FilePath FilePath::MakeFileName(const FilePath& directory,
|
||||
const FilePath& base_name,
|
||||
int number,
|
||||
const FilePath& base_name, int number,
|
||||
const char* extension) {
|
||||
std::string file;
|
||||
if (number == 0) {
|
||||
file = base_name.string() + "." + extension;
|
||||
} else {
|
||||
file = base_name.string() + "_" + StreamableToString(number)
|
||||
+ "." + extension;
|
||||
file =
|
||||
base_name.string() + "_" + StreamableToString(number) + "." + extension;
|
||||
}
|
||||
return ConcatPaths(directory, FilePath(file));
|
||||
}
|
||||
|
@ -195,8 +196,7 @@ FilePath FilePath::MakeFileName(const FilePath& directory,
|
|||
// On Windows, uses \ as the separator rather than /.
|
||||
FilePath FilePath::ConcatPaths(const FilePath& directory,
|
||||
const FilePath& relative_path) {
|
||||
if (directory.IsEmpty())
|
||||
return relative_path;
|
||||
if (directory.IsEmpty()) return relative_path;
|
||||
const FilePath dir(directory.RemoveTrailingPathSeparator());
|
||||
return FilePath(dir.string() + kPathSeparator + relative_path.string());
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ bool FilePath::FileOrDirectoryExists() const {
|
|||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
|
||||
const DWORD attributes = GetFileAttributes(unicode);
|
||||
delete [] unicode;
|
||||
delete[] unicode;
|
||||
return attributes != kInvalidFileAttributes;
|
||||
#else
|
||||
posix::StatStruct file_stat{};
|
||||
|
@ -222,8 +222,8 @@ bool FilePath::DirectoryExists() const {
|
|||
#if GTEST_OS_WINDOWS
|
||||
// Don't strip off trailing separator if path is a root directory on
|
||||
// Windows (like "C:\\").
|
||||
const FilePath& path(IsRootDirectory() ? *this :
|
||||
RemoveTrailingPathSeparator());
|
||||
const FilePath& path(IsRootDirectory() ? *this
|
||||
: RemoveTrailingPathSeparator());
|
||||
#else
|
||||
const FilePath& path(*this);
|
||||
#endif
|
||||
|
@ -231,15 +231,15 @@ bool FilePath::DirectoryExists() const {
|
|||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
|
||||
const DWORD attributes = GetFileAttributes(unicode);
|
||||
delete [] unicode;
|
||||
delete[] unicode;
|
||||
if ((attributes != kInvalidFileAttributes) &&
|
||||
(attributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
result = true;
|
||||
}
|
||||
#else
|
||||
posix::StatStruct file_stat{};
|
||||
result = posix::Stat(path.c_str(), &file_stat) == 0 &&
|
||||
posix::IsDir(file_stat);
|
||||
result =
|
||||
posix::Stat(path.c_str(), &file_stat) == 0 && posix::IsDir(file_stat);
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
return result;
|
||||
|
@ -260,10 +260,9 @@ bool FilePath::IsAbsolutePath() const {
|
|||
const char* const name = pathname_.c_str();
|
||||
#if GTEST_OS_WINDOWS
|
||||
return pathname_.length() >= 3 &&
|
||||
((name[0] >= 'a' && name[0] <= 'z') ||
|
||||
(name[0] >= 'A' && name[0] <= 'Z')) &&
|
||||
name[1] == ':' &&
|
||||
IsPathSeparator(name[2]);
|
||||
((name[0] >= 'a' && name[0] <= 'z') ||
|
||||
(name[0] >= 'A' && name[0] <= 'Z')) &&
|
||||
name[1] == ':' && IsPathSeparator(name[2]);
|
||||
#else
|
||||
return IsPathSeparator(name[0]);
|
||||
#endif
|
||||
|
@ -321,7 +320,7 @@ bool FilePath::CreateFolder() const {
|
|||
FilePath removed_sep(this->RemoveTrailingPathSeparator());
|
||||
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
|
||||
int result = CreateDirectory(unicode, nullptr) ? 0 : -1;
|
||||
delete [] unicode;
|
||||
delete[] unicode;
|
||||
#elif GTEST_OS_WINDOWS
|
||||
int result = _mkdir(pathname_.c_str());
|
||||
#elif GTEST_OS_ESP8266 || GTEST_OS_XTENSA
|
||||
|
@ -341,9 +340,8 @@ bool FilePath::CreateFolder() const {
|
|||
// name, otherwise return the name string unmodified.
|
||||
// On Windows platform, uses \ as the separator, other platforms use /.
|
||||
FilePath FilePath::RemoveTrailingPathSeparator() const {
|
||||
return IsDirectory()
|
||||
? FilePath(pathname_.substr(0, pathname_.length() - 1))
|
||||
: *this;
|
||||
return IsDirectory() ? FilePath(pathname_.substr(0, pathname_.length() - 1))
|
||||
: *this;
|
||||
}
|
||||
|
||||
// Removes any redundant separators that might be in the pathname.
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#define GOOGLETEST_SRC_GTEST_INTERNAL_INL_H_
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
# include <errno.h>
|
||||
#include <errno.h>
|
||||
#endif // !_WIN32_WCE
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
|
||||
|
@ -50,22 +50,20 @@
|
|||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
#if GTEST_CAN_STREAM_RESULTS_
|
||||
# include <arpa/inet.h> // NOLINT
|
||||
# include <netdb.h> // NOLINT
|
||||
#include <arpa/inet.h> // NOLINT
|
||||
#include <netdb.h> // NOLINT
|
||||
#endif
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
# include <windows.h> // NOLINT
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
#include <windows.h> // NOLINT
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "gtest/gtest-spi.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||
|
||||
namespace testing {
|
||||
|
||||
// Declares the flags.
|
||||
//
|
||||
// We don't want the users to modify this flag in the code, but want
|
||||
|
@ -73,32 +71,13 @@ namespace testing {
|
|||
// declare it here as opposed to in gtest.h.
|
||||
GTEST_DECLARE_bool_(death_test_use_fork);
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
// The value of GetTestTypeId() as seen from within the Google Test
|
||||
// library. This is solely for testing GetTestTypeId().
|
||||
GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
|
||||
|
||||
// Names of the flags (needed for parsing Google Test flags).
|
||||
const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
|
||||
const char kBreakOnFailureFlag[] = "break_on_failure";
|
||||
const char kCatchExceptionsFlag[] = "catch_exceptions";
|
||||
const char kColorFlag[] = "color";
|
||||
const char kFailFast[] = "fail_fast";
|
||||
const char kFilterFlag[] = "filter";
|
||||
const char kListTestsFlag[] = "list_tests";
|
||||
const char kOutputFlag[] = "output";
|
||||
const char kBriefFlag[] = "brief";
|
||||
const char kPrintTimeFlag[] = "print_time";
|
||||
const char kPrintUTF8Flag[] = "print_utf8";
|
||||
const char kRandomSeedFlag[] = "random_seed";
|
||||
const char kRepeatFlag[] = "repeat";
|
||||
const char kShuffleFlag[] = "shuffle";
|
||||
const char kStackTraceDepthFlag[] = "stack_trace_depth";
|
||||
const char kStreamResultToFlag[] = "stream_result_to";
|
||||
const char kThrowOnFailureFlag[] = "throw_on_failure";
|
||||
const char kFlagfileFlag[] = "flagfile";
|
||||
|
||||
// A valid random seed must be in [1, kMaxRandomSeed].
|
||||
const int kMaxRandomSeed = 99999;
|
||||
|
||||
|
@ -125,21 +104,21 @@ GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
|
|||
//
|
||||
// On success, stores the value of the flag in *value, and returns
|
||||
// true. On failure, returns false without changing *value.
|
||||
GTEST_API_ bool ParseInt32Flag(
|
||||
const char* str, const char* flag, int32_t* value);
|
||||
GTEST_API_ bool ParseFlag(const char* str, const char* flag, int32_t* value);
|
||||
|
||||
// Returns a random seed in range [1, kMaxRandomSeed] based on the
|
||||
// given --gtest_random_seed flag value.
|
||||
inline int GetRandomSeedFromFlag(int32_t random_seed_flag) {
|
||||
const unsigned int raw_seed = (random_seed_flag == 0) ?
|
||||
static_cast<unsigned int>(GetTimeInMillis()) :
|
||||
static_cast<unsigned int>(random_seed_flag);
|
||||
const unsigned int raw_seed =
|
||||
(random_seed_flag == 0) ? static_cast<unsigned int>(GetTimeInMillis())
|
||||
: static_cast<unsigned int>(random_seed_flag);
|
||||
|
||||
// Normalizes the actual seed to range [1, kMaxRandomSeed] such that
|
||||
// it's easy to type.
|
||||
const int normalized_seed =
|
||||
static_cast<int>((raw_seed - 1U) %
|
||||
static_cast<unsigned int>(kMaxRandomSeed)) + 1;
|
||||
static_cast<unsigned int>(kMaxRandomSeed)) +
|
||||
1;
|
||||
return normalized_seed;
|
||||
}
|
||||
|
||||
|
@ -160,50 +139,54 @@ class GTestFlagSaver {
|
|||
public:
|
||||
// The c'tor.
|
||||
GTestFlagSaver() {
|
||||
also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
|
||||
break_on_failure_ = GTEST_FLAG(break_on_failure);
|
||||
catch_exceptions_ = GTEST_FLAG(catch_exceptions);
|
||||
color_ = GTEST_FLAG(color);
|
||||
death_test_style_ = GTEST_FLAG(death_test_style);
|
||||
death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
|
||||
fail_fast_ = GTEST_FLAG(fail_fast);
|
||||
filter_ = GTEST_FLAG(filter);
|
||||
internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
|
||||
list_tests_ = GTEST_FLAG(list_tests);
|
||||
output_ = GTEST_FLAG(output);
|
||||
brief_ = GTEST_FLAG(brief);
|
||||
print_time_ = GTEST_FLAG(print_time);
|
||||
print_utf8_ = GTEST_FLAG(print_utf8);
|
||||
random_seed_ = GTEST_FLAG(random_seed);
|
||||
repeat_ = GTEST_FLAG(repeat);
|
||||
shuffle_ = GTEST_FLAG(shuffle);
|
||||
stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
|
||||
stream_result_to_ = GTEST_FLAG(stream_result_to);
|
||||
throw_on_failure_ = GTEST_FLAG(throw_on_failure);
|
||||
also_run_disabled_tests_ = GTEST_FLAG_GET(also_run_disabled_tests);
|
||||
break_on_failure_ = GTEST_FLAG_GET(break_on_failure);
|
||||
catch_exceptions_ = GTEST_FLAG_GET(catch_exceptions);
|
||||
color_ = GTEST_FLAG_GET(color);
|
||||
death_test_style_ = GTEST_FLAG_GET(death_test_style);
|
||||
death_test_use_fork_ = GTEST_FLAG_GET(death_test_use_fork);
|
||||
fail_fast_ = GTEST_FLAG_GET(fail_fast);
|
||||
filter_ = GTEST_FLAG_GET(filter);
|
||||
internal_run_death_test_ = GTEST_FLAG_GET(internal_run_death_test);
|
||||
list_tests_ = GTEST_FLAG_GET(list_tests);
|
||||
output_ = GTEST_FLAG_GET(output);
|
||||
brief_ = GTEST_FLAG_GET(brief);
|
||||
print_time_ = GTEST_FLAG_GET(print_time);
|
||||
print_utf8_ = GTEST_FLAG_GET(print_utf8);
|
||||
random_seed_ = GTEST_FLAG_GET(random_seed);
|
||||
repeat_ = GTEST_FLAG_GET(repeat);
|
||||
recreate_environments_when_repeating_ =
|
||||
GTEST_FLAG_GET(recreate_environments_when_repeating);
|
||||
shuffle_ = GTEST_FLAG_GET(shuffle);
|
||||
stack_trace_depth_ = GTEST_FLAG_GET(stack_trace_depth);
|
||||
stream_result_to_ = GTEST_FLAG_GET(stream_result_to);
|
||||
throw_on_failure_ = GTEST_FLAG_GET(throw_on_failure);
|
||||
}
|
||||
|
||||
// The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
|
||||
~GTestFlagSaver() {
|
||||
GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
|
||||
GTEST_FLAG(break_on_failure) = break_on_failure_;
|
||||
GTEST_FLAG(catch_exceptions) = catch_exceptions_;
|
||||
GTEST_FLAG(color) = color_;
|
||||
GTEST_FLAG(death_test_style) = death_test_style_;
|
||||
GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
|
||||
GTEST_FLAG(filter) = filter_;
|
||||
GTEST_FLAG(fail_fast) = fail_fast_;
|
||||
GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
|
||||
GTEST_FLAG(list_tests) = list_tests_;
|
||||
GTEST_FLAG(output) = output_;
|
||||
GTEST_FLAG(brief) = brief_;
|
||||
GTEST_FLAG(print_time) = print_time_;
|
||||
GTEST_FLAG(print_utf8) = print_utf8_;
|
||||
GTEST_FLAG(random_seed) = random_seed_;
|
||||
GTEST_FLAG(repeat) = repeat_;
|
||||
GTEST_FLAG(shuffle) = shuffle_;
|
||||
GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
|
||||
GTEST_FLAG(stream_result_to) = stream_result_to_;
|
||||
GTEST_FLAG(throw_on_failure) = throw_on_failure_;
|
||||
GTEST_FLAG_SET(also_run_disabled_tests, also_run_disabled_tests_);
|
||||
GTEST_FLAG_SET(break_on_failure, break_on_failure_);
|
||||
GTEST_FLAG_SET(catch_exceptions, catch_exceptions_);
|
||||
GTEST_FLAG_SET(color, color_);
|
||||
GTEST_FLAG_SET(death_test_style, death_test_style_);
|
||||
GTEST_FLAG_SET(death_test_use_fork, death_test_use_fork_);
|
||||
GTEST_FLAG_SET(filter, filter_);
|
||||
GTEST_FLAG_SET(fail_fast, fail_fast_);
|
||||
GTEST_FLAG_SET(internal_run_death_test, internal_run_death_test_);
|
||||
GTEST_FLAG_SET(list_tests, list_tests_);
|
||||
GTEST_FLAG_SET(output, output_);
|
||||
GTEST_FLAG_SET(brief, brief_);
|
||||
GTEST_FLAG_SET(print_time, print_time_);
|
||||
GTEST_FLAG_SET(print_utf8, print_utf8_);
|
||||
GTEST_FLAG_SET(random_seed, random_seed_);
|
||||
GTEST_FLAG_SET(repeat, repeat_);
|
||||
GTEST_FLAG_SET(recreate_environments_when_repeating,
|
||||
recreate_environments_when_repeating_);
|
||||
GTEST_FLAG_SET(shuffle, shuffle_);
|
||||
GTEST_FLAG_SET(stack_trace_depth, stack_trace_depth_);
|
||||
GTEST_FLAG_SET(stream_result_to, stream_result_to_);
|
||||
GTEST_FLAG_SET(throw_on_failure, throw_on_failure_);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -224,6 +207,7 @@ class GTestFlagSaver {
|
|||
bool print_utf8_;
|
||||
int32_t random_seed_;
|
||||
int32_t repeat_;
|
||||
bool recreate_environments_when_repeating_;
|
||||
bool shuffle_;
|
||||
int32_t stack_trace_depth_;
|
||||
std::string stream_result_to_;
|
||||
|
@ -278,8 +262,8 @@ GTEST_API_ int32_t Int32FromEnvOrDie(const char* env_var, int32_t default_val);
|
|||
// returns true if and only if the test should be run on this shard. The test id
|
||||
// is some arbitrary but unique non-negative integer assigned to each test
|
||||
// method. Assumes that 0 <= shard_index < total_shards.
|
||||
GTEST_API_ bool ShouldRunTestOnShard(
|
||||
int total_shards, int shard_index, int test_id);
|
||||
GTEST_API_ bool ShouldRunTestOnShard(int total_shards, int shard_index,
|
||||
int test_id);
|
||||
|
||||
// STL container utilities.
|
||||
|
||||
|
@ -290,9 +274,8 @@ inline int CountIf(const Container& c, Predicate predicate) {
|
|||
// Implemented as an explicit loop since std::count_if() in libCstd on
|
||||
// Solaris has a non-standard signature.
|
||||
int count = 0;
|
||||
for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
|
||||
if (predicate(*it))
|
||||
++count;
|
||||
for (auto it = c.begin(); it != c.end(); ++it) {
|
||||
if (predicate(*it)) ++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
@ -441,7 +424,9 @@ class OsStackTraceGetterInterface {
|
|||
static const char* const kElidedFramesMarker;
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
|
||||
OsStackTraceGetterInterface(const OsStackTraceGetterInterface&) = delete;
|
||||
OsStackTraceGetterInterface& operator=(const OsStackTraceGetterInterface&) =
|
||||
delete;
|
||||
};
|
||||
|
||||
// A working implementation of the OsStackTraceGetterInterface interface.
|
||||
|
@ -463,7 +448,8 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
|
|||
void* caller_frame_ = nullptr;
|
||||
#endif // GTEST_HAS_ABSL
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
|
||||
OsStackTraceGetter(const OsStackTraceGetter&) = delete;
|
||||
OsStackTraceGetter& operator=(const OsStackTraceGetter&) = delete;
|
||||
};
|
||||
|
||||
// Information about a Google Test trace point.
|
||||
|
@ -476,7 +462,7 @@ struct TraceInfo {
|
|||
// This is the default global test part result reporter used in UnitTestImpl.
|
||||
// This class should only be used by UnitTestImpl.
|
||||
class DefaultGlobalTestPartResultReporter
|
||||
: public TestPartResultReporterInterface {
|
||||
: public TestPartResultReporterInterface {
|
||||
public:
|
||||
explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
|
||||
// Implements the TestPartResultReporterInterface. Reports the test part
|
||||
|
@ -486,7 +472,10 @@ class DefaultGlobalTestPartResultReporter
|
|||
private:
|
||||
UnitTestImpl* const unit_test_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
|
||||
DefaultGlobalTestPartResultReporter(
|
||||
const DefaultGlobalTestPartResultReporter&) = delete;
|
||||
DefaultGlobalTestPartResultReporter& operator=(
|
||||
const DefaultGlobalTestPartResultReporter&) = delete;
|
||||
};
|
||||
|
||||
// This is the default per thread test part result reporter used in
|
||||
|
@ -502,7 +491,10 @@ class DefaultPerThreadTestPartResultReporter
|
|||
private:
|
||||
UnitTestImpl* const unit_test_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
|
||||
DefaultPerThreadTestPartResultReporter(
|
||||
const DefaultPerThreadTestPartResultReporter&) = delete;
|
||||
DefaultPerThreadTestPartResultReporter& operator=(
|
||||
const DefaultPerThreadTestPartResultReporter&) = delete;
|
||||
};
|
||||
|
||||
// The private implementation of the UnitTest class. We don't protect
|
||||
|
@ -640,7 +632,8 @@ class GTEST_API_ UnitTestImpl {
|
|||
// For example, if Foo() calls Bar(), which in turn calls
|
||||
// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
|
||||
// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
|
||||
std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
|
||||
std::string CurrentOsStackTraceExceptTop(int skip_count)
|
||||
GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_;
|
||||
|
||||
// Finds and returns a TestSuite with the given name. If one doesn't
|
||||
// exist, creates one and returns it.
|
||||
|
@ -744,9 +737,7 @@ class GTEST_API_ UnitTestImpl {
|
|||
}
|
||||
|
||||
// Clears the results of ad-hoc test assertions.
|
||||
void ClearAdHocTestResult() {
|
||||
ad_hoc_test_result_.Clear();
|
||||
}
|
||||
void ClearAdHocTestResult() { ad_hoc_test_result_.Clear(); }
|
||||
|
||||
// Adds a TestProperty to the current TestResult object when invoked in a
|
||||
// context of a test or a test suite, or to the global property set. If the
|
||||
|
@ -754,10 +745,7 @@ class GTEST_API_ UnitTestImpl {
|
|||
// updated.
|
||||
void RecordProperty(const TestProperty& test_property);
|
||||
|
||||
enum ReactionToSharding {
|
||||
HONOR_SHARDING_PROTOCOL,
|
||||
IGNORE_SHARDING_PROTOCOL
|
||||
};
|
||||
enum ReactionToSharding { HONOR_SHARDING_PROTOCOL, IGNORE_SHARDING_PROTOCOL };
|
||||
|
||||
// Matches the full name of each test against the user-specified
|
||||
// filter to decide whether the test should run, then records the
|
||||
|
@ -963,7 +951,8 @@ class GTEST_API_ UnitTestImpl {
|
|||
// starts.
|
||||
bool catch_exceptions_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
|
||||
UnitTestImpl(const UnitTestImpl&) = delete;
|
||||
UnitTestImpl& operator=(const UnitTestImpl&) = delete;
|
||||
}; // class UnitTestImpl
|
||||
|
||||
// Convenience function for accessing the global UnitTest
|
||||
|
@ -986,8 +975,9 @@ GTEST_API_ bool IsValidEscape(char ch);
|
|||
GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
|
||||
GTEST_API_ bool ValidateRegex(const char* regex);
|
||||
GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
|
||||
GTEST_API_ bool MatchRepetitionAndRegexAtHead(
|
||||
bool escaped, char ch, char repeat, const char* regex, const char* str);
|
||||
GTEST_API_ bool MatchRepetitionAndRegexAtHead(bool escaped, char ch,
|
||||
char repeat, const char* regex,
|
||||
const char* str);
|
||||
GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
|
||||
|
||||
#endif // GTEST_USES_SIMPLE_RE
|
||||
|
@ -1089,8 +1079,7 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
}
|
||||
|
||||
~SocketWriter() override {
|
||||
if (sockfd_ != -1)
|
||||
CloseConnection();
|
||||
if (sockfd_ != -1) CloseConnection();
|
||||
}
|
||||
|
||||
// Sends a string to the socket.
|
||||
|
@ -1100,9 +1089,8 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
|
||||
const auto len = static_cast<size_t>(message.length());
|
||||
if (write(sockfd_, message.c_str(), len) != static_cast<ssize_t>(len)) {
|
||||
GTEST_LOG_(WARNING)
|
||||
<< "stream_result_to: failed to stream to "
|
||||
<< host_name_ << ":" << port_num_;
|
||||
GTEST_LOG_(WARNING) << "stream_result_to: failed to stream to "
|
||||
<< host_name_ << ":" << port_num_;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1111,8 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
const std::string host_name_;
|
||||
const std::string port_num_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
|
||||
SocketWriter(const SocketWriter&) = delete;
|
||||
SocketWriter& operator=(const SocketWriter&) = delete;
|
||||
}; // class SocketWriter
|
||||
|
||||
// Escapes '=', '&', '%', and '\n' characters in str as "%xx".
|
||||
|
@ -1135,7 +1124,9 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
}
|
||||
|
||||
explicit StreamingListener(AbstractSocketWriter* socket_writer)
|
||||
: socket_writer_(socket_writer) { Start(); }
|
||||
: socket_writer_(socket_writer) {
|
||||
Start();
|
||||
}
|
||||
|
||||
void OnTestProgramStart(const UnitTest& /* unit_test */) override {
|
||||
SendLn("event=TestProgramStart");
|
||||
|
@ -1158,22 +1149,22 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
|
||||
void OnTestIterationEnd(const UnitTest& unit_test,
|
||||
int /* iteration */) override {
|
||||
SendLn("event=TestIterationEnd&passed=" +
|
||||
FormatBool(unit_test.Passed()) + "&elapsed_time=" +
|
||||
StreamableToString(unit_test.elapsed_time()) + "ms");
|
||||
SendLn("event=TestIterationEnd&passed=" + FormatBool(unit_test.Passed()) +
|
||||
"&elapsed_time=" + StreamableToString(unit_test.elapsed_time()) +
|
||||
"ms");
|
||||
}
|
||||
|
||||
// Note that "event=TestCaseStart" is a wire format and has to remain
|
||||
// "case" for compatibility
|
||||
void OnTestCaseStart(const TestCase& test_case) override {
|
||||
SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
|
||||
void OnTestSuiteStart(const TestSuite& test_suite) override {
|
||||
SendLn(std::string("event=TestCaseStart&name=") + test_suite.name());
|
||||
}
|
||||
|
||||
// Note that "event=TestCaseEnd" is a wire format and has to remain
|
||||
// "case" for compatibility
|
||||
void OnTestCaseEnd(const TestCase& test_case) override {
|
||||
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) +
|
||||
"&elapsed_time=" + StreamableToString(test_case.elapsed_time()) +
|
||||
void OnTestSuiteEnd(const TestSuite& test_suite) override {
|
||||
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_suite.Passed()) +
|
||||
"&elapsed_time=" + StreamableToString(test_suite.elapsed_time()) +
|
||||
"ms");
|
||||
}
|
||||
|
||||
|
@ -1183,8 +1174,7 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
|
||||
void OnTestEnd(const TestInfo& test_info) override {
|
||||
SendLn("event=TestEnd&passed=" +
|
||||
FormatBool((test_info.result())->Passed()) +
|
||||
"&elapsed_time=" +
|
||||
FormatBool((test_info.result())->Passed()) + "&elapsed_time=" +
|
||||
StreamableToString((test_info.result())->elapsed_time()) + "ms");
|
||||
}
|
||||
|
||||
|
@ -1208,7 +1198,8 @@ class StreamingListener : public EmptyTestEventListener {
|
|||
|
||||
const std::unique_ptr<AbstractSocketWriter> socket_writer_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
|
||||
StreamingListener(const StreamingListener&) = delete;
|
||||
StreamingListener& operator=(const StreamingListener&) = delete;
|
||||
}; // class StreamingListener
|
||||
|
||||
#endif // GTEST_CAN_STREAM_RESULTS_
|
||||
|
|
|
@ -32,12 +32,13 @@
|
|||
// This file implements just enough of the matcher interface to allow
|
||||
// EXPECT_DEATH and friends to accept a matcher argument.
|
||||
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
#include "gtest/gtest-matchers.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
namespace testing {
|
||||
|
||||
// Constructs a matcher that matches a const std::string& whose value is
|
||||
|
|
|
@ -27,61 +27,62 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
# include <sys/stat.h>
|
||||
# include <map> // Used in ThreadLocal.
|
||||
# ifdef _MSC_VER
|
||||
# include <crtdbg.h>
|
||||
# endif // _MSC_VER
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <map> // Used in ThreadLocal.
|
||||
#ifdef _MSC_VER
|
||||
#include <crtdbg.h>
|
||||
#endif // _MSC_VER
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_OS_MAC
|
||||
# include <mach/mach_init.h>
|
||||
# include <mach/task.h>
|
||||
# include <mach/vm_map.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/vm_map.h>
|
||||
#endif // GTEST_OS_MAC
|
||||
|
||||
#if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \
|
||||
GTEST_OS_NETBSD || GTEST_OS_OPENBSD
|
||||
# include <sys/sysctl.h>
|
||||
# if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD
|
||||
# include <sys/user.h>
|
||||
# endif
|
||||
#include <sys/sysctl.h>
|
||||
#if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GTEST_OS_QNX
|
||||
# include <devctl.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/procfs.h>
|
||||
#include <devctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/procfs.h>
|
||||
#endif // GTEST_OS_QNX
|
||||
|
||||
#if GTEST_OS_AIX
|
||||
# include <procinfo.h>
|
||||
# include <sys/types.h>
|
||||
#include <procinfo.h>
|
||||
#include <sys/types.h>
|
||||
#endif // GTEST_OS_AIX
|
||||
|
||||
#if GTEST_OS_FUCHSIA
|
||||
# include <zircon/process.h>
|
||||
# include <zircon/syscalls.h>
|
||||
#include <zircon/process.h>
|
||||
#include <zircon/syscalls.h>
|
||||
#endif // GTEST_OS_FUCHSIA
|
||||
|
||||
#include "gtest/gtest-spi.h"
|
||||
#include "gtest/gtest-message.h"
|
||||
#include "gtest/gtest-spi.h"
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-string.h"
|
||||
#include "src/gtest-internal-inl.h"
|
||||
|
@ -89,16 +90,7 @@
|
|||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
||||
const int kStdOutFileno = 1;
|
||||
const int kStdErrFileno = 2;
|
||||
#else
|
||||
const int kStdOutFileno = STDOUT_FILENO;
|
||||
const int kStdErrFileno = STDERR_FILENO;
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if GTEST_OS_LINUX
|
||||
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
|
||||
|
||||
namespace {
|
||||
template <typename T>
|
||||
|
@ -131,8 +123,7 @@ size_t GetThreadCount() {
|
|||
if (status == KERN_SUCCESS) {
|
||||
// task_threads allocates resources in thread_list and we need to free them
|
||||
// to avoid leaks.
|
||||
vm_deallocate(task,
|
||||
reinterpret_cast<vm_address_t>(thread_list),
|
||||
vm_deallocate(task, reinterpret_cast<vm_address_t>(thread_list),
|
||||
sizeof(thread_t) * thread_count);
|
||||
return static_cast<size_t>(thread_count);
|
||||
} else {
|
||||
|
@ -141,7 +132,7 @@ size_t GetThreadCount() {
|
|||
}
|
||||
|
||||
#elif GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \
|
||||
GTEST_OS_NETBSD
|
||||
GTEST_OS_NETBSD
|
||||
|
||||
#if GTEST_OS_NETBSD
|
||||
#undef KERN_PROC
|
||||
|
@ -184,12 +175,12 @@ size_t GetThreadCount() {
|
|||
// we cannot detect it.
|
||||
size_t GetThreadCount() {
|
||||
int mib[] = {
|
||||
CTL_KERN,
|
||||
KERN_PROC,
|
||||
KERN_PROC_PID | KERN_PROC_SHOW_THREADS,
|
||||
getpid(),
|
||||
sizeof(struct kinfo_proc),
|
||||
0,
|
||||
CTL_KERN,
|
||||
KERN_PROC,
|
||||
KERN_PROC_PID | KERN_PROC_SHOW_THREADS,
|
||||
getpid(),
|
||||
sizeof(struct kinfo_proc),
|
||||
0,
|
||||
};
|
||||
u_int miblen = sizeof(mib) / sizeof(mib[0]);
|
||||
|
||||
|
@ -210,8 +201,7 @@ size_t GetThreadCount() {
|
|||
// exclude empty members
|
||||
size_t nthreads = 0;
|
||||
for (size_t i = 0; i < size / static_cast<size_t>(mib[4]); i++) {
|
||||
if (info[i].p_tid != -1)
|
||||
nthreads++;
|
||||
if (info[i].p_tid != -1) nthreads++;
|
||||
}
|
||||
return nthreads;
|
||||
}
|
||||
|
@ -254,13 +244,9 @@ size_t GetThreadCount() {
|
|||
size_t GetThreadCount() {
|
||||
int dummy_buffer;
|
||||
size_t avail;
|
||||
zx_status_t status = zx_object_get_info(
|
||||
zx_process_self(),
|
||||
ZX_INFO_PROCESS_THREADS,
|
||||
&dummy_buffer,
|
||||
0,
|
||||
nullptr,
|
||||
&avail);
|
||||
zx_status_t status =
|
||||
zx_object_get_info(zx_process_self(), ZX_INFO_PROCESS_THREADS,
|
||||
&dummy_buffer, 0, nullptr, &avail);
|
||||
if (status == ZX_OK) {
|
||||
return avail;
|
||||
} else {
|
||||
|
@ -280,27 +266,15 @@ size_t GetThreadCount() {
|
|||
|
||||
#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
|
||||
|
||||
void SleepMilliseconds(int n) {
|
||||
::Sleep(static_cast<DWORD>(n));
|
||||
}
|
||||
AutoHandle::AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
|
||||
|
||||
AutoHandle::AutoHandle()
|
||||
: handle_(INVALID_HANDLE_VALUE) {}
|
||||
AutoHandle::AutoHandle(Handle handle) : handle_(handle) {}
|
||||
|
||||
AutoHandle::AutoHandle(Handle handle)
|
||||
: handle_(handle) {}
|
||||
AutoHandle::~AutoHandle() { Reset(); }
|
||||
|
||||
AutoHandle::~AutoHandle() {
|
||||
Reset();
|
||||
}
|
||||
AutoHandle::Handle AutoHandle::Get() const { return handle_; }
|
||||
|
||||
AutoHandle::Handle AutoHandle::Get() const {
|
||||
return handle_;
|
||||
}
|
||||
|
||||
void AutoHandle::Reset() {
|
||||
Reset(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
void AutoHandle::Reset() { Reset(INVALID_HANDLE_VALUE); }
|
||||
|
||||
void AutoHandle::Reset(HANDLE handle) {
|
||||
// Resetting with the same handle we already own is invalid.
|
||||
|
@ -312,7 +286,7 @@ void AutoHandle::Reset(HANDLE handle) {
|
|||
} else {
|
||||
GTEST_CHECK_(!IsCloseable())
|
||||
<< "Resetting a valid handle to itself is likely a programmer error "
|
||||
"and thus not allowed.";
|
||||
"and thus not allowed.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,23 +296,6 @@ bool AutoHandle::IsCloseable() const {
|
|||
return handle_ != nullptr && handle_ != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
Notification::Notification()
|
||||
: event_(::CreateEvent(nullptr, // Default security attributes.
|
||||
TRUE, // Do not reset automatically.
|
||||
FALSE, // Initially unset.
|
||||
nullptr)) { // Anonymous event.
|
||||
GTEST_CHECK_(event_.Get() != nullptr);
|
||||
}
|
||||
|
||||
void Notification::Notify() {
|
||||
GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE);
|
||||
}
|
||||
|
||||
void Notification::WaitForNotification() {
|
||||
GTEST_CHECK_(
|
||||
::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0);
|
||||
}
|
||||
|
||||
Mutex::Mutex()
|
||||
: owner_thread_id_(0),
|
||||
type_(kDynamic),
|
||||
|
@ -391,25 +348,25 @@ namespace {
|
|||
// MemoryIsNotDeallocated memory_is_not_deallocated;
|
||||
// critical_section_ = new CRITICAL_SECTION;
|
||||
//
|
||||
class MemoryIsNotDeallocated
|
||||
{
|
||||
class MemoryIsNotDeallocated {
|
||||
public:
|
||||
MemoryIsNotDeallocated() : old_crtdbg_flag_(0) {
|
||||
old_crtdbg_flag_ = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
// Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT
|
||||
// doesn't report mem leak if there's no matching deallocation.
|
||||
_CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF);
|
||||
(void)_CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF);
|
||||
}
|
||||
|
||||
~MemoryIsNotDeallocated() {
|
||||
// Restore the original _CRTDBG_ALLOC_MEM_DF flag
|
||||
_CrtSetDbgFlag(old_crtdbg_flag_);
|
||||
(void)_CrtSetDbgFlag(old_crtdbg_flag_);
|
||||
}
|
||||
|
||||
private:
|
||||
int old_crtdbg_flag_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated);
|
||||
MemoryIsNotDeallocated(const MemoryIsNotDeallocated&) = delete;
|
||||
MemoryIsNotDeallocated& operator=(const MemoryIsNotDeallocated&) = delete;
|
||||
};
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
@ -435,15 +392,13 @@ void Mutex::ThreadSafeLazyInit() {
|
|||
::InitializeCriticalSection(critical_section_);
|
||||
// Updates the critical_section_init_phase_ to 2 to signal
|
||||
// initialization complete.
|
||||
GTEST_CHECK_(::InterlockedCompareExchange(
|
||||
&critical_section_init_phase_, 2L, 1L) ==
|
||||
1L);
|
||||
GTEST_CHECK_(::InterlockedCompareExchange(&critical_section_init_phase_,
|
||||
2L, 1L) == 1L);
|
||||
break;
|
||||
case 1:
|
||||
// Somebody else is already initializing the mutex; spin until they
|
||||
// are done.
|
||||
while (::InterlockedCompareExchange(&critical_section_init_phase_,
|
||||
2L,
|
||||
while (::InterlockedCompareExchange(&critical_section_init_phase_, 2L,
|
||||
2L) != 2L) {
|
||||
// Possibly yields the rest of the thread's time slice to other
|
||||
// threads.
|
||||
|
@ -488,9 +443,7 @@ class ThreadWithParamSupport : public ThreadWithParamBase {
|
|||
private:
|
||||
struct ThreadMainParam {
|
||||
ThreadMainParam(Runnable* runnable, Notification* thread_can_start)
|
||||
: runnable_(runnable),
|
||||
thread_can_start_(thread_can_start) {
|
||||
}
|
||||
: runnable_(runnable), thread_can_start_(thread_can_start) {}
|
||||
std::unique_ptr<Runnable> runnable_;
|
||||
// Does not own.
|
||||
Notification* thread_can_start_;
|
||||
|
@ -508,20 +461,18 @@ class ThreadWithParamSupport : public ThreadWithParamBase {
|
|||
// Prohibit instantiation.
|
||||
ThreadWithParamSupport();
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport);
|
||||
ThreadWithParamSupport(const ThreadWithParamSupport&) = delete;
|
||||
ThreadWithParamSupport& operator=(const ThreadWithParamSupport&) = delete;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
ThreadWithParamBase::ThreadWithParamBase(Runnable *runnable,
|
||||
ThreadWithParamBase::ThreadWithParamBase(Runnable* runnable,
|
||||
Notification* thread_can_start)
|
||||
: thread_(ThreadWithParamSupport::CreateThread(runnable,
|
||||
thread_can_start)) {
|
||||
}
|
||||
: thread_(
|
||||
ThreadWithParamSupport::CreateThread(runnable, thread_can_start)) {}
|
||||
|
||||
ThreadWithParamBase::~ThreadWithParamBase() {
|
||||
Join();
|
||||
}
|
||||
ThreadWithParamBase::~ThreadWithParamBase() { Join(); }
|
||||
|
||||
void ThreadWithParamBase::Join() {
|
||||
GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0)
|
||||
|
@ -548,8 +499,10 @@ class ThreadLocalRegistryImpl {
|
|||
ThreadIdToThreadLocals::iterator thread_local_pos =
|
||||
thread_to_thread_locals->find(current_thread);
|
||||
if (thread_local_pos == thread_to_thread_locals->end()) {
|
||||
thread_local_pos = thread_to_thread_locals->insert(
|
||||
std::make_pair(current_thread, ThreadLocalValues())).first;
|
||||
thread_local_pos =
|
||||
thread_to_thread_locals
|
||||
->insert(std::make_pair(current_thread, ThreadLocalValues()))
|
||||
.first;
|
||||
StartWatcherThreadFor(current_thread);
|
||||
}
|
||||
ThreadLocalValues& thread_local_values = thread_local_pos->second;
|
||||
|
@ -577,9 +530,8 @@ class ThreadLocalRegistryImpl {
|
|||
ThreadIdToThreadLocals* const thread_to_thread_locals =
|
||||
GetThreadLocalsMapLocked();
|
||||
for (ThreadIdToThreadLocals::iterator it =
|
||||
thread_to_thread_locals->begin();
|
||||
it != thread_to_thread_locals->end();
|
||||
++it) {
|
||||
thread_to_thread_locals->begin();
|
||||
it != thread_to_thread_locals->end(); ++it) {
|
||||
ThreadLocalValues& thread_local_values = it->second;
|
||||
ThreadLocalValues::iterator value_pos =
|
||||
thread_local_values.find(thread_local_instance);
|
||||
|
@ -609,9 +561,8 @@ class ThreadLocalRegistryImpl {
|
|||
if (thread_local_pos != thread_to_thread_locals->end()) {
|
||||
ThreadLocalValues& thread_local_values = thread_local_pos->second;
|
||||
for (ThreadLocalValues::iterator value_pos =
|
||||
thread_local_values.begin();
|
||||
value_pos != thread_local_values.end();
|
||||
++value_pos) {
|
||||
thread_local_values.begin();
|
||||
value_pos != thread_local_values.end(); ++value_pos) {
|
||||
value_holders.push_back(value_pos->second);
|
||||
}
|
||||
thread_to_thread_locals->erase(thread_local_pos);
|
||||
|
@ -637,9 +588,8 @@ class ThreadLocalRegistryImpl {
|
|||
static void StartWatcherThreadFor(DWORD thread_id) {
|
||||
// The returned handle will be kept in thread_map and closed by
|
||||
// watcher_thread in WatcherThreadFunc.
|
||||
HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION,
|
||||
FALSE,
|
||||
thread_id);
|
||||
HANDLE thread =
|
||||
::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION, FALSE, thread_id);
|
||||
GTEST_CHECK_(thread != nullptr);
|
||||
// We need to pass a valid thread ID pointer into CreateThread for it
|
||||
// to work correctly under Win98.
|
||||
|
@ -650,7 +600,8 @@ class ThreadLocalRegistryImpl {
|
|||
&ThreadLocalRegistryImpl::WatcherThreadFunc,
|
||||
reinterpret_cast<LPVOID>(new ThreadIdAndHandle(thread_id, thread)),
|
||||
CREATE_SUSPENDED, &watcher_thread_id);
|
||||
GTEST_CHECK_(watcher_thread != nullptr);
|
||||
GTEST_CHECK_(watcher_thread != nullptr)
|
||||
<< "CreateThread failed with error " << ::GetLastError() << ".";
|
||||
// Give the watcher thread the same priority as ours to avoid being
|
||||
// blocked by it.
|
||||
::SetThreadPriority(watcher_thread,
|
||||
|
@ -664,8 +615,7 @@ class ThreadLocalRegistryImpl {
|
|||
static DWORD WINAPI WatcherThreadFunc(LPVOID param) {
|
||||
const ThreadIdAndHandle* tah =
|
||||
reinterpret_cast<const ThreadIdAndHandle*>(param);
|
||||
GTEST_CHECK_(
|
||||
::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0);
|
||||
GTEST_CHECK_(::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0);
|
||||
OnThreadExit(tah->first);
|
||||
::CloseHandle(tah->second);
|
||||
delete tah;
|
||||
|
@ -689,16 +639,17 @@ class ThreadLocalRegistryImpl {
|
|||
};
|
||||
|
||||
Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex); // NOLINT
|
||||
Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex); // NOLINT
|
||||
Mutex ThreadLocalRegistryImpl::thread_map_mutex_(
|
||||
Mutex::kStaticMutex); // NOLINT
|
||||
|
||||
ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread(
|
||||
const ThreadLocalBase* thread_local_instance) {
|
||||
const ThreadLocalBase* thread_local_instance) {
|
||||
return ThreadLocalRegistryImpl::GetValueOnCurrentThread(
|
||||
thread_local_instance);
|
||||
}
|
||||
|
||||
void ThreadLocalRegistry::OnThreadLocalDestroyed(
|
||||
const ThreadLocalBase* thread_local_instance) {
|
||||
const ThreadLocalBase* thread_local_instance) {
|
||||
ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance);
|
||||
}
|
||||
|
||||
|
@ -786,7 +737,7 @@ bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
|
|||
bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
|
||||
bool IsAsciiWordChar(char ch) {
|
||||
return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
|
||||
('0' <= ch && ch <= '9') || ch == '_';
|
||||
('0' <= ch && ch <= '9') || ch == '_';
|
||||
}
|
||||
|
||||
// Returns true if and only if "\\c" is a supported escape sequence.
|
||||
|
@ -799,17 +750,28 @@ bool IsValidEscape(char c) {
|
|||
bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
|
||||
if (escaped) { // "\\p" where p is pattern_char.
|
||||
switch (pattern_char) {
|
||||
case 'd': return IsAsciiDigit(ch);
|
||||
case 'D': return !IsAsciiDigit(ch);
|
||||
case 'f': return ch == '\f';
|
||||
case 'n': return ch == '\n';
|
||||
case 'r': return ch == '\r';
|
||||
case 's': return IsAsciiWhiteSpace(ch);
|
||||
case 'S': return !IsAsciiWhiteSpace(ch);
|
||||
case 't': return ch == '\t';
|
||||
case 'v': return ch == '\v';
|
||||
case 'w': return IsAsciiWordChar(ch);
|
||||
case 'W': return !IsAsciiWordChar(ch);
|
||||
case 'd':
|
||||
return IsAsciiDigit(ch);
|
||||
case 'D':
|
||||
return !IsAsciiDigit(ch);
|
||||
case 'f':
|
||||
return ch == '\f';
|
||||
case 'n':
|
||||
return ch == '\n';
|
||||
case 'r':
|
||||
return ch == '\r';
|
||||
case 's':
|
||||
return IsAsciiWhiteSpace(ch);
|
||||
case 'S':
|
||||
return !IsAsciiWhiteSpace(ch);
|
||||
case 't':
|
||||
return ch == '\t';
|
||||
case 'v':
|
||||
return ch == '\v';
|
||||
case 'w':
|
||||
return IsAsciiWordChar(ch);
|
||||
case 'W':
|
||||
return !IsAsciiWordChar(ch);
|
||||
}
|
||||
return IsAsciiPunct(pattern_char) && pattern_char == ch;
|
||||
}
|
||||
|
@ -820,7 +782,8 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
|
|||
// Helper function used by ValidateRegex() to format error messages.
|
||||
static std::string FormatRegexSyntaxError(const char* regex, int index) {
|
||||
return (Message() << "Syntax error at index " << index
|
||||
<< " in simple regular expression \"" << regex << "\": ").GetString();
|
||||
<< " in simple regular expression \"" << regex << "\": ")
|
||||
.GetString();
|
||||
}
|
||||
|
||||
// Generates non-fatal failures and returns false if regex is invalid;
|
||||
|
@ -862,12 +825,12 @@ bool ValidateRegex(const char* regex) {
|
|||
<< "'$' can only appear at the end.";
|
||||
is_valid = false;
|
||||
} else if (IsInSet(ch, "()[]{}|")) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'" << ch << "' is unsupported.";
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i) << "'" << ch
|
||||
<< "' is unsupported.";
|
||||
is_valid = false;
|
||||
} else if (IsRepeat(ch) && !prev_repeatable) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'" << ch << "' can only follow a repeatable token.";
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i) << "'" << ch
|
||||
<< "' can only follow a repeatable token.";
|
||||
is_valid = false;
|
||||
}
|
||||
|
||||
|
@ -885,12 +848,10 @@ bool ValidateRegex(const char* regex) {
|
|||
// characters to be indexable by size_t, in which case the test will
|
||||
// probably time out anyway. We are fine with this limitation as
|
||||
// std::string has it too.
|
||||
bool MatchRepetitionAndRegexAtHead(
|
||||
bool escaped, char c, char repeat, const char* regex,
|
||||
const char* str) {
|
||||
bool MatchRepetitionAndRegexAtHead(bool escaped, char c, char repeat,
|
||||
const char* regex, const char* str) {
|
||||
const size_t min_count = (repeat == '+') ? 1 : 0;
|
||||
const size_t max_count = (repeat == '?') ? 1 :
|
||||
static_cast<size_t>(-1) - 1;
|
||||
const size_t max_count = (repeat == '?') ? 1 : static_cast<size_t>(-1) - 1;
|
||||
// We cannot call numeric_limits::max() as it conflicts with the
|
||||
// max() macro on Windows.
|
||||
|
||||
|
@ -903,8 +864,7 @@ bool MatchRepetitionAndRegexAtHead(
|
|||
// greedy match.
|
||||
return true;
|
||||
}
|
||||
if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
|
||||
return false;
|
||||
if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i])) return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -918,25 +878,23 @@ bool MatchRegexAtHead(const char* regex, const char* str) {
|
|||
|
||||
// "$" only matches the end of a string. Note that regex being
|
||||
// valid guarantees that there's nothing after "$" in it.
|
||||
if (*regex == '$')
|
||||
return *str == '\0';
|
||||
if (*regex == '$') return *str == '\0';
|
||||
|
||||
// Is the first thing in regex an escape sequence?
|
||||
const bool escaped = *regex == '\\';
|
||||
if (escaped)
|
||||
++regex;
|
||||
if (escaped) ++regex;
|
||||
if (IsRepeat(regex[1])) {
|
||||
// MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
|
||||
// here's an indirect recursion. It terminates as the regex gets
|
||||
// shorter in each recursion.
|
||||
return MatchRepetitionAndRegexAtHead(
|
||||
escaped, regex[0], regex[1], regex + 2, str);
|
||||
return MatchRepetitionAndRegexAtHead(escaped, regex[0], regex[1], regex + 2,
|
||||
str);
|
||||
} else {
|
||||
// regex isn't empty, isn't "$", and doesn't start with a
|
||||
// repetition. We match the first atom of regex with the first
|
||||
// character of str and recurse.
|
||||
return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
|
||||
MatchRegexAtHead(regex + 1, str + 1);
|
||||
MatchRegexAtHead(regex + 1, str + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -951,13 +909,11 @@ bool MatchRegexAtHead(const char* regex, const char* str) {
|
|||
bool MatchRegexAnywhere(const char* regex, const char* str) {
|
||||
if (regex == nullptr || str == nullptr) return false;
|
||||
|
||||
if (*regex == '^')
|
||||
return MatchRegexAtHead(regex + 1, str);
|
||||
if (*regex == '^') return MatchRegexAtHead(regex + 1, str);
|
||||
|
||||
// A successful match can be anywhere in str.
|
||||
do {
|
||||
if (MatchRegexAtHead(regex, str))
|
||||
return true;
|
||||
if (MatchRegexAtHead(regex, str)) return true;
|
||||
} while (*str++ != '\0');
|
||||
return false;
|
||||
}
|
||||
|
@ -1038,8 +994,8 @@ GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
|
|||
// FormatFileLocation in order to contrast the two functions.
|
||||
// Note that FormatCompilerIndependentFileLocation() does NOT append colon
|
||||
// to the file location it produces, unlike FormatFileLocation().
|
||||
GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
|
||||
const char* file, int line) {
|
||||
GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
|
||||
int line) {
|
||||
const std::string file_name(file == nullptr ? kUnknownFile : file);
|
||||
|
||||
if (line < 0)
|
||||
|
@ -1050,12 +1006,13 @@ GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
|
|||
|
||||
GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
|
||||
: severity_(severity) {
|
||||
const char* const marker =
|
||||
severity == GTEST_INFO ? "[ INFO ]" :
|
||||
severity == GTEST_WARNING ? "[WARNING]" :
|
||||
severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
|
||||
GetStream() << ::std::endl << marker << " "
|
||||
<< FormatFileLocation(file, line).c_str() << ": ";
|
||||
const char* const marker = severity == GTEST_INFO ? "[ INFO ]"
|
||||
: severity == GTEST_WARNING ? "[WARNING]"
|
||||
: severity == GTEST_ERROR ? "[ ERROR ]"
|
||||
: "[ FATAL ]";
|
||||
GetStream() << ::std::endl
|
||||
<< marker << " " << FormatFileLocation(file, line).c_str()
|
||||
<< ": ";
|
||||
}
|
||||
|
||||
// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
|
||||
|
@ -1078,27 +1035,26 @@ class CapturedStream {
|
|||
public:
|
||||
// The ctor redirects the stream to a temporary file.
|
||||
explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
|
||||
# if GTEST_OS_WINDOWS
|
||||
char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||
char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||
#if GTEST_OS_WINDOWS
|
||||
char temp_dir_path[MAX_PATH + 1] = {'\0'}; // NOLINT
|
||||
char temp_file_path[MAX_PATH + 1] = {'\0'}; // NOLINT
|
||||
|
||||
::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
|
||||
const UINT success = ::GetTempFileNameA(temp_dir_path,
|
||||
"gtest_redir",
|
||||
const UINT success = ::GetTempFileNameA(temp_dir_path, "gtest_redir",
|
||||
0, // Generate unique file name.
|
||||
temp_file_path);
|
||||
GTEST_CHECK_(success != 0)
|
||||
<< "Unable to create a temporary file in " << temp_dir_path;
|
||||
const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
|
||||
GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
|
||||
<< temp_file_path;
|
||||
GTEST_CHECK_(captured_fd != -1)
|
||||
<< "Unable to open temporary file " << temp_file_path;
|
||||
filename_ = temp_file_path;
|
||||
# else
|
||||
#else
|
||||
// There's no guarantee that a test has write access to the current
|
||||
// directory, so we create the temporary file in a temporary directory.
|
||||
std::string name_template;
|
||||
|
||||
# if GTEST_OS_LINUX_ANDROID
|
||||
#if GTEST_OS_LINUX_ANDROID
|
||||
// Note: Android applications are expected to call the framework's
|
||||
// Context.getExternalStorageDirectory() method through JNI to get
|
||||
// the location of the world-writable SD Card directory. However,
|
||||
|
@ -1111,7 +1067,7 @@ class CapturedStream {
|
|||
// '/sdcard' and other variants cannot be relied on, as they are not
|
||||
// guaranteed to be mounted, or may have a delay in mounting.
|
||||
name_template = "/data/local/tmp/";
|
||||
# elif GTEST_OS_IOS
|
||||
#elif GTEST_OS_IOS
|
||||
char user_temp_dir[PATH_MAX + 1];
|
||||
|
||||
// Documented alternative to NSTemporaryDirectory() (for obtaining creating
|
||||
|
@ -1132,9 +1088,9 @@ class CapturedStream {
|
|||
name_template = user_temp_dir;
|
||||
if (name_template.back() != GTEST_PATH_SEP_[0])
|
||||
name_template.push_back(GTEST_PATH_SEP_[0]);
|
||||
# else
|
||||
#else
|
||||
name_template = "/tmp/";
|
||||
# endif
|
||||
#endif
|
||||
name_template.append("gtest_captured_stream.XXXXXX");
|
||||
|
||||
// mkstemp() modifies the string bytes in place, and does not go beyond the
|
||||
|
@ -1150,15 +1106,13 @@ class CapturedStream {
|
|||
<< " for test; does the test have access to the /tmp directory?";
|
||||
}
|
||||
filename_ = std::move(name_template);
|
||||
# endif // GTEST_OS_WINDOWS
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
fflush(nullptr);
|
||||
dup2(captured_fd, fd_);
|
||||
close(captured_fd);
|
||||
}
|
||||
|
||||
~CapturedStream() {
|
||||
remove(filename_.c_str());
|
||||
}
|
||||
~CapturedStream() { remove(filename_.c_str()); }
|
||||
|
||||
std::string GetCapturedString() {
|
||||
if (uncaptured_fd_ != -1) {
|
||||
|
@ -1185,7 +1139,8 @@ class CapturedStream {
|
|||
// Name of the temporary file holding the stderr output.
|
||||
::std::string filename_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
|
||||
CapturedStream(const CapturedStream&) = delete;
|
||||
CapturedStream& operator=(const CapturedStream&) = delete;
|
||||
};
|
||||
|
||||
GTEST_DISABLE_MSC_DEPRECATED_POP_()
|
||||
|
@ -1213,6 +1168,15 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
|||
return content;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
||||
const int kStdOutFileno = 1;
|
||||
const int kStdErrFileno = 2;
|
||||
#else
|
||||
const int kStdOutFileno = STDOUT_FILENO;
|
||||
const int kStdErrFileno = STDERR_FILENO;
|
||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
|
||||
// Starts capturing stdout.
|
||||
void CaptureStdout() {
|
||||
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
|
||||
|
@ -1235,10 +1199,6 @@ std::string GetCapturedStderr() {
|
|||
|
||||
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
size_t GetFileSize(FILE* file) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
return static_cast<size_t>(ftell(file));
|
||||
|
@ -1256,7 +1216,8 @@ std::string ReadEntireFile(FILE* file) {
|
|||
// Keeps reading the file until we cannot read further or the
|
||||
// pre-determined file size is reached.
|
||||
do {
|
||||
bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
|
||||
bytes_last_read =
|
||||
fread(buffer + bytes_read, 1, file_size - bytes_read, file);
|
||||
bytes_read += bytes_last_read;
|
||||
} while (bytes_last_read > 0 && bytes_read < file_size);
|
||||
|
||||
|
@ -1344,7 +1305,7 @@ bool ParseInt32(const Message& src_text, const char* str, int32_t* value) {
|
|||
// LONG_MAX or LONG_MIN when the input overflows.)
|
||||
result != long_value
|
||||
// The parsed value overflows as an int32_t.
|
||||
) {
|
||||
) {
|
||||
Message msg;
|
||||
msg << "WARNING: " << src_text
|
||||
<< " is expected to be a 32-bit integer, but actually"
|
||||
|
@ -1388,8 +1349,8 @@ int32_t Int32FromGTestEnv(const char* flag, int32_t default_value) {
|
|||
}
|
||||
|
||||
int32_t result = default_value;
|
||||
if (!ParseInt32(Message() << "Environment variable " << env_var,
|
||||
string_value, &result)) {
|
||||
if (!ParseInt32(Message() << "Environment variable " << env_var, string_value,
|
||||
&result)) {
|
||||
printf("The default value %s is used.\n",
|
||||
(Message() << default_value).GetString().c_str());
|
||||
fflush(stdout);
|
||||
|
@ -1408,7 +1369,7 @@ int32_t Int32FromGTestEnv(const char* flag, int32_t default_value) {
|
|||
// not check that the flag is 'output'
|
||||
// In essence this checks an env variable called XML_OUTPUT_FILE
|
||||
// and if it is set we prepend "xml:" to its value, if it not set we return ""
|
||||
std::string OutputFlagAlsoCheckEnvVar(){
|
||||
std::string OutputFlagAlsoCheckEnvVar() {
|
||||
std::string default_value_for_output_flag = "";
|
||||
const char* xml_output_file_env = posix::GetEnv("XML_OUTPUT_FILE");
|
||||
if (nullptr != xml_output_file_env) {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// Google Test - The Google C++ Testing and Mocking Framework
|
||||
//
|
||||
// This file implements a universal value printer that can print a
|
||||
|
@ -101,7 +100,7 @@ void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
|
|||
PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
|
||||
*os << " ... ";
|
||||
// Rounds up to 2-byte boundary.
|
||||
const size_t resume_pos = (count - kChunkSize + 1)/2*2;
|
||||
const size_t resume_pos = (count - kChunkSize + 1) / 2 * 2;
|
||||
PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
|
||||
}
|
||||
*os << ">";
|
||||
|
@ -136,11 +135,7 @@ void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
|
|||
// - as is if it's a printable ASCII (e.g. 'a', '2', ' '),
|
||||
// - as a hexadecimal escape sequence (e.g. '\x7F'), or
|
||||
// - as a special escape sequence (e.g. '\r', '\n').
|
||||
enum CharFormat {
|
||||
kAsIs,
|
||||
kHexEscape,
|
||||
kSpecialEscape
|
||||
};
|
||||
enum CharFormat { kAsIs, kHexEscape, kSpecialEscape };
|
||||
|
||||
// Returns true if c is a printable ASCII character. We test the
|
||||
// value of c directly instead of calling isprint(), which is buggy on
|
||||
|
@ -213,35 +208,21 @@ static CharFormat PrintAsStringLiteralTo(char32_t c, ostream* os) {
|
|||
}
|
||||
}
|
||||
|
||||
static const char* GetCharWidthPrefix(char) {
|
||||
return "";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(char) { return ""; }
|
||||
|
||||
static const char* GetCharWidthPrefix(signed char) {
|
||||
return "";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(signed char) { return ""; }
|
||||
|
||||
static const char* GetCharWidthPrefix(unsigned char) {
|
||||
return "";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(unsigned char) { return ""; }
|
||||
|
||||
#ifdef __cpp_char8_t
|
||||
static const char* GetCharWidthPrefix(char8_t) {
|
||||
return "u8";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(char8_t) { return "u8"; }
|
||||
#endif
|
||||
|
||||
static const char* GetCharWidthPrefix(char16_t) {
|
||||
return "u";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(char16_t) { return "u"; }
|
||||
|
||||
static const char* GetCharWidthPrefix(char32_t) {
|
||||
return "U";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(char32_t) { return "U"; }
|
||||
|
||||
static const char* GetCharWidthPrefix(wchar_t) {
|
||||
return "L";
|
||||
}
|
||||
static const char* GetCharWidthPrefix(wchar_t) { return "L"; }
|
||||
|
||||
// Prints a char c as if it's part of a string literal, escaping it when
|
||||
// necessary; returns how c was formatted.
|
||||
|
@ -276,8 +257,7 @@ void PrintCharAndCodeTo(Char c, ostream* os) {
|
|||
// To aid user debugging, we also print c's code in decimal, unless
|
||||
// it's 0 (in which case c was printed as '\\0', making the code
|
||||
// obvious).
|
||||
if (c == 0)
|
||||
return;
|
||||
if (c == 0) return;
|
||||
*os << " (" << static_cast<int>(c);
|
||||
|
||||
// For more convenience, we print c's code again in hexadecimal,
|
||||
|
@ -304,17 +284,60 @@ void PrintTo(char32_t c, ::std::ostream* os) {
|
|||
<< static_cast<uint32_t>(c);
|
||||
}
|
||||
|
||||
// gcc/clang __{u,}int128_t
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
void PrintTo(__uint128_t v, ::std::ostream* os) {
|
||||
if (v == 0) {
|
||||
*os << "0";
|
||||
return;
|
||||
}
|
||||
|
||||
// Buffer large enough for ceil(log10(2^128))==39 and the null terminator
|
||||
char buf[40];
|
||||
char* p = buf + sizeof(buf);
|
||||
|
||||
// Some configurations have a __uint128_t, but no support for built in
|
||||
// division. Do manual long division instead.
|
||||
|
||||
uint64_t high = static_cast<uint64_t>(v >> 64);
|
||||
uint64_t low = static_cast<uint64_t>(v);
|
||||
|
||||
*--p = 0;
|
||||
while (high != 0 || low != 0) {
|
||||
uint64_t high_mod = high % 10;
|
||||
high = high / 10;
|
||||
// This is the long division algorithm specialized for a divisor of 10 and
|
||||
// only two elements.
|
||||
// Notable values:
|
||||
// 2^64 / 10 == 1844674407370955161
|
||||
// 2^64 % 10 == 6
|
||||
const uint64_t carry = 6 * high_mod + low % 10;
|
||||
low = low / 10 + high_mod * 1844674407370955161 + carry / 10;
|
||||
|
||||
char digit = static_cast<char>(carry % 10);
|
||||
*--p = '0' + digit;
|
||||
}
|
||||
*os << p;
|
||||
}
|
||||
void PrintTo(__int128_t v, ::std::ostream* os) {
|
||||
__uint128_t uv = static_cast<__uint128_t>(v);
|
||||
if (v < 0) {
|
||||
*os << "-";
|
||||
uv = -uv;
|
||||
}
|
||||
PrintTo(uv, os);
|
||||
}
|
||||
#endif // __SIZEOF_INT128__
|
||||
|
||||
// Prints the given array of characters to the ostream. CharType must be either
|
||||
// char, char8_t, char16_t, char32_t, or wchar_t.
|
||||
// The array starts at begin, the length is len, it may include '\0' characters
|
||||
// and may not be NUL-terminated.
|
||||
template <typename CharType>
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
|
||||
static CharFormat PrintCharsAsStringTo(
|
||||
const CharType* begin, size_t len, ostream* os) {
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ static CharFormat
|
||||
PrintCharsAsStringTo(const CharType* begin, size_t len, ostream* os) {
|
||||
const char* const quote_prefix = GetCharWidthPrefix(*begin);
|
||||
*os << quote_prefix << "\"";
|
||||
bool is_previous_hex = false;
|
||||
|
@ -340,12 +363,11 @@ static CharFormat PrintCharsAsStringTo(
|
|||
// Prints a (const) char/wchar_t array of 'len' elements, starting at address
|
||||
// 'begin'. CharType must be either char or wchar_t.
|
||||
template <typename CharType>
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
|
||||
static void UniversalPrintCharArray(
|
||||
const CharType* begin, size_t len, ostream* os) {
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ static void
|
||||
UniversalPrintCharArray(const CharType* begin, size_t len,
|
||||
ostream* os) {
|
||||
// The code
|
||||
// const char kFoo[] = "foo";
|
||||
// generates an array of 4, not 3, elements, with the last one being '\0'.
|
||||
|
@ -436,28 +458,28 @@ void PrintTo(const wchar_t* s, ostream* os) { PrintCStringTo(s, os); }
|
|||
namespace {
|
||||
|
||||
bool ContainsUnprintableControlCodes(const char* str, size_t length) {
|
||||
const unsigned char *s = reinterpret_cast<const unsigned char *>(str);
|
||||
const unsigned char* s = reinterpret_cast<const unsigned char*>(str);
|
||||
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
unsigned char ch = *s++;
|
||||
if (std::iscntrl(ch)) {
|
||||
switch (ch) {
|
||||
switch (ch) {
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t<= 0xbf; }
|
||||
bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t <= 0xbf; }
|
||||
|
||||
bool IsValidUTF8(const char* str, size_t length) {
|
||||
const unsigned char *s = reinterpret_cast<const unsigned char *>(str);
|
||||
const unsigned char* s = reinterpret_cast<const unsigned char*>(str);
|
||||
|
||||
for (size_t i = 0; i < length;) {
|
||||
unsigned char lead = s[i++];
|
||||
|
@ -470,15 +492,13 @@ bool IsValidUTF8(const char* str, size_t length) {
|
|||
} else if (lead <= 0xdf && (i + 1) <= length && IsUTF8TrailByte(s[i])) {
|
||||
++i; // 2-byte character
|
||||
} else if (0xe0 <= lead && lead <= 0xef && (i + 2) <= length &&
|
||||
IsUTF8TrailByte(s[i]) &&
|
||||
IsUTF8TrailByte(s[i + 1]) &&
|
||||
IsUTF8TrailByte(s[i]) && IsUTF8TrailByte(s[i + 1]) &&
|
||||
// check for non-shortest form and surrogate
|
||||
(lead != 0xe0 || s[i] >= 0xa0) &&
|
||||
(lead != 0xed || s[i] < 0xa0)) {
|
||||
i += 2; // 3-byte character
|
||||
} else if (0xf0 <= lead && lead <= 0xf4 && (i + 3) <= length &&
|
||||
IsUTF8TrailByte(s[i]) &&
|
||||
IsUTF8TrailByte(s[i + 1]) &&
|
||||
IsUTF8TrailByte(s[i]) && IsUTF8TrailByte(s[i + 1]) &&
|
||||
IsUTF8TrailByte(s[i + 2]) &&
|
||||
// check for non-shortest form
|
||||
(lead != 0xf0 || s[i] >= 0x90) &&
|
||||
|
@ -502,7 +522,7 @@ void ConditionalPrintAsText(const char* str, size_t length, ostream* os) {
|
|||
|
||||
void PrintStringTo(const ::std::string& s, ostream* os) {
|
||||
if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) {
|
||||
if (GTEST_FLAG(print_utf8)) {
|
||||
if (GTEST_FLAG_GET(print_utf8)) {
|
||||
ConditionalPrintAsText(s.data(), s.size(), os);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,13 +51,11 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
|
|||
return os << internal::FormatFileLocation(result.file_name(),
|
||||
result.line_number())
|
||||
<< " "
|
||||
<< (result.type() == TestPartResult::kSuccess
|
||||
? "Success"
|
||||
: result.type() == TestPartResult::kSkip
|
||||
? "Skipped"
|
||||
: result.type() == TestPartResult::kFatalFailure
|
||||
? "Fatal failure"
|
||||
: "Non-fatal failure")
|
||||
<< (result.type() == TestPartResult::kSuccess ? "Success"
|
||||
: result.type() == TestPartResult::kSkip ? "Skipped"
|
||||
: result.type() == TestPartResult::kFatalFailure
|
||||
? "Fatal failure"
|
||||
: "Non-fatal failure")
|
||||
<< ":\n"
|
||||
<< result.message() << std::endl;
|
||||
}
|
||||
|
@ -86,8 +84,8 @@ namespace internal {
|
|||
|
||||
HasNewFatalFailureHelper::HasNewFatalFailureHelper()
|
||||
: has_new_fatal_failure_(false),
|
||||
original_reporter_(GetUnitTestImpl()->
|
||||
GetTestPartResultReporterForCurrentThread()) {
|
||||
original_reporter_(
|
||||
GetUnitTestImpl()->GetTestPartResultReporterForCurrentThread()) {
|
||||
GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
|
||||
}
|
||||
|
||||
|
@ -98,8 +96,7 @@ HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
|
|||
|
||||
void HasNewFatalFailureHelper::ReportTestPartResult(
|
||||
const TestPartResult& result) {
|
||||
if (result.fatally_failed())
|
||||
has_new_fatal_failure_ = true;
|
||||
if (result.fatally_failed()) has_new_fatal_failure_ = true;
|
||||
original_reporter_->ReportTestPartResult(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#include "gtest/gtest-typed-test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -38,8 +37,7 @@ namespace internal {
|
|||
// Skips to the first non-space char in str. Returns an empty string if str
|
||||
// contains only whitespace characters.
|
||||
static const char* SkipSpaces(const char* str) {
|
||||
while (IsSpace(*str))
|
||||
str++;
|
||||
while (IsSpace(*str)) str++;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -85,8 +83,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
|
|||
}
|
||||
|
||||
for (RegisteredTestIter it = registered_tests_.begin();
|
||||
it != registered_tests_.end();
|
||||
++it) {
|
||||
it != registered_tests_.end(); ++it) {
|
||||
if (tests.count(it->first) == 0) {
|
||||
errors << "You forgot to list test " << it->first << ".\n";
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -28,15 +28,14 @@
|
|||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
|
||||
#if GTEST_OS_ESP8266
|
||||
extern "C" {
|
||||
#endif
|
||||
void setup() {
|
||||
testing::InitGoogleTest();
|
||||
}
|
||||
void setup() { testing::InitGoogleTest(); }
|
||||
|
||||
void loop() { RUN_ALL_TESTS(); }
|
||||
|
||||
|
|
|
@ -105,9 +105,9 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, const MODE_INFO *here, int_mv *nearest,
|
|||
tmp = near_mv_ref_cnts[CNT_NEAREST];
|
||||
near_mv_ref_cnts[CNT_NEAREST] = near_mv_ref_cnts[CNT_NEAR];
|
||||
near_mv_ref_cnts[CNT_NEAR] = tmp;
|
||||
tmp = near_mvs[CNT_NEAREST].as_int;
|
||||
tmp = (int)near_mvs[CNT_NEAREST].as_int;
|
||||
near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
|
||||
near_mvs[CNT_NEAR].as_int = tmp;
|
||||
near_mvs[CNT_NEAR].as_int = (uint32_t)tmp;
|
||||
}
|
||||
|
||||
/* Use near_mvs[0] to store the "best" MV */
|
||||
|
|
|
@ -816,8 +816,8 @@ void vp8_filter_block2d_first_pass16_0(unsigned char *RESTRICT src_ptr,
|
|||
|
||||
: [Temp1] "=&r"(Temp1), [Temp2] "=&r"(Temp2), [Temp3] "=&r"(Temp3),
|
||||
[Temp4] "=&r"(Temp4), [src_ptr] "+r"(src_ptr)
|
||||
: [src_pixels_per_line] "r"(src_pixels_per_line),
|
||||
[output_ptr] "r"(output_ptr));
|
||||
: [src_pixels_per_line] "r"(src_pixels_per_line), [output_ptr] "r"(
|
||||
output_ptr));
|
||||
|
||||
__asm__ __volatile__(
|
||||
"ulw %[Temp1], 0(%[src_ptr]) \n\t"
|
||||
|
@ -832,8 +832,8 @@ void vp8_filter_block2d_first_pass16_0(unsigned char *RESTRICT src_ptr,
|
|||
|
||||
: [Temp1] "=&r"(Temp1), [Temp2] "=&r"(Temp2), [Temp3] "=&r"(Temp3),
|
||||
[Temp4] "=&r"(Temp4), [src_ptr] "+r"(src_ptr)
|
||||
: [src_pixels_per_line] "r"(src_pixels_per_line),
|
||||
[output_ptr] "r"(output_ptr));
|
||||
: [src_pixels_per_line] "r"(src_pixels_per_line), [output_ptr] "r"(
|
||||
output_ptr));
|
||||
|
||||
__asm__ __volatile__(
|
||||
"ulw %[Temp1], 0(%[src_ptr]) \n\t"
|
||||
|
@ -848,8 +848,8 @@ void vp8_filter_block2d_first_pass16_0(unsigned char *RESTRICT src_ptr,
|
|||
|
||||
: [Temp1] "=&r"(Temp1), [Temp2] "=&r"(Temp2), [Temp3] "=&r"(Temp3),
|
||||
[Temp4] "=&r"(Temp4), [src_ptr] "+r"(src_ptr)
|
||||
: [src_pixels_per_line] "r"(src_pixels_per_line),
|
||||
[output_ptr] "r"(output_ptr));
|
||||
: [src_pixels_per_line] "r"(src_pixels_per_line), [output_ptr] "r"(
|
||||
output_ptr));
|
||||
|
||||
output_ptr += 48;
|
||||
}
|
||||
|
|
|
@ -122,10 +122,11 @@
|
|||
const uint8_t *psrc_m = (const uint8_t *)(psrc); \
|
||||
uint32_t val_m; \
|
||||
\
|
||||
asm volatile("lwr %[val_m], 0(%[psrc_m]) \n\t" \
|
||||
"lwl %[val_m], 3(%[psrc_m]) \n\t" \
|
||||
: [val_m] "=&r"(val_m) \
|
||||
: [psrc_m] "r"(psrc_m)); \
|
||||
asm volatile( \
|
||||
"lwr %[val_m], 0(%[psrc_m]) \n\t" \
|
||||
"lwl %[val_m], 3(%[psrc_m]) \n\t" \
|
||||
: [val_m] "=&r"(val_m) \
|
||||
: [psrc_m] "r"(psrc_m)); \
|
||||
\
|
||||
val_m; \
|
||||
})
|
||||
|
@ -136,10 +137,11 @@
|
|||
const uint8_t *psrc_m = (const uint8_t *)(psrc); \
|
||||
uint64_t val_m = 0; \
|
||||
\
|
||||
asm volatile("ldr %[val_m], 0(%[psrc_m]) \n\t" \
|
||||
"ldl %[val_m], 7(%[psrc_m]) \n\t" \
|
||||
: [val_m] "=&r"(val_m) \
|
||||
: [psrc_m] "r"(psrc_m)); \
|
||||
asm volatile( \
|
||||
"ldr %[val_m], 0(%[psrc_m]) \n\t" \
|
||||
"ldl %[val_m], 7(%[psrc_m]) \n\t" \
|
||||
: [val_m] "=&r"(val_m) \
|
||||
: [psrc_m] "r"(psrc_m)); \
|
||||
\
|
||||
val_m; \
|
||||
})
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx_ports/compiler_attributes.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
@ -50,7 +51,8 @@ int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source,
|
|||
|
||||
void vp8dx_bool_decoder_fill(BOOL_DECODER *br);
|
||||
|
||||
static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
|
||||
static VPX_NO_UNSIGNED_SHIFT_CHECK int vp8dx_decode_bool(BOOL_DECODER *br,
|
||||
int probability) {
|
||||
unsigned int bit = 0;
|
||||
VP8_BD_VALUE value;
|
||||
unsigned int split;
|
||||
|
|
|
@ -372,9 +372,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi,
|
|||
tmp = cnt[CNT_NEAREST];
|
||||
cnt[CNT_NEAREST] = cnt[CNT_NEAR];
|
||||
cnt[CNT_NEAR] = tmp;
|
||||
tmp = near_mvs[CNT_NEAREST].as_int;
|
||||
tmp = (int)near_mvs[CNT_NEAREST].as_int;
|
||||
near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
|
||||
near_mvs[CNT_NEAR].as_int = tmp;
|
||||
near_mvs[CNT_NEAR].as_int = (uint32_t)tmp;
|
||||
}
|
||||
|
||||
if (vp8_read(bc, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) {
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef VPX_VP8_DECODER_ONYXD_INT_H_
|
||||
#define VPX_VP8_DECODER_ONYXD_INT_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vp8/common/onyxd.h"
|
||||
#include "treereader.h"
|
||||
|
@ -136,6 +138,7 @@ int vp8_remove_decoder_instances(struct frame_buffers *fb);
|
|||
#if CONFIG_DEBUG
|
||||
#define CHECK_MEM_ERROR(lval, expr) \
|
||||
do { \
|
||||
assert(pbi->common.error.setjmp); \
|
||||
(lval) = (expr); \
|
||||
if (!(lval)) \
|
||||
vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR, \
|
||||
|
@ -145,6 +148,7 @@ int vp8_remove_decoder_instances(struct frame_buffers *fb);
|
|||
#else
|
||||
#define CHECK_MEM_ERROR(lval, expr) \
|
||||
do { \
|
||||
assert(pbi->common.error.setjmp); \
|
||||
(lval) = (expr); \
|
||||
if (!(lval)) \
|
||||
vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR, \
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <limits.h>
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/compiler_attributes.h"
|
||||
#include "vpx_ports/system_state.h"
|
||||
#include "bitstream.h"
|
||||
|
||||
|
@ -117,7 +118,9 @@ static void write_split(vp8_writer *bc, int x) {
|
|||
vp8_mbsplit_encodings + x);
|
||||
}
|
||||
|
||||
void vp8_pack_tokens(vp8_writer *w, const TOKENEXTRA *p, int xcount) {
|
||||
void VPX_NO_UNSIGNED_SHIFT_CHECK vp8_pack_tokens(vp8_writer *w,
|
||||
const TOKENEXTRA *p,
|
||||
int xcount) {
|
||||
const TOKENEXTRA *stop = p + xcount;
|
||||
unsigned int split;
|
||||
int shift;
|
||||
|
|
|
@ -92,8 +92,7 @@ typedef struct macroblock {
|
|||
signed int last_act_zbin_adj;
|
||||
|
||||
int *mvcost[2];
|
||||
/* MSVC generates code that thinks this is 16-byte aligned */
|
||||
DECLARE_ALIGNED(16, int*, mvsadcost[2]);
|
||||
int *mvsadcost[2];
|
||||
int (*mbmode_cost)[MB_MODE_COUNT];
|
||||
int (*intra_uv_mode_cost)[MB_MODE_COUNT];
|
||||
int (*bmode_costs)[10][10];
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче