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

Commit 7b4e9d93 authored by Ray Essick's avatar Ray Essick
Browse files

Update MediaFormatShaper

-- differentiate internal vs exported header files
-- handle when both shaper and app specify QP
-- use defined constant for QP feature parameters instead of literal
-- HEVC values for bits-per-pixel based on experimentation
-- tune upper end of range where we shape (change fewer encodings)

Bug: 183211971
Test: VQ test suite
Change-Id: I6ba5b993878dffdaba12509cdea7a4cecbb819f2
parent d31fc049
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ cc_defaults {
        "include",
    ],

    header_libs: [
        "libstagefright_headers",
    ],

    shared_libs: [
        "liblog",
        "libutils",
+7 −5
Original line number Diff line number Diff line
@@ -21,7 +21,9 @@
#include <string>
#include <stdlib.h>

#include <media/formatshaper/CodecProperties.h>
#include "CodecProperties.h"

#include <media/stagefright/MediaCodecConstants.h>


// we aren't going to mess with shaping points dimensions beyond this
@@ -68,11 +70,11 @@ void CodecProperties::setFeatureValue(std::string key, int32_t value) {
    ALOGD("setFeatureValue(%s,%d)", key.c_str(), value);
    mFeatures.insert({key, value});

    if (!strcmp(key.c_str(), "qp-bounds")) {               // official key
        setSupportsQp(1);
    } else if (!strcmp(key.c_str(), "vq-supports-qp")) {   // key from prototyping
    if (!strcmp(key.c_str(), FEATURE_QpBounds)) {
        setSupportsQp(1);
    } else if (!strcmp(key.c_str(), "vq-minimum-quality")) {
    } else if (!strcmp(key.c_str(), "video-minimum-quality")) {
        setSupportedMinimumQuality(1);
    } else if (!strcmp(key.c_str(), "vq-minimum-quality")) { // from prototyping
        setSupportedMinimumQuality(1);
    }
}
+7 −4
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include <string>

#include <media/formatshaper/CodecProperties.h>
#include "CodecProperties.h"

namespace android {
namespace mediaformatshaper {
@@ -49,7 +49,7 @@ typedef struct {
 */

static preloadTuning_t featuresAvc[] = {
      {true, "vq-target-bpp", "2.45"},
      // {true, "vq-target-bpp", "2.45"},
      {true, "vq-target-bpp-1080p", "2.40"},
      {true, "vq-target-bpp-540p", "2.60"},
      {true, "vq-target-bpp-480p", "3.00"},
@@ -58,8 +58,11 @@ static preloadTuning_t featuresAvc[] = {
};

static preloadTuning_t featuresHevc[] = {
      {true, "vq-target-bpp", "2.30"},
      {true, "vq-target-qpmax", "40"}, // nop, since hevc codecs don't declare qp support
      // {true, "vq-target-bpp", "1.80"},
      {true, "vq-target-bpp-1080p", "1.50"},
      {true, "vq-target-bpp-720p", "1.80"},
      {true, "vq-target-bpp-540p", "2.10"},
      // no qp for hevc, at least for now
      {true, nullptr, 0}
};

+4 −3
Original line number Diff line number Diff line
@@ -23,10 +23,11 @@

#include <media/NdkMediaFormat.h>

#include <media/formatshaper/VQops.h>
#include <media/formatshaper/CodecProperties.h>
#include "CodecProperties.h"
#include "VideoShaper.h"
#include "VQops.h"

#include <media/formatshaper/FormatShaper.h>
#include <media/formatshaper/VideoShaper.h>

namespace android {
namespace mediaformatshaper {
Loading