Macroblocks can refer to the same reference picture using different indices when the same picture appears in multiple slots in the current reference picture lists. That leads to calculating the wrong loop filter strength for edge processing, and small errors in the conformance suite on (for example) CVWP5_TOSHIBA_E.264 and others. Modify the test-suite and checksums for affected test files where this situation occurs.
Showing the changes to test/decoder/DecUT_DeblockCommon.cpp (1 of 5 files). Show all
Unified · Split
| @@ -776,9 +776,11 @@ TEST (DecoderDeblocking, FilteringEdgeLumaHV) { · 775 unmodified lines | ||
| 776 | 776 | |
| 777 | 777 | /////////// Bs calculation functions |
| 778 | 778 | TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) { |
| 779 | − // uint32_t DeblockingBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy) | |
| 779 | + // uint32_t DeblockingBsMarginalMBAvcbase (PDeblockingFilter pFilter, PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy) | |
| 780 | 780 | /* Calculate the Bs equal to 2 or 1 */ |
| 781 | 781 | SDqLayer sDqLayer; |
| 782 | + SDeblockingFilter sFilter; | |
| 783 | + int i; | |
| 782 | 784 | |
| 783 | 785 | // Only define 2 MBs here |
| 784 | 786 | int8_t iNoZeroCount[24 * 2]; // (*pNzc)[24] |
| @@ -787,6 +789,8 @@ TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) { · 2 unmodified lines | ||
| 787 | 789 | uint32_t uiBSx4; |
| 788 | 790 | uint8_t* pBS = (uint8_t*) (&uiBSx4); |
| 789 | 791 | |
| 792 | + PPicture iFilterPics[2][MAX_DPB_COUNT]; // Dummy reference pictures list | |
| 793 | + | |
| 790 | 794 | sDqLayer.pNzc = (int8_t (*)[24])iNoZeroCount; |
| 791 | 795 | sDqLayer.pRefIndex[0] = (int8_t (*)[16])&iLayerRefIndex[0]; |
| 792 | 796 | sDqLayer.pRefIndex[1] = (int8_t (*)[16])&iLayerRefIndex[1]; |
| @@ -797,6 +801,13 @@ TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) { · 4 unmodified lines | ||
| 797 | 801 | bool bTSize8x8Flag[50] = {false}; |
| 798 | 802 | sDqLayer.pTransformSize8x8Flag = bTSize8x8Flag; |
| 799 | 803 | memset (bTSize8x8Flag, 0, sizeof (bool) * 50); |
| 804 | + // Dummy picture list pointers to 1..MAX_DPB_COUNT | |
| 805 | + // the pointer values don't need to be valid, just different | |
| 806 | + for (i = 0; i < MAX_DPB_COUNT; i++) | |
| 807 | + iFilterPics[0][i] = iFilterPics[1][i] = (PPicture)(iFilterPics + (i<<3)); | |
| 808 | + | |
| 809 | + sFilter.pRefPics[0] = iFilterPics[0]; | |
| 810 | + sFilter.pRefPics[1] = iFilterPics[1]; | |
| 800 | 811 | |
| 801 | 812 | #define UT_DB_CLEAN_STATUS \ |
| 802 | 813 | memset(iNoZeroCount, 0, sizeof(int8_t)*24*2); \ |
| @@ -819,14 +830,14 @@ TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) { · 16 unmodified lines | ||
| 819 | 830 | UT_DB_CLEAN_STATUS |
| 820 | 831 | iNoZeroCount[0 * 24 + iCurrBlock] = 1; // Current MB_block position |
| 821 | 832 | SET_REF_VALUE(2, iPos); |
| 822 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 833 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 823 | 834 | 0) == uiBSx4) << iEdge << " " << iPos << " NoZeroCount!=0"; |
| 824 | 835 | |
| 825 | 836 | // (2) iEdge == 0, neighbor block NoZeroCount != 0 |
| 826 | 837 | UT_DB_CLEAN_STATUS |
| 827 | 838 | iNoZeroCount[1 * 24 + iNeighborBlock ] = 1; // Neighbor MB_block position |
| 828 | 839 | SET_REF_VALUE(2, iPos); |
| 829 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 840 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 830 | 841 | 0) == uiBSx4) << iEdge << " " << iPos << " NoZeroCount!=0"; |
| 831 | 842 | |
| 832 | 843 | // (3) iEdge == 0, reference idx diff |
| @@ -834,63 +845,63 @@ TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) { · 1 unmodified line | ||
| 834 | 845 | iLayerRefIndex[0][0 * 16 + iCurrBlock] = 0; |
| 835 | 846 | iLayerRefIndex[0][1 * 16 + iNeighborBlock] = 1; |
| 836 | 847 | SET_REF_VALUE(1, iPos); |
| 837 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 848 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 838 | 849 | 0) == uiBSx4) << iEdge << " " << iPos << " Ref idx diff"; |
| 839 | 850 | |
| 840 | 851 | // (4) iEdge == 0, abs(mv diff) < 4 |
| 841 | 852 | UT_DB_CLEAN_STATUS |
| 842 | 853 | iLayerMv[0][0 * 16 + iCurrBlock][0] = rand() % 4; |
| 843 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 854 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 844 | 855 | |
| 845 | 856 | UT_DB_CLEAN_STATUS |
| 846 | 857 | iLayerMv[0][0 * 16 + iCurrBlock][1] = rand() % 4; |
| 847 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 858 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 848 | 859 | |
| 849 | 860 | UT_DB_CLEAN_STATUS |
| 850 | 861 | iLayerMv[0][1 * 16 + iNeighborBlock][0] = rand() % 4; |
| 851 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 862 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 852 | 863 | |
| 853 | 864 | UT_DB_CLEAN_STATUS |
| 854 | 865 | iLayerMv[0][1 * 16 + iNeighborBlock][1] = rand() % 4; |
| 855 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 866 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, 0) == 0) << iEdge << " " << iPos << " diff_mv < 4"; | |
| 856 | 867 | |
| 857 | 868 | // (5) iEdge == 0, abs(mv diff) > 4 |
| 858 | 869 | UT_DB_CLEAN_STATUS |
| 859 | 870 | iLayerMv[0][0 * 16 + iCurrBlock][0] = 4; |
| 860 | 871 | SET_REF_VALUE(1, iPos); |
| 861 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 872 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 862 | 873 | 0) == uiBSx4) << iEdge << " " << iPos << " diff_mv == 4"; |
| 863 | 874 | |
| 864 | 875 | UT_DB_CLEAN_STATUS |
| 865 | 876 | iLayerMv[0][0 * 16 + iCurrBlock][1] = 4; |
| 866 | 877 | SET_REF_VALUE(1, iPos); |
| 867 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 878 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 868 | 879 | 0) == uiBSx4) << iEdge << " " << iPos << " diff_mv == 4"; |
| 869 | 880 | |
| 870 | 881 | UT_DB_CLEAN_STATUS |
| 871 | 882 | iLayerMv[0][1 * 16 + iNeighborBlock][0] = 4; |
| 872 | 883 | SET_REF_VALUE(1, iPos); |
| 873 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 884 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 874 | 885 | 0) == uiBSx4) << iEdge << " " << iPos << " diff_mv == 4"; |
| 875 | 886 | |
| 876 | 887 | UT_DB_CLEAN_STATUS |
| 877 | 888 | iLayerMv[0][1 * 16 + iNeighborBlock][1] = 4; |
| 878 | 889 | SET_REF_VALUE(1, iPos); |
| 879 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 890 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 880 | 891 | 0) == uiBSx4) << iEdge << " " << iPos << " diff_mv == 4"; |
| 881 | 892 | |
| 882 | 893 | UT_DB_CLEAN_STATUS |
| 883 | 894 | iLayerMv[0][0 * 16 + iCurrBlock][0] = -2048; |
| 884 | 895 | iLayerMv[0][1 * 16 + iNeighborBlock][0] = 2047; |
| 885 | 896 | SET_REF_VALUE(1, iPos); |
| 886 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 897 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 887 | 898 | 0) == uiBSx4) << iEdge << " " << iPos << " diff_mv == maximum"; |
| 888 | 899 | |
| 889 | 900 | UT_DB_CLEAN_STATUS |
| 890 | 901 | iLayerMv[0][0 * 16 + iCurrBlock][1] = -2048; |
| 891 | 902 | iLayerMv[0][1 * 16 + iNeighborBlock][1] = 2047; |
| 892 | 903 | SET_REF_VALUE(1, iPos); |
| 893 | − EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1, | |
| 904 | + EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sFilter, &sDqLayer, iEdge, 1, | |
| 894 | 905 | 0) == uiBSx4) << iEdge << " " << iPos << " diff_mv == maximum"; |
| 895 | 906 | } |
| 896 | 907 | } |
| @@ -913,6 +924,7 @@ TEST (Deblocking, WelsDeblockingMb) { · 16 unmodified lines | ||
| 913 | 924 | sFilter.pLoopf->pfLumaDeblockingEQ4Hor = &UT_DeblockingFuncLumaEQ4Func; |
| 914 | 925 | sFilter.pLoopf->pfLumaDeblockingLT4Ver = &UT_DeblockingFuncLumaLT4Func; |
| 915 | 926 | sFilter.pLoopf->pfLumaDeblockingEQ4Ver = &UT_DeblockingFuncLumaEQ4Func; |
| 927 | + sFilter.pRefPics[0] = sFilter.pRefPics[1] = NULL; // Don't need Ref pics for intra tests | |
| 916 | 928 | |
| 917 | 929 | sDqLayer.iMbX = sDqLayer.iMbY = 0; |
| 918 | 930 | sDqLayer.iMbXyIndex = 1; |