diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 03:18:28 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 03:18:28 +0000 |
commit | 2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589 (patch) | |
tree | 34122669bf4397a7c59156d6af5f47f49af08933 /media/video | |
parent | 1695f071610fc582b0bd9342cb13a4eae291707f (diff) | |
download | chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.zip chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.tar.gz chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.tar.bz2 |
Replace the use of an int32* with an explicit profile for decoder configuration.
Replaces the error-prone, overly-general, error-containing, and brittle
manually-terminated array-of-ints holding name/value pairs (except for names
that don't take values) with a simple profile parameter (specifying only information we
actually use today).
BUG=none
TEST=trybots, ovdatest, gles2
Review URL: http://codereview.chromium.org/7779001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/video')
-rw-r--r-- | media/video/video_decode_accelerator.h | 167 |
1 files changed, 22 insertions, 145 deletions
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index 799dca7..9a31bfd 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.h @@ -15,149 +15,6 @@ namespace media { -// Enumeration defining global dictionary ranges for various purposes that are -// used to handle the configurations of the video decoder. -// -// IMPORTANT! Dictionary keys and corresponding values MUST match the ones found -// in Pepper API dictionary for video (ppapi/c/dev/pp_video_dev.h)! -enum VideoAttributeKey { - VIDEOATTRIBUTEKEY_TERMINATOR = 0, - - VIDEOATTRIBUTEKEY_BITSTREAM_FORMAT_BASE = 0x100, - // Array of key/value pairs describing video configuration. - // It could include any keys from PP_VideoKey. Its last element shall be - // VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_NONE with no corresponding value. - // An example: - // { - // VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_FOURCC, PP_VIDEODECODECID_VP8, - // VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_VP8_PROFILE, (VP8PROFILE_1 | - // VP8PROFILE_2 | - // VP8PROFILE_3), - // VIDEOATTRIBUTEKEY_TERMINATOR - // }; - // Keys for defining video bitstream format. - // Value is type of PP_VideoCodecFourcc. Commonly known attributes values are - // defined in PP_VideoCodecFourcc enumeration. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_FOURCC, - // Bitrate in bits/s. Attribute value is 32-bit unsigned integer. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_BITRATE, - // Width and height of the input video bitstream, if known by the application. - // Decoder will expect the bitstream to match these values and does memory - // considerations accordingly. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_WIDTH, - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_HEIGHT, - // Following attributes are applicable only in case of VP8. - // Key for VP8 profile attribute. Attribute value is bitmask of flags defined - // in PP_VP8Profile_Dev enumeration. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_VP8_PROFILE, - // Number of partitions per picture. Attribute value is unsigned 32-bit - // integer. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_VP8_NUM_OF_PARTITIONS, - // Following attributes are applicable only in case of H.264. - // Value is bitmask collection from the flags defined in PP_H264Profile. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_PROFILE, - // Value is type of PP_H264Level. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_LEVEL, - // Value is type of PP_H264PayloadFormat_Dev. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_PAYLOADFORMAT, - // Subset for H.264 features, attribute value 0 signifies unsupported. - // This is needed in case decoder has partial support for certain profile. - // Default for features are enabled if they're part of supported profile. - // H264 tool called Flexible Macroblock Ordering. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_FMO, - // H264 tool called Arbitrary Slice Ordering. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_ASO, - // H264 tool called Interlacing. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_INTERLACE, - // H264 tool called Context-Adaptive Binary Arithmetic Coding. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_CABAC, - // H264 tool called Weighted Prediction. - VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_H264_FEATURE_WEIGHTEDPREDICTION, - - VIDEOATTRIBUTEKEY_COLOR_FORMAT_BASE = 0x1000, - // This specifies the output color format for a decoded frame. Value is one - // of the values in VideoColorFormat enumeration. - VIDEOATTRIBUTEKEY_VIDEOCOLORFORMAT, -}; - -enum VideoCodecFourcc { - VIDEOCODECFOURCC_NONE = 0, - VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. - VIDEOCODECFOURCC_H264 = 0x31637661, // a.k.a. Fourcc 'avc1'. -}; - -// VP8 specific information to be carried over the APIs. -// Enumeration for flags defining supported VP8 profiles. -enum VP8Profile { - VP8PROFILE_NONE = 0, - VP8PROFILE_0 = 1, - VP8PROFILE_1 = 1 << 1, - VP8PROFILE_2 = 1 << 2, - VP8PROFILE_3 = 1 << 3, -}; - -// H.264 specific information to be carried over the APIs. -// Enumeration for flags defining supported H.264 profiles. -enum H264Profile { - H264PROFILE_NONE = 0, - H264PROFILE_BASELINE = 1, - H264PROFILE_MAIN = 1 << 2, - H264PROFILE_EXTENDED = 1 << 3, - H264PROFILE_HIGH = 1 << 4, - H264PROFILE_HIGH10PROFILE = 1 << 5, - H264PROFILE_HIGH422PROFILE = 1 << 6, - H264PROFILE_HIGH444PREDICTIVEPROFILE = 1 << 7, - H264PROFILE_SCALABLEBASELINE = 1 << 8, - H264PROFILE_SCALABLEHIGH = 1 << 9, - H264PROFILE_STEREOHIGH = 1 << 10, - H264PROFILE_MULTIVIEWHIGH = 1 << 11, -}; - -// Enumeration for defining H.264 level of decoder implementation. -enum H264Level { - H264LEVEL_NONE = 0, - H264LEVEL_10 = 1, - H264LEVEL_1B = H264LEVEL_10 | 1 << 1, - H264LEVEL_11 = H264LEVEL_1B | 1 << 2, - H264LEVEL_12 = H264LEVEL_11 | 1 << 3, - H264LEVEL_13 = H264LEVEL_12 | 1 << 4, - H264LEVEL_20 = H264LEVEL_13 | 1 << 5, - H264LEVEL_21 = H264LEVEL_20 | 1 << 6, - H264LEVEL_22 = H264LEVEL_21 | 1 << 7, - H264LEVEL_30 = H264LEVEL_22 | 1 << 8, - H264LEVEL_31 = H264LEVEL_30 | 1 << 9, - H264LEVEL_32 = H264LEVEL_31 | 1 << 10, - H264LEVEL_40 = H264LEVEL_32 | 1 << 11, - H264LEVEL_41 = H264LEVEL_40 | 1 << 12, - H264LEVEL_42 = H264LEVEL_41 | 1 << 13, - H264LEVEL_50 = H264LEVEL_42 | 1 << 14, - H264LEVEL_51 = H264LEVEL_50 | 1 << 15, -}; - -// Enumeration to describe which payload format is used within the exchanged -// bitstream buffers. -enum H264PayloadFormat { - H264PAYLOADFORMAT_NONE = 0, - // NALUs separated by Start Code. - H264PAYLOADFORMAT_BYTESTREAM = 1, - // Exactly one raw NALU per buffer. - H264PAYLOADFORMAT_ONE_NALU_PER_BUFFER = 1 << 1, - // NALU separated by 1-byte interleaved length field. - H264PAYLOADFORMAT_ONE_BYTE_INTERLEAVED_LENGTH = 1 << 2, - // NALU separated by 2-byte interleaved length field. - H264PAYLOADFORMAT_TWO_BYTE_INTERLEAVED_LENGTH = 1 << 3, - // NALU separated by 4-byte interleaved length field. - H264PAYLOADFORMAT_FOUR_BYTE_INTERLEAVED_LENGTH = 1 << 4, -}; - -// Enumeration for various color formats. -enum VideoColorFormat { - // Value represents 32-bit RGBA format where each component is 8-bit in order - // R-G-B-A. Regardless of endianness of the architecture color components are - // stored in this order in the memory. - VIDEOCOLORFORMAT_RGBA = 0, -}; - // Video decoder interface. // This interface is extended by the various components that ultimately // implement the backend of PPB_VideoDecode_Dev. @@ -167,6 +24,26 @@ enum VideoColorFormat { class MEDIA_EXPORT VideoDecodeAccelerator : public base::RefCountedThreadSafe<VideoDecodeAccelerator> { public: + // Video stream profile. This *must* match PP_VideoDecoder_Profile. + enum Profile { + // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, + // for example), and keep the values for a particular format grouped + // together for clarity. + H264PROFILE_MIN = 0, + H264PROFILE_BASELINE = H264PROFILE_MIN, + H264PROFILE_MAIN, + H264PROFILE_EXTENDED, + H264PROFILE_HIGH, + H264PROFILE_HIGH10PROFILE, + H264PROFILE_HIGH422PROFILE, + H264PROFILE_HIGH444PREDICTIVEPROFILE, + H264PROFILE_SCALABLEBASELINE, + H264PROFILE_SCALABLEHIGH, + H264PROFILE_STEREOHIGH, + H264PROFILE_MULTIVIEWHIGH, + H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH, + }; + // Enumeration of potential errors generated by the API. // Note: Keep these in sync with PP_VideoDecodeError_Dev. enum Error { @@ -226,10 +103,10 @@ class MEDIA_EXPORT VideoDecodeAccelerator // Initializes the video decoder with specific configuration. // Parameters: - // |config| is the configuration on which the decoder should be initialized. + // |profile| is the video stream's format profile. // // Returns true when command successfully accepted. Otherwise false. - virtual bool Initialize(const std::vector<int32>& config) = 0; + virtual bool Initialize(Profile profile) = 0; // Decodes given bitstream buffer. Once decoder is done with processing // |bitstream_buffer| it will call NotifyEndOfBitstreamBuffer() with the |