Skip to content

Commit

Permalink
Remove NV12 texture support config
Browse files Browse the repository at this point in the history
The config is still only used for configuring tests, and can be
resolved at runtime.

b/150410605
  • Loading branch information
kaidokert committed Mar 25, 2024
1 parent c9844b0 commit 4858dde
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 91 deletions.
26 changes: 0 additions & 26 deletions cobalt/renderer/rasterizer/pixel_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@
#include "third_party/glm/glm/gtc/matrix_transform.hpp"
#include "third_party/glm/glm/gtx/transform.hpp"

#define NV12_TEXTURE_SUPPORTED 1

#if defined(STARBOARD)
#if !SB_HAS(NV12_TEXTURE_SUPPORT)
#undef NV12_TEXTURE_SUPPORTED
#define NV12_TEXTURE_SUPPORTED 0
#endif
#endif

using cobalt::loader::image::AnimatedWebPImage;
using cobalt::loader::image::MockImageDecoder;
using cobalt::loader::image::MockImageDecoderCallback;
Expand Down Expand Up @@ -1338,9 +1329,6 @@ scoped_refptr<Image> MakeI420Image(ResourceProvider* resource_provider,
std::move(image_memory), image_data_descriptor);
}

// The software rasterizer does not support NV12 images.
#if NV12_TEXTURE_SUPPORTED

// Creates a two plane YUV image where the Y channel is stored as a
// single-channel image plane and the U and V channels are interleaved in a
// second image plane. The NV12 format dictates that the UV plane has the same
Expand Down Expand Up @@ -1404,7 +1392,6 @@ scoped_refptr<Image> MakeNV12Image(ResourceProvider* resource_provider,
return resource_provider->CreateMultiPlaneImageFromRawMemory(
std::move(image_memory), image_data_descriptor);
}
#endif // #if NV12_TEXTURE_SUPPORTED
} // namespace

scoped_refptr<Image> MakeUYVYImage(ResourceProvider* resource_provider,
Expand Down Expand Up @@ -1568,9 +1555,6 @@ TEST_F(PixelTest, YUV422UYVYImageScaledAndTranslated) {
-1.0f, 0.0f, 0.0f, 1.0f)));
}

// The software rasterizer does not support NV12 images.
#if NV12_TEXTURE_SUPPORTED

TEST_F(PixelTest, TwoPlaneYUVImageSupport) {
// Tests that an ImageNode hooked up to a 3-plane YUV image works fine.
scoped_refptr<Image> image =
Expand All @@ -1597,7 +1581,6 @@ TEST_F(PixelTest, TwoPlaneYUVImageWithTransform) {
TranslateMatrix(-half_output_size.width(),
-half_output_size.height())));
}
#endif // #if NV12_TEXTURE_SUPPORTED

