Proposing an extension to the encoder and decoder interfaces.
authorStefan Holmer <holmer@google.com>
Fri, 10 Jun 2011 13:58:22 +0000 (15:58 +0200)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 28 Jun 2011 15:10:17 +0000 (11:10 -0400)
Adding capabilities with which the encoder can output frames
partition by partition, and the decoder can get input data
partition by partition.

Change-Id: Ieae0801480b8de8cd43c3c57dd3bab2e4c346fe0

vpx/src/vpx_decoder.c
vpx/src/vpx_encoder.c
vpx/vpx_decoder.h
vpx/vpx_encoder.h

index 42aedee..6e877b0 100644 (file)
@@ -39,6 +39,9 @@ vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t      *ctx,
     else if ((flags & VPX_CODEC_USE_ERROR_CONCEALMENT) &&
             !(iface->caps & VPX_CODEC_CAP_ERROR_CONCEALMENT))
         res = VPX_CODEC_INCAPABLE;
+    else if ((flags & VPX_CODEC_USE_INPUT_PARTITION) &&
+            !(iface->caps & VPX_CODEC_CAP_INPUT_PARTITION))
+        res = VPX_CODEC_INCAPABLE;
     else if (!(iface->caps & VPX_CODEC_CAP_DECODER))
         res = VPX_CODEC_INCAPABLE;
     else
index dab7554..5e86835 100644 (file)
@@ -41,6 +41,9 @@ vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t      *ctx,
     else if ((flags & VPX_CODEC_USE_PSNR)
              && !(iface->caps & VPX_CODEC_CAP_PSNR))
         res = VPX_CODEC_INCAPABLE;
+    else if ((flags & VPX_CODEC_USE_OUTPUT_PARTITION)
+             && !(iface->caps & VPX_CODEC_CAP_OUTPUT_PARTITION))
+        res = VPX_CODEC_INCAPABLE;
     else
     {
         ctx->iface = iface;
index e50fd76..0fc38c6 100644 (file)
@@ -55,6 +55,8 @@ extern "C" {
 #define VPX_CODEC_CAP_POSTPROC   0x40000 /**< Can postprocess decoded frame */
 #define VPX_CODEC_CAP_ERROR_CONCEALMENT   0x80000 /**< Can conceal errors due to
                                                        packet loss */
+#define VPX_CODEC_CAP_INPUT_PARTITION   0x100000 /**< Can receive encoded frames
+                                                    one partition at a time */
 
     /*! \brief Initialization-time Feature Enabling
      *
@@ -66,6 +68,9 @@ extern "C" {
 #define VPX_CODEC_USE_POSTPROC   0x10000 /**< Postprocess decoded frame */
 #define VPX_CODEC_USE_ERROR_CONCEALMENT 0x20000 /**< Conceal errors in decoded
                                                      frames */
+#define VPX_CODEC_USE_INPUT_PARTITION   0x40000 /**< The input frame should be
+                                                    passed to the decoder one
+                                                    partition at a time */
 
     /*!\brief Stream properties
      *
@@ -184,6 +189,11 @@ extern "C" {
      * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
      * time stamp) order. Frames produced will always be in PTS (presentation
      * time stamp) order.
+     * If the decoder is configured with VPX_CODEC_USE_INPUT_PARTITION enabled,
+     * data and data_sz must contain at most one encoded partition. When no more
+     * data is available, this function should be called with NULL as data and 0
+     * as data_sz. The memory passed to this function must be available until
+     * the frame has been decoded.
      *
      * \param[in] ctx          Pointer to this instance's context
      * \param[in] data         Pointer to this block of new coded data. If
index 33433a7..d168d5c 100644 (file)
@@ -55,6 +55,13 @@ extern "C" {
      */
 #define VPX_CODEC_CAP_PSNR  0x10000 /**< Can issue PSNR packets */
 
+    /*! Can output one partition at a time. Each partition is returned in its
+     *  own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for
+     *  every partition but the last. In this mode all frames are always
+     *  returned partition by partition.
+     */
+#define VPX_CODEC_CAP_OUTPUT_PARTITION  0x20000
+
 
     /*! \brief Initialization-time Feature Enabling
      *
@@ -64,6 +71,8 @@ extern "C" {
      *  The available flags are specified by VPX_CODEC_USE_* defines.
      */
 #define VPX_CODEC_USE_PSNR  0x10000 /**< Calculate PSNR on each frame */
+#define VPX_CODEC_USE_OUTPUT_PARTITION  0x20000 /**< Make the encoder output one
+                                                     partition at a time. */
 
 
     /*!\brief Generic fixed size buffer structure
@@ -99,6 +108,8 @@ extern "C" {
                 this one) */
 #define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
     be shown */
+#define VPX_FRAME_IS_FRAGMENT  0x8 /**< this is a fragment of the encoded
+    frame */
 
     /*!\brief Error Resilient flags
      *