]> granicus.if.org Git - libvpx/commitdiff
Revert "Add support for setting byte alignment."
authorPaul Wilkins <paulwilkins@google.com>
Mon, 15 Dec 2014 11:52:55 +0000 (11:52 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Mon, 15 Dec 2014 11:54:13 +0000 (11:54 +0000)
Fails to compile. Bad calls to vp9_alloc_frame_buffer
and vp9_realloc_frame_buffer in postproc.c

This reverts commit 399823b6f50fb7465f62822d1395e2192e7b07fc.

Change-Id: I29f0e173f8e185d3a303cfdb17813e1eccb51e3a

15 files changed:
test/byte_alignment_test.cc [deleted file]
test/decode_test_driver.h
test/test.mk
vp9/common/vp9_alloccommon.c
vp9/common/vp9_onyxc_int.h
vp9/decoder/vp9_decodeframe.c
vp9/encoder/vp9_denoiser.c
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_lookahead.c
vp9/encoder/vp9_svc_layercontext.c
vp9/encoder/vp9_temporal_filter.c
vp9/vp9_dx_iface.c
vpx/vp8dx.h
vpx_scale/generic/yv12config.c
vpx_scale/yv12config.h

diff --git a/test/byte_alignment_test.cc b/test/byte_alignment_test.cc
deleted file mode 100644 (file)
index aa4b78b..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <string>
-
-#include "./vpx_config.h"
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "test/md5_helper.h"
-#include "test/util.h"
-#if CONFIG_WEBM_IO
-#include "test/webm_video_source.h"
-#endif
-
-namespace {
-
-const int kLegacyByteAlignment = 0;
-const int kLegacyYPlaneByteAlignment = 32;
-const int kNumPlanesToCheck = 3;
-const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
-const char kVP9Md5File[] = "vp90-2-02-size-lf-1920x1080.webm.md5";
-
-#if CONFIG_WEBM_IO
-
-struct ByteAlignmentTestParam {
-  int byte_alignment;
-  vpx_codec_err_t expected_value;
-  bool decode_remaining;
-};
-
-const ByteAlignmentTestParam kBaTestParams[] = {
-  {kLegacyByteAlignment, VPX_CODEC_OK, true},
-  {32, VPX_CODEC_OK, true},
-  {64, VPX_CODEC_OK, true},
-  {128, VPX_CODEC_OK, true},
-  {256, VPX_CODEC_OK, true},
-  {512, VPX_CODEC_OK, true},
-  {1024, VPX_CODEC_OK, true},
-  {1, VPX_CODEC_INVALID_PARAM, false},
-  {-2, VPX_CODEC_INVALID_PARAM, false},
-  {4, VPX_CODEC_INVALID_PARAM, false},
-  {16, VPX_CODEC_INVALID_PARAM, false},
-  {255, VPX_CODEC_INVALID_PARAM, false},
-  {2048, VPX_CODEC_INVALID_PARAM, false},
-};
-
-// Class for testing byte alignment of reference buffers.
-class ByteAlignmentTest
-    : public ::testing::TestWithParam<ByteAlignmentTestParam> {
- protected:
-  ByteAlignmentTest()
-      : video_(NULL),
-        decoder_(NULL),
-        md5_file_(NULL) {}
-
-  virtual void SetUp() {
-    video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
-    ASSERT_TRUE(video_ != NULL);
-    video_->Init();
-    video_->Begin();
-
-    const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
-    decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
-    ASSERT_TRUE(decoder_ != NULL);
-
-    OpenMd5File(kVP9Md5File);
-  }
-
-  virtual void TearDown() {
-    if (md5_file_ != NULL)
-      fclose(md5_file_);
-
-    delete decoder_;
-    delete video_;
-  }
-
-  void SetByteAlignment(int byte_alignment, vpx_codec_err_t expected_value) {
-    decoder_->Control(VP9_SET_BYTE_ALIGNMENT, byte_alignment, expected_value);
-  }
-
-  vpx_codec_err_t DecodeOneFrame(int byte_alignment_to_check) {
-    const vpx_codec_err_t res =
-        decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
-    CheckDecodedFrames(byte_alignment_to_check);
-    if (res == VPX_CODEC_OK)
-      video_->Next();
-    return res;
-  }
-
-  vpx_codec_err_t DecodeRemainingFrames(int byte_alignment_to_check) {
-    for (; video_->cxdata() != NULL; video_->Next()) {
-      const vpx_codec_err_t res =
-          decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
-      if (res != VPX_CODEC_OK)
-        return res;
-      CheckDecodedFrames(byte_alignment_to_check);
-    }
-    return VPX_CODEC_OK;
-  }
-
- private:
-  // Check if |data| is aligned to |byte_alignment_to_check|.
-  // |byte_alignment_to_check| must be a power of 2.
-  void CheckByteAlignment(const uint8_t *data, int byte_alignment_to_check) {
-    ASSERT_EQ(0u, reinterpret_cast<size_t>(data) % byte_alignment_to_check);
-  }
-
-  // Iterate through the planes of the decoded frames and check for
-  // alignment based off |byte_alignment_to_check|.
-  void CheckDecodedFrames(int byte_alignment_to_check) {
-    libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
-    const vpx_image_t *img;
-
-    // Get decompressed data
-    while ((img = dec_iter.Next()) != NULL) {
-      if (byte_alignment_to_check == kLegacyByteAlignment) {
-        CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment);
-      } else {
-        for (int i = 0; i < kNumPlanesToCheck; ++i) {
-          CheckByteAlignment(img->planes[i], byte_alignment_to_check);
-        }
-      }
-      CheckMd5(*img);
-    }
-  }
-
-  // TODO(fgalligan): Move the MD5 testing code into another class.
-  void OpenMd5File(const std::string &md5_file_name_) {
-    md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
-    ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
-        << md5_file_name_;
-  }
-
-  void CheckMd5(const vpx_image_t &img) {
-    ASSERT_TRUE(md5_file_ != NULL);
-    char expected_md5[33];
-    char junk[128];
-
-    // Read correct md5 checksums.
-    const int res = fscanf(md5_file_, "%s  %s", expected_md5, junk);
-    ASSERT_NE(EOF, res) << "Read md5 data failed";
-    expected_md5[32] = '\0';
-
-    ::libvpx_test::MD5 md5_res;
-    md5_res.Add(&img);
-    const char *const actual_md5 = md5_res.Get();
-
-    // Check md5 match.
-    ASSERT_STREQ(expected_md5, actual_md5) << "MD5 checksums don't match";
-  }
-
-  libvpx_test::WebMVideoSource *video_;
-  libvpx_test::VP9Decoder *decoder_;
-  FILE *md5_file_;
-};
-
-TEST_F(ByteAlignmentTest, SwitchByteAlignment) {
-  const int num_elements = 14;
-  const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,
-                                  0, 1024, 32, 512, 64, 256, 128 };
-
-  for (int i = 0; i < num_elements; ++i) {
-    SetByteAlignment(byte_alignments[i], VPX_CODEC_OK);
-    ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame(byte_alignments[i]));
-  }
-  SetByteAlignment(byte_alignments[0], VPX_CODEC_OK);
-  ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames(byte_alignments[0]));
-}
-
-TEST_P(ByteAlignmentTest, TestAlignment) {
-  const ByteAlignmentTestParam t = GetParam();
-  SetByteAlignment(t.byte_alignment, t.expected_value);
-  if (t.decode_remaining)
-    ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames(t.byte_alignment));
-}
-
-INSTANTIATE_TEST_CASE_P(Alignments, ByteAlignmentTest,
-                        ::testing::ValuesIn(kBaTestParams));
-
-#endif  // CONFIG_WEBM_IO
-
-}  // namespace
index f566c53c7d30e5d129dfd0abd804249044d56cb3..232428eb0ef8dfae3cccdd8bc964aefc950da278 100644 (file)
@@ -72,19 +72,15 @@ class Decoder {
   }
 
   void Control(int ctrl_id, int arg) {
-    Control(ctrl_id, arg, VPX_CODEC_OK);
-  }
-
-  void Control(int ctrl_id, const void *arg) {
     InitOnce();
     const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
     ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
   }
 