TEST_F(PixelTest, ImageNodeLocalTransformRotationAndScale) {
scoped_refptr<Image> image =
Expand Down Expand Up @@ -2094,18 +2077,13 @@ TEST_F(PixelTest, YUV3PlaneImagesAreLinearlyInterpolated) {
TestTree(new ImageNode(image, RectF(output_surface_size())));
}

// The software rasterizer does not support NV12 images.
#if NV12_TEXTURE_SUPPORTED

TEST_F(PixelTest, YUV2PlaneImagesAreLinearlyInterpolated) {
// Tests that two plane YUV images are bilinearly interpolated.
scoped_refptr<Image> image = MakeNV12Image(GetResourceProvider(), Size(8, 8));

TestTree(new ImageNode(image, RectF(output_surface_size())));
}

#endif // #if NV12_TEXTURE_SUPPORTED

TEST_F(PixelTest, VeryLargeOpacityFilterDoesNotOccupyVeryMuchMemory) {
// This test ensures that an opacity filter being applied to an extremely
// large surface works just fine. This test is interesting because opacity
Expand Down Expand Up @@ -4059,17 +4037,13 @@ TEST_F(PixelTest, MapToMeshRGBTest) {
TestTree(CreateMapToMeshTestRenderTree(GetResourceProvider(), image));
}

#if NV12_TEXTURE_SUPPORTED

TEST_F(PixelTest, MapToMeshNV12Test) {
// Tests that MapToMesh filter works as expected with a NV12 YUV texture.
scoped_refptr<Image> image =
MakeNV12Image(GetResourceProvider(), Size(200, 200));
TestTree(CreateMapToMeshTestRenderTree(GetResourceProvider(), image));
}

#endif // #if NV12_TEXTURE_SUPPORTED

TEST_F(PixelTest, MapToMeshI420Test) {
// Tests that MapToMesh filter works as expected with a I420 YUV texture.
scoped_refptr<Image> image =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Book: /youtube/cobalt/_book.yaml

| Properties |
| :--- |
| **`SB_HAS_NV12_TEXTURE_SUPPORT`**<br><br>Indicates whether or not the given platform supports rendering of NV12 textures. These textures typically originate from video decoders.<br><br>The default value in the Stub implementation is `0` |
| **`SB_HAS_VIRTUAL_REALITY`**<br><br>The default value in the Stub implementation is `1` |


Expand Down
3 changes: 3 additions & 0 deletions starboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ since the version previous to it.
SB_HAS_GLES2 configuration has been removed, and `gl_type` GN config no longer
accepts `none` as an option.

### Removed SB_HAS_NV12_TEXTURE_SUPPORT
This flag is resolved at run-time.

### Removed pre-C++11 hash map configuration
Build configurations for `SB_HAS_STD_UNORDERED_HASH`, `SB_HAS_LONG_LONG_HASH`,
`SB_HAS_STRING_HASH`, `SB_HAS_HASH_USING`, `SB_HAS_HASH_VALUE`,
Expand Down
6 changes: 0 additions & 6 deletions starboard/android/shared/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- I/O Configuration -----------------------------------------------------
// Whether the current platform has speech synthesis.
#define SB_HAS_SPEECH_SYNTHESIS 1
Expand Down
4 changes: 0 additions & 4 deletions starboard/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,6 @@ struct CompileAssert {};
"starboard/<PLATFORM_PATH>/configuration_constants.cc."
#endif

#if !defined(SB_HAS_NV12_TEXTURE_SUPPORT)
#error "Your platform must define SB_HAS_NV12_TEXTURE_SUPPORT."
#endif

#if defined(SB_HAS_MEDIA_IS_VIDEO_SUPPORTED_REFINEMENT)
#error \
"SB_HAS_MEDIA_IS_VIDEO_SUPPORTED_REFINEMENT should not be defined for " \
Expand Down
6 changes: 0 additions & 6 deletions starboard/evergreen/arm/hardfp/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- I/O Configuration -----------------------------------------------------

// Whether the current platform implements the on screen keyboard interface.
Expand Down
6 changes: 0 additions & 6 deletions starboard/evergreen/arm/softfp/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- I/O Configuration -----------------------------------------------------

// Whether the current platform has microphone supported.
Expand Down
6 changes: 0 additions & 6 deletions starboard/evergreen/arm64/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- I/O Configuration -----------------------------------------------------

// Whether the current platform has microphone supported.
Expand Down
6 changes: 0 additions & 6 deletions starboard/evergreen/x64/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 0

// --- I/O Configuration -----------------------------------------------------

// Whether the current platform implements the on screen keyboard interface.
Expand Down
6 changes: 0 additions & 6 deletions starboard/evergreen/x86/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- Decoder-only Params ---

// --- Memory Configuration --------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions starboard/linux/x64x11/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
// available on this platform. For a definitive measure, the application should
// still call SbSystemGetNumberOfProcessors at runtime.

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- Shared Configuration and Overrides ------------------------------------

// Include the Linux configuration that's common between all Desktop Linuxes.
Expand Down
6 changes: 0 additions & 6 deletions starboard/raspi/shared/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 1

// --- I/O Configuration -----------------------------------------------------

// Whether the current platform implements the on screen keyboard interface.
Expand Down
4 changes: 0 additions & 4 deletions starboard/stub/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 0

#define SB_HAS_VIRTUAL_REALITY 1

// --- I/O Configuration -----------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions starboard/win/shared/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 0

#define SB_HAS_VIRTUAL_REALITY 0

// --- I/O Configuration -----------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions starboard/xb1/shared/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports rendering of NV12
// textures. These textures typically originate from video decoders.
#define SB_HAS_NV12_TEXTURE_SUPPORT 0

#define SB_HAS_VIRTUAL_REALITY 0

// --- I/O Configuration -----------------------------------------------------
Expand Down

0 comments on commit 4858dde

Please sign in to comment.