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 24, 2024
1 parent a652624 commit 3474164
Show file tree
Hide file tree
Showing 15 changed files with 173 additions and 60 deletions.
25 changes: 0 additions & 25 deletions cobalt/renderer/rasterizer/pixel_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
#include "third_party/glm/glm/gtx/transform.hpp"

#define BILINEAR_FILTERING_SUPPORTED 1
#define NV12_TEXTURE_SUPPORTED 1

#if defined(STARBOARD)
#if !SB_HAS(BILINEAR_FILTERING_SUPPORT)
Expand All @@ -67,13 +66,6 @@
#endif
#endif

#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 @@ -1346,9 +1338,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 @@ -1412,7 +1401,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 @@ -1576,9 +1564,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 @@ -1605,7 +1590,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 @@ -2106,18 +2090,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 @@ -4071,17 +4050,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 @@ -9,6 +9,9 @@ since the version previous to it.

## Version 16

### 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
34 changes: 34 additions & 0 deletions starboard/evergreen/arm/hardfp/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Extensions Configuration ----------------------------------------------

// Do not use <unordered_map> and <unordered_set> for the hash table types.
#define SB_HAS_STD_UNORDERED_HASH 0

// GCC/Clang doesn't define a long long hash function, except for Android and
// Game consoles.
#define SB_HAS_LONG_LONG_HASH 0

// GCC/Clang doesn't define a string hash function, except for Game Consoles.
#define SB_HAS_STRING_HASH 0

// Desktop Linux needs a using statement for the hash functions.
#define SB_HAS_HASH_USING 0

// Set this to 1 if hash functions for custom types can be defined as a
// hash_value() function. Otherwise, they need to be placed inside a
// partially-specified hash struct template with an operator().
#define SB_HAS_HASH_VALUE 0

// Set this to 1 if use of hash_map or hash_set causes a deprecation warning
// (which then breaks the build).
#define SB_HAS_HASH_WARNING 1

// The location to include hash_map on this platform.
#define SB_HASH_MAP_INCLUDE <ext/hash_map>

// C++'s hash_map and hash_set are often found in different namespaces depending
// on the compiler.
#define SB_HASH_NAMESPACE __gnu_cxx

// The location to include hash_set on this platform.
#define SB_HASH_SET_INCLUDE <ext/hash_set>

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

// Indicates whether or not the given platform supports rendering of NV12
Expand Down
34 changes: 34 additions & 0 deletions starboard/evergreen/arm/softfp/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Extensions Configuration ----------------------------------------------

// Do not use <unordered_map> and <unordered_set> for the hash table types.
#define SB_HAS_STD_UNORDERED_HASH 0

// GCC/Clang doesn't define a long long hash function, except for Android and
// Game consoles.
#define SB_HAS_LONG_LONG_HASH 0

// GCC/Clang doesn't define a string hash function, except for Game Consoles.
#define SB_HAS_STRING_HASH 0

// Desktop Linux needs a using statement for the hash functions.
#define SB_HAS_HASH_USING 0

// Set this to 1 if hash functions for custom types can be defined as a
// hash_value() function. Otherwise, they need to be placed inside a
// partially-specified hash struct template with an operator().
#define SB_HAS_HASH_VALUE 0

// Set this to 1 if use of hash_map or hash_set causes a deprecation warning
// (which then breaks the build).
#define SB_HAS_HASH_WARNING 1

// The location to include hash_map on this platform.
#define SB_HASH_MAP_INCLUDE <ext/hash_map>

// C++'s hash_map and hash_set are often found in different namespaces depending
// on the compiler.
#define SB_HASH_NAMESPACE __gnu_cxx

// The location to include hash_set on this platform.
#define SB_HASH_SET_INCLUDE <ext/hash_set>

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

// Indicates whether or not the given platform supports rendering of NV12
Expand Down
34 changes: 34 additions & 0 deletions starboard/evergreen/arm64/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Extensions Configuration ----------------------------------------------

// Do not use <unordered_map> and <unordered_set> for the hash table types.
#define SB_HAS_STD_UNORDERED_HASH 0

