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

Commit 3d928b14 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8641798 from aff26637 to tm-qpr1-release

Change-Id: Ib5144430f4739744dad83cc604edcc727a50a74b
parents 7dafc279 aff26637
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -969,7 +969,23 @@ void CCodecConfig::initializeStandardParams() {
        .limitTo(D::ENCODER & D::VIDEO & D::READ));

    add(ConfigMapper(KEY_PICTURE_TYPE, C2_PARAMKEY_PICTURE_TYPE, "value")
        .limitTo(D::ENCODER & D::VIDEO & D::READ));
        .limitTo(D::ENCODER & D::VIDEO & D::READ)
        .withMappers([](C2Value v) -> C2Value {
            int32_t sdk;
            C2Config::picture_type_t c2;
            if (v.get(&sdk) && C2Mapper::map(sdk, &c2)) {
                return C2Value(c2);
            }
            return C2Value();
        }, [](C2Value v) -> C2Value {
            C2Config::picture_type_t c2;
            int32_t sdk = PICTURE_TYPE_UNKNOWN;
            using C2ValueType=typename _c2_reduce_enum_to_underlying_type<decltype(c2)>::type;
            if (v.get((C2ValueType*)&c2) && C2Mapper::map(c2, &sdk)) {
                return sdk;
            }
            return C2Value();
        }));

    /* still to do
       not yet used by MediaCodec, but defined as MediaFormat
+13 −8
Original line number Diff line number Diff line
@@ -1178,9 +1178,6 @@ c2_status_t SetHdrMetadataToGralloc4Handle(
    }
    if (dynamicInfo && *dynamicInfo && dynamicInfo->flexCount() > 0) {
        ALOGV("Setting dynamic HDR info as gralloc4 metadata");
        hidl_vec<uint8_t> vec;
        vec.resize(dynamicInfo->flexCount());
        memcpy(vec.data(), dynamicInfo->m.data, dynamicInfo->flexCount());
        std::optional<IMapper4::MetadataType> metadataType;
        switch (dynamicInfo->m.type_) {
        case C2Config::HDR_DYNAMIC_METADATA_TYPE_SMPTE_2094_10:
@@ -1190,13 +1187,21 @@ c2_status_t SetHdrMetadataToGralloc4Handle(
            metadataType = MetadataType_Smpte2094_40;
            break;
        }

        if (metadataType) {
            std::vector<uint8_t> smpte2094_40;
            smpte2094_40.resize(dynamicInfo->flexCount());
            memcpy(smpte2094_40.data(), dynamicInfo->m.data, dynamicInfo->flexCount());

            hidl_vec<uint8_t> vec;
            if (gralloc4::encodeSmpte2094_40({ smpte2094_40 }, &vec) == OK) {
                Return<Error4> ret = mapper->set(buffer.get(), *metadataType, vec);
                if (!ret.isOk()) {
                    err = C2_REFUSED;
                } else if (ret != Error4::NONE) {
                    err = C2_CORRUPTED;
                }
            }
        } else {
            err = C2_BAD_VALUE;
        }
+17 −0
Original line number Diff line number Diff line
@@ -460,6 +460,13 @@ ALookup<uint32_t, int32_t> sPixelFormats = {
    { HAL_PIXEL_FORMAT_RGBA_FP16,              COLOR_Format64bitABGRFloat },
};

ALookup<C2Config::picture_type_t, int32_t> sPictureType = {
    { C2Config::picture_type_t::SYNC_FRAME,     PICTURE_TYPE_I },
    { C2Config::picture_type_t::I_FRAME,        PICTURE_TYPE_I },
    { C2Config::picture_type_t::P_FRAME,        PICTURE_TYPE_P },
    { C2Config::picture_type_t::B_FRAME,        PICTURE_TYPE_B },
};

/**
 * A helper that passes through vendor extension profile and level values.
 */
@@ -1075,3 +1082,13 @@ bool C2Mapper::mapPixelFormatCodecToFramework(
    }
    return true;
}

// static
bool C2Mapper::map(C2Config::picture_type_t from, int32_t *to) {
    return sPictureType.map(from, to);
}

// static
bool C2Mapper::map(int32_t from, C2Config::picture_type_t *to) {
    return sPictureType.map(from, to);
}
+3 −2
Original line number Diff line number Diff line
@@ -102,10 +102,11 @@ template <typename T>
static bool findParam(uint32_t key, T *param,
        KeyedVector<uint32_t, uint64_t> &params) {
    CHECK(param);
    if (params.indexOfKey(key) < 0) {
    ssize_t index = params.indexOfKey(key);
    if (index < 0) {
        return false;
    }
    *param = (T) params[key];
    *param = (T) params[index];
    return true;
}