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

Commit 3d5d05ab authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 7f8edbd9: Merge "remove unused YUV formats" into gingerbread

Merge commit '7f8edbd92737bc610bf4f06ad8a516656be83188' into gingerbread-plus-aosp

* commit '7f8edbd92737bc610bf4f06ad8a516656be83188':
  remove unused YUV formats
parents fb3e4a13 1632de8a
Loading
Loading
Loading
Loading
+22 −13
Original line number Original line Diff line number Diff line
@@ -87,7 +87,7 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format)
    GLenum target = GL_TEXTURE_2D;
    GLenum target = GL_TEXTURE_2D;
#if defined(GL_OES_texture_external)
#if defined(GL_OES_texture_external)
    if (GLExtensions::getInstance().haveTextureExternal()) {
    if (GLExtensions::getInstance().haveTextureExternal()) {
        if (format && isSupportedYuvFormat(format)) {
        if (format && isYuvFormat(format)) {
            target = GL_TEXTURE_EXTERNAL_OES;
            target = GL_TEXTURE_EXTERNAL_OES;
            pImage->target = Texture::TEXTURE_EXTERNAL;
            pImage->target = Texture::TEXTURE_EXTERNAL;
        }
        }
@@ -105,23 +105,32 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format)


bool TextureManager::isSupportedYuvFormat(int format)
bool TextureManager::isSupportedYuvFormat(int format)
{
{
    return isYuvFormat(format);
    switch (format) {
    case HAL_PIXEL_FORMAT_YV12:
    case HAL_PIXEL_FORMAT_YV16:
        return true;
    }
    return false;
}
}


bool TextureManager::isYuvFormat(int format)
bool TextureManager::isYuvFormat(int format)
{
{
    switch (format) {
    switch (format) {
    case HAL_PIXEL_FORMAT_NV16:
    // supported YUV formats
    case HAL_PIXEL_FORMAT_NV21:
    case HAL_PIXEL_FORMAT_YV12:
    case HAL_PIXEL_FORMAT_IYUV:
    case HAL_PIXEL_FORMAT_YV16:
    case HAL_PIXEL_FORMAT_YUV9:
    // Legacy/deprecated YUV formats
    case HAL_PIXEL_FORMAT_YUY2:
    case HAL_PIXEL_FORMAT_YCbCr_422_SP:
    case HAL_PIXEL_FORMAT_UYVY:
    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
    case HAL_PIXEL_FORMAT_NV12:
    case HAL_PIXEL_FORMAT_YCbCr_422_I:
    case HAL_PIXEL_FORMAT_NV61:
    case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
    case HAL_PIXEL_FORMAT_NV12_ADRENO_TILED:
        return true;
        return true;
    }
    }

    // Any OEM format needs to be considered
    if (format>=0x100 && format<=0x1FF)
        return true;

    return false;
    return false;
}
}


@@ -255,7 +264,7 @@ status_t TextureManager::loadTexture(Texture* texture,
            glTexImage2D(GL_TEXTURE_2D, 0,
            glTexImage2D(GL_TEXTURE_2D, 0,
                    GL_RGBA, texture->potWidth, texture->potHeight, 0,
                    GL_RGBA, texture->potWidth, texture->potHeight, 0,
                    GL_RGBA, GL_UNSIGNED_BYTE, data);
                    GL_RGBA, GL_UNSIGNED_BYTE, data);
        } else if (isYuvFormat(t.format)) {
        } else if (isSupportedYuvFormat(t.format)) {
            // just show the Y plane of YUV buffers
            // just show the Y plane of YUV buffers
            glTexImage2D(GL_TEXTURE_2D, 0,
            glTexImage2D(GL_TEXTURE_2D, 0,
                    GL_LUMINANCE, texture->potWidth, texture->potHeight, 0,
                    GL_LUMINANCE, texture->potWidth, texture->potHeight, 0,
@@ -283,7 +292,7 @@ status_t TextureManager::loadTexture(Texture* texture,
                    0, bounds.top, t.width, bounds.height(),
                    0, bounds.top, t.width, bounds.height(),
                    GL_RGBA, GL_UNSIGNED_BYTE,
                    GL_RGBA, GL_UNSIGNED_BYTE,
                    t.data + bounds.top*t.stride*4);
                    t.data + bounds.top*t.stride*4);
        } else if (isYuvFormat(t.format)) {
        } else if (isSupportedYuvFormat(t.format)) {
            // just show the Y plane of YUV buffers
            // just show the Y plane of YUV buffers
            glTexSubImage2D(GL_TEXTURE_2D, 0,
            glTexSubImage2D(GL_TEXTURE_2D, 0,
                    0, bounds.top, t.width, bounds.height(),
                    0, bounds.top, t.width, bounds.height(),
+2 −5
Original line number Original line Diff line number Diff line
@@ -59,16 +59,13 @@ status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info)
    // YUV format from the HAL are handled here
    // YUV format from the HAL are handled here
    switch (format) {
    switch (format) {
    case HAL_PIXEL_FORMAT_YCbCr_422_SP:
    case HAL_PIXEL_FORMAT_YCbCr_422_SP:
    case HAL_PIXEL_FORMAT_YCrCb_422_SP:
    case HAL_PIXEL_FORMAT_YCbCr_422_P:
    case HAL_PIXEL_FORMAT_YCbCr_422_I:
    case HAL_PIXEL_FORMAT_YCbCr_422_I:
    case HAL_PIXEL_FORMAT_CbYCrY_422_I:
    case HAL_PIXEL_FORMAT_YV16:
        info->bitsPerPixel = 16;
        info->bitsPerPixel = 16;
        goto done;
        goto done;
    case HAL_PIXEL_FORMAT_YCbCr_420_SP:
    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
    case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
    case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
    case HAL_PIXEL_FORMAT_YCbCr_420_P:
    case HAL_PIXEL_FORMAT_YV12:
        info->bitsPerPixel = 12;
        info->bitsPerPixel = 12;
     done:
     done:
        info->format = format;
        info->format = format;