-  void Control(int ctrl_id, int arg, vpx_codec_err_t expected_value) {
+  void Control(int ctrl_id, const void *arg) {
     InitOnce();
     const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
-    ASSERT_EQ(expected_value, res) << DecodeError();
+    ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
   }
 
   const char* DecodeError() {
index bd65759c56bee9fc04581598e1b2f296e1f37c6e..6e935defdea29523f725f37b8f0250e59f8f8084 100644 (file)
@@ -31,7 +31,6 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
 
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += byte_alignment_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += invalid_file_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += user_priv_test.cc
index a9c44f96faf9a73cfed04ae680d8c6ffe0f8069f..cad57501ac8cea7997500814fab0c6db9c61f01c 100644 (file)
@@ -112,8 +112,7 @@ int vp9_alloc_ref_frame_buffers(VP9_COMMON *cm, int width, int height) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               VP9_ENC_BORDER_IN_PIXELS,
-                               cm->byte_alignment) < 0)
+                               VP9_ENC_BORDER_IN_PIXELS) < 0)
       goto fail;
     if (cm->frame_bufs[i].mvs == NULL) {
       cm->frame_bufs[i].mvs =
index bba24e03b0762fbba20ed024771a5575e54a1b2e..c166590e27a4255f31e1be00a2a68c0baacb0619 100644 (file)
@@ -208,7 +208,6 @@ typedef struct VP9Common {
   int frame_parallel_decoding_mode;
 
   int log2_tile_cols, log2_tile_rows;
-  int byte_alignment;
 
   // Private data associated with the frame buffer callbacks.
   void *cb_priv;
index 6eb9026a9ea723d2136b8dd20bd294bb2b62e5eb..58df87d0cb060bc67b7aeff3ede1cc43509ab4fb 100644 (file)
@@ -719,7 +719,6 @@ static void setup_frame_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
           cm->use_highbitdepth,
 #endif
           VP9_DEC_BORDER_IN_PIXELS,
-          cm->byte_alignment,
           &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb,
           cm->cb_priv)) {
     vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
@@ -794,7 +793,6 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
           cm->use_highbitdepth,
 #endif
           VP9_DEC_BORDER_IN_PIXELS,
-          cm->byte_alignment,
           &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb,
           cm->cb_priv)) {
     vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
index 56ec6b335d290378745af4c0e15ebaab9078f419..4deeed2170c7ecf00ce4f03e788384cbc143a1d9 100644 (file)
@@ -425,7 +425,6 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
 #endif
                        int border) {
   int i, fail;
-  const int legacy_byte_alignment = 0;
   assert(denoiser != NULL);
 
   for (i = 0; i < MAX_REF_FRAMES; ++i) {
@@ -434,7 +433,7 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
 #if CONFIG_VP9_HIGHBITDEPTH
                                   use_highbitdepth,
 #endif
-                                  border, legacy_byte_alignment);
+                                  border);
     if (fail) {
       vp9_denoiser_free(denoiser);
       return 1;
@@ -449,7 +448,7 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
 #if CONFIG_VP9_HIGHBITDEPTH
                                 use_highbitdepth,
 #endif
-                                border, legacy_byte_alignment);
+                                border);
   if (fail) {
     vp9_denoiser_free(denoiser);
     return 1;
index a7f34a2e44366bc6b0138a6cc005ebcd9da09bce..aaa6b238dc6082a4e10bcec0d41ef60e49d908f8 100644 (file)
@@ -491,8 +491,7 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
     vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate altref buffer");
 }
