--------------------------------------------------------------------------------------------------------------------//
| 717 | |
| 718 | //--------------------------------------------------------------------------------------------------------------------// |
| 719 | TEST_P(OpCvtColor, correct_output) |
| 720 | { |
| 721 | int wdth = GetParamValue<0>(); |
| 722 | int hght = GetParamValue<1>(); |
| 723 | int imgs = GetParamValue<2>(); |
| 724 | |
| 725 | nvcv::ImageFormat srcFrmt{GetParamValue<3>()}; |
| 726 | nvcv::ImageFormat dstFrmt{GetParamValue<4>()}; |
| 727 | |
| 728 | NVCVColorConversionCode code{GetParamValue<5>()}; |
| 729 | |
| 730 | double maxDiff{GetParamValue<6>()}; |
| 731 | |
| 732 | // Create input and output tensors. |
| 733 | nvcv::Tensor srcTensor = util::CreateTensor(imgs, wdth, hght, srcFrmt); |
| 734 | nvcv::Tensor dstTensor = util::CreateTensor(imgs, wdth, hght, dstFrmt); |
| 735 | |
| 736 | NVCVDataType dataType; |
| 737 | ASSERT_EQ(nvcvImageFormatGetPlaneDataType(srcFrmt, 0, &dataType), NVCV_SUCCESS); |
| 738 | |
| 739 | switch (dataType) |
| 740 | { |
| 741 | case NVCV_DATA_TYPE_U8: |
| 742 | case NVCV_DATA_TYPE_2U8: |
| 743 | case NVCV_DATA_TYPE_3U8: |
| 744 | case NVCV_DATA_TYPE_4U8: |
| 745 | case NVCV_DATA_TYPE_S8: |
| 746 | case NVCV_DATA_TYPE_2S8: |
| 747 | case NVCV_DATA_TYPE_3S8: |
| 748 | case NVCV_DATA_TYPE_4S8: |
| 749 | verifyOutput<uint8_t>(srcTensor, srcFrmt, dstTensor, dstFrmt, code, wdth, hght, imgs, maxDiff); |
| 750 | break; |
| 751 | |
| 752 | case NVCV_DATA_TYPE_U16: |
| 753 | case NVCV_DATA_TYPE_2U16: |
| 754 | case NVCV_DATA_TYPE_3U16: |
| 755 | case NVCV_DATA_TYPE_4U16: |
| 756 | case NVCV_DATA_TYPE_S16: |
| 757 | case NVCV_DATA_TYPE_2S16: |
| 758 | case NVCV_DATA_TYPE_3S16: |
| 759 | case NVCV_DATA_TYPE_4S16: |
| 760 | case NVCV_DATA_TYPE_F16: // Data type float16 is only allowed in conversions that treat it as 16-bit integer |
| 761 | case NVCV_DATA_TYPE_2F16: // (e.g., RGB2BGR or Gray2RGB). |
| 762 | case NVCV_DATA_TYPE_3F16: |
| 763 | case NVCV_DATA_TYPE_4F16: |
| 764 | verifyOutput<uint16_t>(srcTensor, srcFrmt, dstTensor, dstFrmt, code, wdth, hght, imgs, maxDiff); |
| 765 | break; |
| 766 | |
| 767 | case NVCV_DATA_TYPE_S32: |
| 768 | case NVCV_DATA_TYPE_2S32: |
| 769 | case NVCV_DATA_TYPE_3S32: |
| 770 | case NVCV_DATA_TYPE_4S32: |
| 771 | verifyOutput<int32_t>(srcTensor, srcFrmt, dstTensor, dstFrmt, code, wdth, hght, imgs, maxDiff); |
| 772 | break; |
| 773 | |
| 774 | case NVCV_DATA_TYPE_F32: |
| 775 | case NVCV_DATA_TYPE_2F32: |
| 776 | case NVCV_DATA_TYPE_3F32: |
nothing calls this directly
no test coverage detected