Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab5299e6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Marco Nelissen
Browse files

mpeg4 decoder: Enable support for quant_type 1

Enabled support for quant_type 1 which is an advanced simple profile
toolset. Other toolsets in advanced simple profile (Quarter pel,
interlaced, GMC etc) continue to be not supported.

Updated tests to test different quant type values

Bug: 169287096
Test: poc in bug
Test: atest Mpeg4H263DecoderTest \
      -- --enable-module-dynamic-download=true

Change-Id: Ic3b6b238e96609536770f294da3f609efc268f1e
Merged-In: I4396b5e6b6b4e75607a305683c7e7d7ef30eb648
parent 6d30324c
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@

#define OSCL_DISABLE_WARNING_CONV_POSSIBLE_LOSS_OF_DATA

#ifdef PV_SUPPORT_MAIN_PROFILE
/* INTRA */
const static int mpeg_iqmat_def[NCOEFF_BLOCK] =
{
@@ -50,7 +49,6 @@ const static int mpeg_nqmat_def[64] =
    22, 23, 24, 26, 27, 28, 30, 31,
    23, 24, 25, 27, 28, 30, 31, 33
};
#endif

/* ======================================================================== */
/*  Function : CalcNumBits()                                                */
@@ -86,9 +84,7 @@ PV_STATUS DecodeVOLHeader(VideoDecData *video, int layer)
    BitstreamDecVideo *stream;
    uint32 tmpvar, vol_shape;
    uint32 startCode;
#ifdef PV_SUPPORT_MAIN_PROFILE
    int *qmat, i, j;
#endif
    int version_id = 1;
#ifdef PV_TOLERATE_VOL_ERRORS
    uint32 profile = 0x01;
@@ -317,7 +313,8 @@ decode_vol:
        }
        else
        {
            if (tmpvar != 0x01) return PV_FAIL;
            // Simple and advanced simple (for quant-type 1)
            if (tmpvar != 0x01 && tmpvar != 0x11) return PV_FAIL;
        }

        /* version id specified? */
@@ -486,7 +483,6 @@ decode_vol:
        currVol->quantType = BitstreamRead1Bits(stream);
        if (currVol->quantType)
        {
#ifdef PV_SUPPORT_MAIN_PROFILE
            /* load quantization matrices.   5/22/2000 */
            /* load_intra_quant_mat (1 bit) */
            qmat = currVol->iqmat;
@@ -545,9 +541,6 @@ decode_vol:
            {
                oscl_memcpy(qmat, mpeg_nqmat_def, 64*sizeof(int));
            }
#else
            return PV_FAIL;
#endif
        }

        if (version_id != 1)
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
        <option name="cleanup" value="true" />
        <option name="push" value="Mpeg4H263DecoderTest->/data/local/tmp/Mpeg4H263DecoderTest" />
        <option name="push-file"
            key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder.zip?unzip=true"
            key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder-1.1.zip?unzip=true"
            value="/data/local/tmp/Mpeg4H263DecoderTestRes/" />
    </target_preparer>

+3 −0
Original line number Diff line number Diff line
@@ -404,6 +404,9 @@ INSTANTIATE_TEST_SUITE_P(
                          make_tuple("swirl_352x288_h263.h263", "swirl_352x288_h263.info", false),
                          make_tuple("bbb_352x288_h263.h263", "bbb_352x288_h263.info", false),
                          make_tuple("bbb_352x288_mpeg4.m4v", "bbb_352x288_mpeg4.info", true),
                          make_tuple("qtype0_mpeg4.m4v", "qtype0_mpeg4.info", true),
                          make_tuple("qtype1_mpeg4.m4v", "qtype1_mpeg4.info", true),
                          make_tuple("qtype1_qmatrix_mpeg4.m4v", "qtype1_qmatrix_mpeg4.info", true),
                          make_tuple("swirl_128x128_mpeg4.m4v", "swirl_128x128_mpeg4.info", true),
                          make_tuple("swirl_130x132_mpeg4.m4v", "swirl_130x132_mpeg4.info", true),
                          make_tuple("swirl_132x130_mpeg4.m4v", "swirl_132x130_mpeg4.info", true),
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ To test 32-bit binary push binaries from nativetest.
adb push ${OUT}/data/nativetest/Mpeg4H263DecoderTest/Mpeg4H263DecoderTest /data/local/tmp/
```

The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder.zip). Download, unzip and push these files into device for testing.
The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder-1.1.zip).
Download, unzip and push these files into device for testing.

```
adb push Mpeg4H263Decoder /data/local/tmp/