@@ -512,8 +511,7 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
     vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate last frame buffer");
 
@@ -523,8 +521,7 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
     vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate scaled source buffer");
 
@@ -534,8 +531,7 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
     vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                        "Failed to allocate scaled last source buffer");
 }
@@ -571,8 +567,7 @@ static void update_frame_size(VP9_COMP *cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                  cm->use_highbitdepth,
 #endif
-                                 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                                 NULL, NULL, NULL))
+                                 VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
       vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                          "Failed to reallocate alt_ref_buffer");
   }
@@ -2478,8 +2473,7 @@ void vp9_scale_references(VP9_COMP *cpi) {
                                  cm->width, cm->height,
                                  cm->subsampling_x, cm->subsampling_y,
                                  cm->use_highbitdepth,
-                                 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                                 NULL, NULL, NULL);
+                                 VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
         scale_and_extend_frame(ref, &cm->frame_bufs[new_fb].buf,
                                (int)cm->bit_depth);
 #else
@@ -2488,8 +2482,7 @@ void vp9_scale_references(VP9_COMP *cpi) {
         vp9_realloc_frame_buffer(&cm->frame_bufs[new_fb].buf,
                                  cm->width, cm->height,
                                  cm->subsampling_x, cm->subsampling_y,
-                                 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                                 NULL, NULL, NULL);
+                                 VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
         scale_and_extend_frame(ref, &cm->frame_bufs[new_fb].buf);
 #endif  // CONFIG_VP9_HIGHBITDEPTH
         cpi->scaled_ref_idx[ref_frame - 1] = new_fb;
@@ -2728,8 +2721,7 @@ void set_frame_size(VP9_COMP *cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                            cm->use_highbitdepth,
 #endif
-                           VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                           NULL, NULL, NULL);
+                           VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
 
   alloc_util_frame_buffers(cpi);
   init_motion_estimation(cpi);
index 708072ee2cb3fe5dc8cccd2e3072350d20233913..823e7a1624200061e2d8660905baa6db8e56a4d2 100644 (file)
@@ -65,7 +65,6 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
   // Allocate the lookahead structures
   ctx = calloc(1, sizeof(*ctx));
   if (ctx) {
-    const int legacy_byte_alignment = 0;
     unsigned int i;
     ctx->max_sz = depth;
     ctx->buf = calloc(depth, sizeof(*ctx->buf));
@@ -77,8 +76,7 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
 #if CONFIG_VP9_HIGHBITDEPTH
                                  use_highbitdepth,
 #endif
-                                 VP9_ENC_BORDER_IN_PIXELS,
-                                 legacy_byte_alignment))
+                                 VP9_ENC_BORDER_IN_PIXELS))
         goto bail;
   }
   return ctx;
