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

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

Merge "codecs: implement avcdec in Codec2 interface"

parents 70ab327c 0350a9aa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public:
    // virtual void onComponentReleased(<id>) = 0;

protected:
    virtual ~C2ComponentListener();
    virtual ~C2ComponentListener() = default;
};

/**
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ cc_test {
    include_dirs: [
        "frameworks/av/media/libstagefright/codec2/include",
        "frameworks/av/media/libstagefright/codec2/vndk/include",
        "frameworks/native/include/media/openmax",
    ],

    shared_libs: [
+9 −1
Original line number Diff line number Diff line
@@ -854,7 +854,7 @@ C2Error C2AllocationGralloc::map(
        }
    }

    if (mInfo.format == PixelFormat::YCBCR_420_888) {
    if (mInfo.format == PixelFormat::YCBCR_420_888 || mInfo.format == PixelFormat::YV12) {
        YCbCrLayout ycbcrLayout;
        mMapper->lockYCbCr(
                const_cast<native_handle_t *>(mBuffer),
@@ -1148,6 +1148,10 @@ public:
    }

    C2Error map(C2Rect rect) {
        if (mData[0] != nullptr) {
            // Already mapped.
            return C2_OK;
        }
        C2Error err = mAllocation->map(
                rect,
                { C2MemoryUsage::kSoftwareRead, 0 },
@@ -1209,6 +1213,10 @@ public:
    }

    C2Error map(C2Rect rect) {
        if (mData[0] != nullptr) {
            // Already mapped.
            return C2_OK;
        }
        uint8_t *data[C2PlaneLayout::MAX_NUM_PLANES];
        C2Error err = mAllocation->map(
                rect,
+41 −0
Original line number Diff line number Diff line
@@ -36,3 +36,44 @@ cc_library_shared {
    ldflags: ["-Wl,-Bsymbolic"],
    compile_multilib: "32",
}

cc_library_shared {
    name: "libstagefright_soft_c2avcdec",

    static_libs: [
        "libavcdec",
        "libstagefright_codec2_vndk",
    ],
    srcs: ["C2SoftAvcDec.cpp"],

    include_dirs: [
        "external/libavc/decoder",
        "external/libavc/common",
        "frameworks/av/media/libstagefright/codec2/include",
        "frameworks/av/media/libstagefright/codec2/vndk/include",
    ],

    shared_libs: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.mapper@2.0",
        "libhidlbase",
        "libion",
        "liblog",
        "libmedia",
        "libstagefright_codec2",
        "libstagefright_foundation",
        "libutils",
    ],

    sanitize: {
        misc_undefined: [
            "signed-integer-overflow",
        ],
        cfi: true,
        diag: {
            cfi: true,
        },
    },

    ldflags: ["-Wl,-Bsymbolic"],
}
+87 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef C2AVCCONFIG_H_
#define C2AVCCONFIG_H_

#include <C2Config.h>

namespace android {

enum : uint32_t {
    kParamIndexAvcProfile = kParamIndexParamStart + 1,
    kParamIndexAvcLevel,
    kParamIndexBlockSize,
    kParamIndexAlignment,
    kParamIndexFramerate,
    kParamIndexBlocksPerSecond,
};

enum C2AvcProfileIdc : uint32_t {
    kAvcProfileUnknown  = 0,
    kAvcProfileBaseline = 66,
    kAvcProfileMain     = 77,
    kAvcProfileExtended = 88,
    kAvcProfileHigh     = 100,
    kAvcProfileHigh10   = 110,
    kAvcProfileHigh422  = 122,
    kAvcProfileHigh444  = 144,
};

enum C2AvcLevelIdc : uint32_t {
    kAvcLevelUnknown = 0,
    kAvcLevel10      = 10,
    kAvcLevel1b      = 9,
    kAvcLevel11      = 11,
    kAvcLevel12      = 12,
    kAvcLevel13      = 13,
    kAvcLevel20      = 20,
    kAvcLevel21      = 21,
    kAvcLevel22      = 22,
    kAvcLevel30      = 30,
    kAvcLevel31      = 31,
    kAvcLevel32      = 32,
    kAvcLevel40      = 40,
    kAvcLevel41      = 41,
    kAvcLevel42      = 42,
    kAvcLevel50      = 50,
    kAvcLevel51      = 51,
    kAvcLevel52      = 52,
};

// profile for AVC video decoder [IN]
typedef C2StreamParam<C2Info, C2SimpleValueStruct<C2AvcProfileIdc>, kParamIndexAvcProfile>
    C2AvcProfileInfo;

// level for AVC video decoder [IN]
typedef C2StreamParam<C2Info, C2SimpleValueStruct<C2AvcLevelIdc>, kParamIndexAvcLevel>
    C2AvcLevelInfo;

// block size [OUT]
typedef C2StreamParam<C2Info, C2VideoSizeStruct, kParamIndexBlockSize> C2BlockSizeInfo;

// alignment [OUT]
typedef C2StreamParam<C2Info, C2VideoSizeStruct, kParamIndexAlignment> C2AlignmentInfo;

// frame rate [OUT, hint]
typedef C2StreamParam<C2Info, C2Uint32Value, kParamIndexFramerate> C2FrameRateInfo;

// blocks-per-second [OUT, hint]
typedef C2StreamParam<C2Info, C2Uint32Value, kParamIndexBlocksPerSecond> C2BlocksPerSecondInfo;

} // namespace android

#endif  // C2AVCCONFIG_H_
Loading