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

Commit a2ac684a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "codec2: enc stat: add mapper for picture_type_t" into tm-dev

parents 0665da9b fad78c49
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
+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);
}