index 31e93be652c46371151553d18112cba10d89ee56..184322f4fa44347a212716f3e7df1748f2c9c160 100644 (file)
@@ -39,9 +39,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                  cpi->common.use_highbitdepth,
 #endif
-                                 VP9_ENC_BORDER_IN_PIXELS,
-                                 cpi->common.byte_alignment,
-                                 NULL, NULL, NULL))
+                                 VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
         vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
                            "Failed to allocate empty frame for multiple frame "
                            "contexts");
index 424cc0843b4cf6368cd6e6b4190b72c2f464b2f2..a4051f05e97b0335fb7403f08c3474af0884c004 100644 (file)
@@ -710,9 +710,8 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
 #if CONFIG_VP9_HIGHBITDEPTH
                                        cm->use_highbitdepth,
 #endif
-                                       VP9_ENC_BORDER_IN_PIXELS,
-                                       cm->byte_alignment,
-                                       NULL, NULL, NULL)) {
+                                       VP9_ENC_BORDER_IN_PIXELS, NULL, NULL,
+                                       NULL)) {
             vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                                "Failed to reallocate alt_ref_buffer");
           }
index 43bf35f9c5756225d22a7d6e78734705210a605d..80951400127ac63d397d50db3b009c21be39a408 100644 (file)
@@ -44,7 +44,6 @@ struct vpx_codec_alg_priv {
   int                     flushed;
   int                     invert_tile_order;
   int                     frame_parallel_decode;  // frame-based threading.
-  int                     byte_alignment;
 
   // External frame buffer info to save for VP9 common.
   void *ext_priv;  // Private data associated with the external frame buffers.
@@ -220,7 +219,6 @@ static void init_buffer_callbacks(vpx_codec_alg_priv_t *ctx) {
   VP9_COMMON *const cm = &ctx->pbi->common;
 
   cm->new_fb_idx = -1;
-  cm->byte_alignment = ctx->byte_alignment;
 
   if (ctx->get_ext_fb_cb != NULL && ctx->release_ext_fb_cb != NULL) {
     cm->get_fb_cb = ctx->get_ext_fb_cb;
@@ -619,27 +617,6 @@ static vpx_codec_err_t ctrl_set_decryptor(vpx_codec_alg_priv_t *ctx,
   return VPX_CODEC_OK;
 }
 
-static vpx_codec_err_t ctrl_set_byte_alignment(vpx_codec_alg_priv_t *ctx,
-                                               va_list args) {
-  const int legacy_byte_alignment = 0;
-  const int min_byte_alignment = 32;
-  const int max_byte_alignment = 1024;
-  const int byte_alignment = va_arg(args, int);
-
-  if (byte_alignment != legacy_byte_alignment &&
-      (byte_alignment < min_byte_alignment ||
-       byte_alignment > max_byte_alignment ||
-       (byte_alignment & (byte_alignment - 1)) != 0))
-    return VPX_CODEC_INVALID_PARAM;
-
-  ctx->byte_alignment = byte_alignment;
-  if (ctx->pbi != NULL) {
-    VP9_COMMON *const cm = &ctx->pbi->common;
-    cm->byte_alignment = byte_alignment;
-  }
-  return VPX_CODEC_OK;
-}
-
 static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
   {VP8_COPY_REFERENCE,            ctrl_copy_reference},
 
@@ -652,7 +629,6 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
   {VP8_SET_DBG_DISPLAY_MV,        ctrl_set_dbg_options},
   {VP9_INVERT_TILE_DECODE_ORDER,  ctrl_set_invert_tile_order},
   {VPXD_SET_DECRYPTOR,            ctrl_set_decryptor},
-  {VP9_SET_BYTE_ALIGNMENT,        ctrl_set_byte_alignment},
 
   // Getters
   {VP8D_GET_LAST_REF_UPDATES,     ctrl_get_last_ref_updates},
index 5cc25cd6a1b951e3e6330dfc7889fe937d56e6f5..379b3062089cf11a7513fd2db5a4d715ca32fabd 100644 (file)
@@ -78,13 +78,6 @@ enum vp8_dec_control_id {
   /** control function to get the bit depth of the stream. */
   VP9D_GET_BIT_DEPTH,
 
-  /** control function to set the byte alignment of the planes in the reference
-   * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
-   * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
-   * follows Y plane, and V plane directly follows U plane. Default value is 0.
-   */
-  VP9_SET_BYTE_ALIGNMENT,
-
   /** For testing. */
   VP9_INVERT_TILE_DECODE_ORDER,
 
index ff49ffb951d3d658e201de5df85528004238e717..00a8c163a6aca678bba21ee972e09a59973e5f23 100644 (file)
@@ -143,25 +143,22 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
                              int use_highbitdepth,
 #endif
                              int border,
-                             int byte_alignment,
                              vpx_codec_frame_buffer_t *fb,
                              vpx_get_frame_buffer_cb_fn_t cb,
                              void *cb_priv) {
   if (ybf) {
-    const int vp9_byte_align = (byte_alignment == 0) ? 1 : byte_alignment;
     const int aligned_width = (width + 7) & ~7;
     const int aligned_height = (height + 7) & ~7;
     const int y_stride = ((aligned_width + 2 * border) + 31) & ~31;
     const uint64_t yplane_size = (aligned_height + 2 * border) *
-                                 (uint64_t)y_stride + byte_alignment;
+                                 (uint64_t)y_stride;
     const int uv_width = aligned_width >> ss_x;
     const int uv_height = aligned_height >> ss_y;
     const int uv_stride = y_stride >> ss_x;
     const int uv_border_w = border >> ss_x;
     const int uv_border_h = border >> ss_y;
     const uint64_t uvplane_size = (uv_height + 2 * uv_border_h) *
-                                  (uint64_t)uv_stride + byte_alignment;
-
+                                  (uint64_t)uv_stride;
 #if CONFIG_ALPHA
     const int alpha_width = aligned_width;
     const int alpha_height = aligned_height;
@@ -169,7 +166,7 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
     const int alpha_border_w = border;
     const int alpha_border_h = border;
     const uint64_t alpha_plane_size = (alpha_height + 2 * alpha_border_h) *
-                                      (uint64_t)alpha_stride + byte_alignment;
+                                      (uint64_t)alpha_stride;
 #if CONFIG_VP9_HIGHBITDEPTH
     const uint64_t frame_size = (1 + use_highbitdepth) *
         (yplane_size + 2 * uvplane_size + alpha_plane_size);
@@ -185,9 +182,6 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
     const uint64_t frame_size = yplane_size + 2 * uvplane_size;
 #endif  // CONFIG_VP9_HIGHBITDEPTH
 #endif  // CONFIG_ALPHA
-
-    uint8_t *buf = NULL;
-
     if (cb != NULL) {
       const int align_addr_extra_size = 31;
       const uint64_t external_frame_size = frame_size + align_addr_extra_size;
@@ -250,33 +244,38 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
     ybf->subsampling_x = ss_x;
     ybf->subsampling_y = ss_y;
 
-    buf = ybf->buffer_alloc;
 #if CONFIG_VP9_HIGHBITDEPTH
     if (use_highbitdepth) {
       // Store uint16 addresses when using 16bit framebuffers
-      buf = CONVERT_TO_BYTEPTR(ybf->buffer_alloc);
+      uint8_t *p = CONVERT_TO_BYTEPTR(ybf->buffer_alloc);
+      ybf->y_buffer = p + (border * y_stride) + border;
+      ybf->u_buffer = p + yplane_size +
+          (uv_border_h * uv_stride) + uv_border_w;
+      ybf->v_buffer = p + yplane_size + uvplane_size +
+          (uv_border_h * uv_stride) + uv_border_w;
       ybf->flags = YV12_FLAG_HIGHBITDEPTH;
     } else {
+      ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
+      ybf->u_buffer = ybf->buffer_alloc + yplane_size +
+          (uv_border_h * uv_stride) + uv_border_w;
+      ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size +
+          (uv_border_h * uv_stride) + uv_border_w;
       ybf->flags = 0;
     }
+#else
+    ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
+    ybf->u_buffer = ybf->buffer_alloc + yplane_size +
+                    (uv_border_h * uv_stride) + uv_border_w;
+    ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size +
+                    (uv_border_h * uv_stride) + uv_border_w;
 #endif  // CONFIG_VP9_HIGHBITDEPTH
 
-    ybf->y_buffer = (uint8_t *)yv12_align_addr(
-        buf + (border * y_stride) + border, vp9_byte_align);
-    ybf->u_buffer = (uint8_t *)yv12_align_addr(
-        buf + yplane_size + (uv_border_h * uv_stride) + uv_border_w,
-        vp9_byte_align);
-    ybf->v_buffer = (uint8_t *)yv12_align_addr(
-        buf + yplane_size + uvplane_size + (uv_border_h * uv_stride) +
-        uv_border_w, vp9_byte_align);
-
 #if CONFIG_ALPHA
     ybf->alpha_width = alpha_width;
     ybf->alpha_height = alpha_height;
     ybf->alpha_stride = alpha_stride;
-    ybf->alpha_buffer = (uint8_t *)yv12_align_addr(
-        buf + yplane_size + 2 * uvplane_size +
-        (alpha_border_h * alpha_stride) + alpha_border_w, vp9_byte_align);
+    ybf->alpha_buffer = ybf->buffer_alloc + yplane_size + 2 * uvplane_size +
+                        (alpha_border_h * alpha_stride) + alpha_border_w;
 #endif
     ybf->corrupted = 0; /* assume not corrupted by errors */
     return 0;
@@ -290,15 +289,14 @@ int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
 #if CONFIG_VP9_HIGHBITDEPTH
                            int use_highbitdepth,
 #endif
-                           int border,
-                           int byte_alignment) {
+                           int border) {
   if (ybf) {
     vp9_free_frame_buffer(ybf);
     return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y,
 #if CONFIG_VP9_HIGHBITDEPTH
                                     use_highbitdepth,
 #endif
-                                    border, byte_alignment, NULL, NULL, NULL);
+                                    border, NULL, NULL, NULL);
   }
   return -2;
 }
index f04dee1e817c9e9b51bf9dd76f3047da8e92c601..b9f13fd89188f8229b7c009412a9586a34bb9242 100644 (file)
@@ -73,10 +73,9 @@ int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
 #if CONFIG_VP9_HIGHBITDEPTH
                            int use_highbitdepth,
 #endif
-                           int border, int byte_alignment);
+                           int border);
 
-// Updates the yv12 buffer config with the frame buffer. |byte_alignment| must
-// be a power of 2, from 32 to 1024. 0 sets legacy alignment. If cb is not
+// Updates the yv12 buffer config with the frame buffer. If cb is not
 // NULL, then libvpx is using the frame buffer callbacks to handle memory.
 // If cb is not NULL, libvpx will call cb with minimum size in bytes needed
 // to decode the current frame. If cb is NULL, libvpx will allocate memory
@@ -88,7 +87,6 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
                              int use_highbitdepth,
 #endif
                              int border,
-                             int byte_alignment,
                              vpx_codec_frame_buffer_t *fb,
                              vpx_get_frame_buffer_cb_fn_t cb,
                              void *cb_priv);