Revert "SkCodec: Add Android-only CodecPreference"
This reverts commit 0cc3972d96f6add9d948138958557addb34733f6.
Reason for revert: Breaking Android roll.
Original change's description:
> SkCodec: Add Android-only CodecPreference
>
> This allows the Android framework to choose a priority for HW or
> SW codecs for formats for which Android has both options (e.g.
> HEIF).
>
> Bug: b/240347107
> Change-Id: Ia804027d729dc0ff3b2dea947642df64fbc32bbc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/573639
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>
Bug: b/240347107
Change-Id: I06f018ef34bfba83408fa39c59b348bb9b631ab5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/583962
Reviewed-by: Brian Osman <brianosman@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index fe34f94..5af847a 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -284,40 +284,6 @@
};
/**
- * Codec selection order for H/W first, H/W only, S/W first, or S/W only.
- *
- * Currently this is only used for HEIF decoding.
- *
- * The default is kNoPreference, representing no order preference and the decision order
- * will be device specific.
- */
- enum class CodecPreference {
- /**
- * No order preference specified, and decoder/encoder will be selected according to the
- * default order, which is decided by devices.
- */
- kNoPreference = 0,
- /**
- * Prefer software codec first. Software codec will be checked first, if no software
- * codec can decode the given content format, hardware codec will then be checked.
- */
- kPreferSoftwareCodecs = 1,
- /**
- * Only use hardware codec.
- */
- kOnlyHardwareCodecs = 2,
- /**
- * Prefer hardware codec first. Hardware codec will be checked first, if no hardware
- * codec can decode the given content format, software codec will then be checked.
- */
- kPreferHardwareCodecs = 4,
- /**
- * Only use software codec.
- */
- kOnlySoftwareCodecs = 8,
- };
-
- /**
* Additional options to pass to getPixels.
*/
struct Options {
@@ -326,7 +292,6 @@
, fSubset(nullptr)
, fFrameIndex(0)
, fPriorFrame(kNoFrame)
- , fCodecPreference(CodecPreference::kNoPreference)
{}
ZeroInitialized fZeroInitialized;
@@ -370,16 +335,6 @@
* If set to kNoFrame, the codec will decode any necessary required frame(s) first.
*/
int fPriorFrame;
-
- /**
- * Codec selection order for H/W first, H/W only, S/W first, or S/W only.
- *
- * Currently this is only used for HEIF decoding.
- *
- * The default is kNoPreference, representing no order preference and the decision order
- * will be device specific.
- */
- CodecPreference fCodecPreference;
};
/**
diff --git a/src/codec/SkHeifCodec.cpp b/src/codec/SkHeifCodec.cpp
index 583e156..63bd9bd 100644
--- a/src/codec/SkHeifCodec.cpp
+++ b/src/codec/SkHeifCodec.cpp
@@ -19,17 +19,6 @@
#define FOURCC(c1, c2, c3, c4) \
((c1) << 24 | (c2) << 16 | (c3) << 8 | (c4))
-static_assert((int)SkCodec::CodecPreference::kNoPreference ==
- kHeifCodecPreference_none, "CodecPreference mismatch!");
-static_assert((int)SkCodec::CodecPreference::kPreferSoftwareCodecs ==
- kHeifCodecPreference_preferSoftwareCodecs, "CodecPreference mismatch!");
-static_assert((int)SkCodec::CodecPreference::kOnlyHardwareCodecs ==
- kHeifCodecPreference_onlyHardwareCodecs, "CodecPreference mismatch!");
-static_assert((int)SkCodec::CodecPreference::kPreferHardwareCodecs ==
- kHeifCodecPreference_preferHardwareCodecs, "CodecPreference mismatch!");
-static_assert((int)SkCodec::CodecPreference::kOnlySoftwareCodecs ==
- kHeifCodecPreference_onlySoftwareCodecs, "CodecPreference mismatch!");
-
bool SkHeifCodec::IsSupported(const void* buffer, size_t bytesRead,
SkEncodedImageFormat* format) {
// Parse the ftyp box up to bytesRead to determine if this is HEIF or AVIF.
@@ -401,8 +390,6 @@
return kUnimplemented;
}
- fHeifDecoder->setCodecPreference((int)options.fCodecPreference);
-
bool success;
if (fUseAnimation) {
success = fHeifDecoder->decodeSequence(options.fFrameIndex, &fFrameInfo);
diff --git a/src/codec/SkStubHeifDecoderAPI.h b/src/codec/SkStubHeifDecoderAPI.h
index 510efe6..3fcdc94 100644
--- a/src/codec/SkStubHeifDecoderAPI.h
+++ b/src/codec/SkStubHeifDecoderAPI.h
@@ -22,14 +22,6 @@
kHeifColorFormat_RGBA_1010102,
};
-enum HeifCodecPreference {
- kHeifCodecPreference_none = 0,
- kHeifCodecPreference_preferSoftwareCodecs = 1,
- kHeifCodecPreference_onlyHardwareCodecs = 2,
- kHeifCodecPreference_preferHardwareCodecs = 4,
- kHeifCodecPreference_onlySoftwareCodecs = 8,
-};
-
struct HeifStream {
virtual ~HeifStream() {}
@@ -82,10 +74,6 @@
uint32_t getColorDepth() {
return 0;
}
-
- void setCodecPreference(int codecPreference) {
-
- }
};
static inline HeifDecoder* createHeifDecoder() { return new HeifDecoder; }