// GCC/Clang doesn't define a long long hash function, except for Android and
// Game consoles.
#define SB_HAS_LONG_LONG_HASH 0

// GCC/Clang doesn't define a string hash function, except for Game Consoles.
#define SB_HAS_STRING_HASH 0

// Desktop Linux needs a using statement for the hash functions.
#define SB_HAS_HASH_USING 0

// Set this to 1 if hash functions for custom types can be defined as a
// hash_value() function. Otherwise, they need to be placed inside a
// partially-specified hash struct template with an operator().
#define SB_HAS_HASH_VALUE 0

// Set this to 1 if use of hash_map or hash_set causes a deprecation warning
// (which then breaks the build).
#define SB_HAS_HASH_WARNING 1

// The location to include hash_map on this platform.
#define SB_HASH_MAP_INCLUDE <ext/hash_map>

// C++'s hash_map and hash_set are often found in different namespaces depending
// on the compiler.
#define SB_HASH_NAMESPACE __gnu_cxx

// The location to include hash_set on this platform.
#define SB_HASH_SET_INCLUDE <ext/hash_set>

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

// Indicates whether or not the given platform supports rendering of NV12
Expand Down
34 changes: 34 additions & 0 deletions starboard/evergreen/x64/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Extensions Configuration ----------------------------------------------

// Do not use <unordered_map> and <unordered_set> for the hash table types.
#define SB_HAS_STD_UNORDERED_HASH 0

// GCC/Clang doesn't define a long long hash function, except for Android and
// Game consoles.
#define SB_HAS_LONG_LONG_HASH 0

// GCC/Clang doesn't define a string hash function, except for Game Consoles.
#define SB_HAS_STRING_HASH 0

// Desktop Linux needs a using statement for the hash functions.
#define SB_HAS_HASH_USING 0

// Set this to 1 if hash functions for custom types can be defined as a
// hash_value() function. Otherwise, they need to be placed inside a
// partially-specified hash struct template with an operator().
#define SB_HAS_HASH_VALUE 0

// Set this to 1 if use of hash_map or hash_set causes a deprecation warning
// (which then breaks the build).
#define SB_HAS_HASH_WARNING 1

// The location to include hash_map on this platform.
#define SB_HASH_MAP_INCLUDE <ext/hash_map>

// C++'s hash_map and hash_set are often found in different namespaces depending
// on the compiler.
#define SB_HASH_NAMESPACE __gnu_cxx

// The location to include hash_set on this platform.
#define SB_HASH_SET_INCLUDE <ext/hash_set>

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

// Indicates whether or not the given platform supports rendering of NV12
Expand Down
34 changes: 34 additions & 0 deletions starboard/evergreen/x86/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Extensions Configuration ----------------------------------------------

// Do not use <unordered_map> and <unordered_set> for the hash table types.
#define SB_HAS_STD_UNORDERED_HASH 0

// GCC/Clang doesn't define a long long hash function, except for Android and
// Game consoles.
#define SB_HAS_LONG_LONG_HASH 0

// GCC/Clang doesn't define a string hash function, except for Game Consoles.
#define SB_HAS_STRING_HASH 0

// Desktop Linux needs a using statement for the hash functions.
#define SB_HAS_HASH_USING 0

// Set this to 1 if hash functions for custom types can be defined as a
// hash_value() function. Otherwise, they need to be placed inside a
// partially-specified hash struct template with an operator().
#define SB_HAS_HASH_VALUE 0

// Set this to 1 if use of hash_map or hash_set causes a deprecation warning
// (which then breaks the build).
#define SB_HAS_HASH_WARNING 1

// The location to include hash_map on this platform.
#define SB_HASH_MAP_INCLUDE <ext/hash_map>

// C++'s hash_map and hash_set are often found in different namespaces depending
// on the compiler.
#define SB_HASH_NAMESPACE __gnu_cxx

// The location to include hash_set on this platform.
#define SB_HASH_SET_INCLUDE <ext/hash_set>

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

// Indicates whether or not the given platform supports rendering of NV12
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
Loading

0 comments on commit 3474164

Please sign in to comment.