summaryrefslogtreecommitdiffstats
path: root/third_party/aom/aom_scale
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-19 21:52:15 -0500
committertrav90 <travawine@palemoon.org>2018-10-19 21:52:20 -0500
commitbbcc64772580c8a979288791afa02d30bc476d2e (patch)
tree437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/aom_scale
parent14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff)
downloadUXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/aom_scale')
-rw-r--r--third_party/aom/aom_scale/aom_scale.cmake51
-rw-r--r--third_party/aom/aom_scale/aom_scale.h2
-rw-r--r--third_party/aom/aom_scale/aom_scale.mk16
-rw-r--r--third_party/aom/aom_scale/aom_scale_rtcd.c6
-rw-r--r--third_party/aom/aom_scale/aom_scale_rtcd.pl32
-rw-r--r--third_party/aom/aom_scale/generic/aom_scale.c11
-rw-r--r--third_party/aom/aom_scale/generic/gen_scalers.c7
-rw-r--r--third_party/aom/aom_scale/generic/yv12config.c37
-rw-r--r--third_party/aom/aom_scale/generic/yv12extend.c148
-rw-r--r--third_party/aom/aom_scale/mips/dspr2/yv12extend_dspr2.c13
-rw-r--r--third_party/aom/aom_scale/yv12config.h37
11 files changed, 209 insertions, 151 deletions
diff --git a/third_party/aom/aom_scale/aom_scale.cmake b/third_party/aom/aom_scale/aom_scale.cmake
index 1c00b590e..197dea6bd 100644
--- a/third_party/aom/aom_scale/aom_scale.cmake
+++ b/third_party/aom/aom_scale/aom_scale.cmake
@@ -1,39 +1,38 @@
-##
-## Copyright (c) 2017, Alliance for Open Media. All rights reserved
-##
-## This source code is subject to the terms of the BSD 2 Clause License and
-## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-## was not distributed with this source code in the LICENSE file, you can
-## obtain it at www.aomedia.org/license/software. If the Alliance for Open
-## Media Patent License 1.0 was not distributed with this source code in the
-## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-##
-if (NOT AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
+#
+# Copyright (c) 2017, Alliance for Open Media. All rights reserved
+#
+# This source code is subject to the terms of the BSD 2 Clause License and the
+# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was
+# not distributed with this source code in the LICENSE file, you can obtain it
+# at www.aomedia.org/license/software. If the Alliance for Open Media Patent
+# License 1.0 was not distributed with this source code in the PATENTS file, you
+# can obtain it at www.aomedia.org/license/patent.
+#
+if(AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
+ return()
+endif() # AOM_AOM_SCALE_AOM_SCALE_CMAKE_
set(AOM_AOM_SCALE_AOM_SCALE_CMAKE_ 1)
-set(AOM_SCALE_SOURCES
- "${AOM_ROOT}/aom_scale/aom_scale.h"
- "${AOM_ROOT}/aom_scale/generic/aom_scale.c"
- "${AOM_ROOT}/aom_scale/generic/gen_scalers.c"
- "${AOM_ROOT}/aom_scale/generic/yv12config.c"
- "${AOM_ROOT}/aom_scale/generic/yv12extend.c"
- "${AOM_ROOT}/aom_scale/yv12config.h")
+list(APPEND AOM_SCALE_SOURCES "${AOM_ROOT}/aom_scale/aom_scale.h"
+ "${AOM_ROOT}/aom_scale/generic/aom_scale.c"
+ "${AOM_ROOT}/aom_scale/generic/gen_scalers.c"
+ "${AOM_ROOT}/aom_scale/generic/yv12config.c"
+ "${AOM_ROOT}/aom_scale/generic/yv12extend.c"
+ "${AOM_ROOT}/aom_scale/yv12config.h")
-set(AOM_SCALE_INTRIN_DSPR2
- "${AOM_ROOT}/aom_scale/mips/dspr2/yv12extend_dspr2.c")
+list(APPEND AOM_SCALE_INTRIN_DSPR2
+ "${AOM_ROOT}/aom_scale/mips/dspr2/yv12extend_dspr2.c")
# Creates the aom_scale build target and makes libaom depend on it. The libaom
# target must exist before this function is called.
-function (setup_aom_scale_targets)
+function(setup_aom_scale_targets)
add_library(aom_scale OBJECT ${AOM_SCALE_SOURCES})
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_scale>)
- if (HAVE_DSPR2)
+ if(HAVE_DSPR2)
add_intrinsics_object_library("" "dspr2" "aom_scale"
"AOM_SCALE_INTRIN_DSPR2" "aom")
- endif ()
+ endif()
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_scale PARENT_SCOPE)
-endfunction ()
-
-endif () # AOM_AOM_SCALE_AOM_SCALE_CMAKE_
+endfunction()
diff --git a/third_party/aom/aom_scale/aom_scale.h b/third_party/aom/aom_scale/aom_scale.h
index 6e089f5aa..a4aef6c65 100644
--- a/third_party/aom/aom_scale/aom_scale.h
+++ b/third_party/aom/aom_scale/aom_scale.h
@@ -18,6 +18,6 @@ extern void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
unsigned char *temp_area, unsigned char temp_height,
unsigned int hscale, unsigned int hratio,
unsigned int vscale, unsigned int vratio,
- unsigned int interlaced);
+ unsigned int interlaced, const int num_planes);
#endif // AOM_SCALE_AOM_SCALE_H_
diff --git a/third_party/aom/aom_scale/aom_scale.mk b/third_party/aom/aom_scale/aom_scale.mk
deleted file mode 100644
index e3a68cfcf..000000000
--- a/third_party/aom/aom_scale/aom_scale.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-SCALE_SRCS-yes += aom_scale.mk
-SCALE_SRCS-yes += yv12config.h
-SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING) += aom_scale.h
-SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING) += generic/aom_scale.c
-SCALE_SRCS-yes += generic/yv12config.c
-SCALE_SRCS-yes += generic/yv12extend.c
-SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING) += generic/gen_scalers.c
-SCALE_SRCS-yes += aom_scale_rtcd.c
-SCALE_SRCS-yes += aom_scale_rtcd.pl
-
-#mips(dspr2)
-SCALE_SRCS-$(HAVE_DSPR2) += mips/dspr2/yv12extend_dspr2.c
-
-SCALE_SRCS-no += $(SCALE_SRCS_REMOVE-yes)
-
-$(eval $(call rtcd_h_template,aom_scale_rtcd,aom_scale/aom_scale_rtcd.pl))
diff --git a/third_party/aom/aom_scale/aom_scale_rtcd.c b/third_party/aom/aom_scale/aom_scale_rtcd.c
index dec23735b..08f1a376d 100644
--- a/third_party/aom/aom_scale/aom_scale_rtcd.c
+++ b/third_party/aom/aom_scale/aom_scale_rtcd.c
@@ -8,9 +8,11 @@
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include "./aom_config.h"
+#include "config/aom_config.h"
+
#define RTCD_C
-#include "./aom_scale_rtcd.h"
+#include "config/aom_scale_rtcd.h"
+
#include "aom_ports/aom_once.h"
void aom_scale_rtcd() { once(setup_rtcd_internal); }
diff --git a/third_party/aom/aom_scale/aom_scale_rtcd.pl b/third_party/aom/aom_scale/aom_scale_rtcd.pl
index c44966f96..c5990b1bb 100644
--- a/third_party/aom/aom_scale/aom_scale_rtcd.pl
+++ b/third_party/aom/aom_scale/aom_scale_rtcd.pl
@@ -1,3 +1,13 @@
+##
+## Copyright (c) 2017, Alliance for Open Media. All rights reserved
+##
+## This source code is subject to the terms of the BSD 2 Clause License and
+## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+## was not distributed with this source code in the LICENSE file, you can
+## obtain it at www.aomedia.org/license/software. If the Alliance for Open
+## Media Patent License 1.0 was not distributed with this source code in the
+## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+##
sub aom_scale_forward_decls() {
print <<EOF
struct yv12_buffer_config;
@@ -16,9 +26,9 @@ if (aom_config("CONFIG_SPATIAL_RESAMPLING") eq "yes") {
add_proto qw/void aom_vertical_band_2_1_scale_i/, "unsigned char *source, int src_pitch, unsigned char *dest, int dest_pitch, unsigned int dest_width";
}
-add_proto qw/void aom_yv12_extend_frame_borders/, "struct yv12_buffer_config *ybf";
+add_proto qw/void aom_yv12_extend_frame_borders/, "struct yv12_buffer_config *ybf, const int num_planes";
-add_proto qw/void aom_yv12_copy_frame/, "const struct yv12_buffer_config *src_bc, struct yv12_buffer_config *dst_bc";
+add_proto qw/void aom_yv12_copy_frame/, "const struct yv12_buffer_config *src_bc, struct yv12_buffer_config *dst_bc, const int num_planes";
add_proto qw/void aom_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
@@ -26,13 +36,17 @@ add_proto qw/void aom_yv12_copy_u/, "const struct yv12_buffer_config *src_bc, st
add_proto qw/void aom_yv12_copy_v/, "const struct yv12_buffer_config *src_bc, struct yv12_buffer_config *dst_bc";
-if (aom_config("CONFIG_AV1") eq "yes") {
- add_proto qw/void aom_extend_frame_borders/, "struct yv12_buffer_config *ybf";
- specialize qw/aom_extend_frame_borders dspr2/;
+add_proto qw/void aom_yv12_partial_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc, int hstart, int hend, int vstart, int vend";
- add_proto qw/void aom_extend_frame_inner_borders/, "struct yv12_buffer_config *ybf";
- specialize qw/aom_extend_frame_inner_borders dspr2/;
+add_proto qw/void aom_yv12_partial_copy_u/, "const struct yv12_buffer_config *src_bc, struct yv12_buffer_config *dst_bc, int hstart, int hend, int vstart, int vend";
- add_proto qw/void aom_extend_frame_borders_y/, "struct yv12_buffer_config *ybf";
-}
+add_proto qw/void aom_yv12_partial_copy_v/, "const struct yv12_buffer_config *src_bc, struct yv12_buffer_config *dst_bc, int hstart, int hend, int vstart, int vend";
+
+add_proto qw/void aom_extend_frame_borders/, "struct yv12_buffer_config *ybf, const int num_planes";
+specialize qw/aom_extend_frame_borders dspr2/;
+
+add_proto qw/void aom_extend_frame_inner_borders/, "struct yv12_buffer_config *ybf, const int num_planes";
+specialize qw/aom_extend_frame_inner_borders dspr2/;
+
+add_proto qw/void aom_extend_frame_borders_y/, "struct yv12_buffer_config *ybf";
1;
diff --git a/third_party/aom/aom_scale/generic/aom_scale.c b/third_party/aom/aom_scale/generic/aom_scale.c
index d124832b7..206c42c9f 100644
--- a/third_party/aom/aom_scale/generic/aom_scale.c
+++ b/third_party/aom/aom_scale/generic/aom_scale.c
@@ -18,9 +18,10 @@
***************************************************************************/
/****************************************************************************
-* Header Files
-****************************************************************************/
-#include "./aom_scale_rtcd.h"
+ * Header Files
+ ****************************************************************************/
+#include "config/aom_scale_rtcd.h"
+
#include "aom_mem/aom_mem.h"
#include "aom_scale/aom_scale.h"
#include "aom_scale/yv12config.h"
@@ -475,11 +476,11 @@ void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
unsigned char *temp_area, unsigned char temp_height,
unsigned int hscale, unsigned int hratio,
unsigned int vscale, unsigned int vratio,
- unsigned int interlaced) {
+ unsigned int interlaced, const int num_planes) {
const int dw = (hscale - 1 + src->y_width * hratio) / hscale;
const int dh = (vscale - 1 + src->y_height * vratio) / vscale;
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const int is_uv = plane > 0;
const int plane_dw = dw >> is_uv;
const int plane_dh = dh >> is_uv;
diff --git a/third_party/aom/aom_scale/generic/gen_scalers.c b/third_party/aom/aom_scale/generic/gen_scalers.c
index 71fa82f30..549e2aa69 100644
--- a/third_party/aom/aom_scale/generic/gen_scalers.c
+++ b/third_party/aom/aom_scale/generic/gen_scalers.c
@@ -9,12 +9,13 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include "./aom_scale_rtcd.h"
+#include "config/aom_scale_rtcd.h"
+
#include "aom_scale/aom_scale.h"
#include "aom_mem/aom_mem.h"
/****************************************************************************
-* Imports
-****************************************************************************/
+ * Imports
+ ****************************************************************************/
/****************************************************************************
*
diff --git a/third_party/aom/aom_scale/generic/yv12config.c b/third_party/aom/aom_scale/generic/yv12config.c
index fce719273..cce915165 100644
--- a/third_party/aom/aom_scale/generic/yv12config.c
+++ b/third_party/aom/aom_scale/generic/yv12config.c
@@ -16,8 +16,8 @@
#include "aom_scale/yv12config.h"
/****************************************************************************
-* Exports
-****************************************************************************/
+ * Exports
+ ****************************************************************************/
/****************************************************************************
*
@@ -25,7 +25,6 @@
#define yv12_align_addr(addr, align) \
(void *)(((size_t)(addr) + ((align)-1)) & (size_t) - (align))
-#if CONFIG_AV1
// TODO(jkoleszar): Maybe replace this with struct aom_image
int aom_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
@@ -33,10 +32,7 @@ int aom_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf->buffer_alloc_sz > 0) {
aom_free(ybf->buffer_alloc);
}
-
-#if CONFIG_HIGHBITDEPTH && CONFIG_GLOBAL_MOTION
if (ybf->y_buffer_8bit) aom_free(ybf->y_buffer_8bit);
-#endif
/* buffer_alloc isn't accessed by most functions. Rather y_buffer,
u_buffer and v_buffer point to buffer_alloc and are used. Clear out
@@ -50,10 +46,7 @@ int aom_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
}
int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
- int ss_x, int ss_y,
-#if CONFIG_HIGHBITDEPTH
- int use_highbitdepth,
-#endif
+ int ss_x, int ss_y, int use_highbitdepth,
int border, int byte_alignment,
aom_codec_frame_buffer_t *fb,
aom_get_frame_buffer_cb_fn_t cb, void *cb_priv) {
@@ -72,12 +65,8 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
const uint64_t uvplane_size =
(uv_height + 2 * uv_border_h) * (uint64_t)uv_stride + byte_alignment;
-#if CONFIG_HIGHBITDEPTH
const uint64_t frame_size =
(1 + use_highbitdepth) * (yplane_size + 2 * uvplane_size);
-#else
- const uint64_t frame_size = yplane_size + 2 * uvplane_size;
-#endif // CONFIG_HIGHBITDEPTH
uint8_t *buf = NULL;
@@ -147,7 +136,6 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
ybf->subsampling_y = ss_y;
buf = ybf->buffer_alloc;
-#if CONFIG_HIGHBITDEPTH
if (use_highbitdepth) {
// Store uint16 addresses when using 16bit framebuffers
buf = CONVERT_TO_BYTEPTR(ybf->buffer_alloc);
@@ -155,7 +143,6 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
} else {
ybf->flags = 0;
}
-#endif // CONFIG_HIGHBITDEPTH
ybf->y_buffer = (uint8_t *)yv12_align_addr(
buf + (border * y_stride) + border, aom_byte_align);
@@ -167,7 +154,8 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
(uv_border_h * uv_stride) + uv_border_w,
aom_byte_align);
-#if CONFIG_HIGHBITDEPTH && CONFIG_GLOBAL_MOTION
+ ybf->use_external_refernce_buffers = 0;
+
if (use_highbitdepth) {
if (ybf->y_buffer_8bit) aom_free(ybf->y_buffer_8bit);
ybf->y_buffer_8bit = (uint8_t *)aom_memalign(32, (size_t)yplane_size);
@@ -175,7 +163,6 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
} else {
assert(!ybf->y_buffer_8bit);
}
-#endif
ybf->corrupted = 0; /* assume not corrupted by errors */
return 0;
@@ -184,19 +171,13 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
}
int aom_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
- int ss_x, int ss_y,
-#if CONFIG_HIGHBITDEPTH
- int use_highbitdepth,
-#endif
- int border, int byte_alignment) {
+ int ss_x, int ss_y, int use_highbitdepth, int border,
+ int byte_alignment) {
if (ybf) {
aom_free_frame_buffer(ybf);
return aom_realloc_frame_buffer(ybf, width, height, ss_x, ss_y,
-#if CONFIG_HIGHBITDEPTH
- use_highbitdepth,
-#endif
- border, byte_alignment, NULL, NULL, NULL);
+ use_highbitdepth, border, byte_alignment,
+ NULL, NULL, NULL);
}
return -2;
}
-#endif
diff --git a/third_party/aom/aom_scale/generic/yv12extend.c b/third_party/aom/aom_scale/generic/yv12extend.c
index 8266743cf..ba183520a 100644
--- a/third_party/aom/aom_scale/generic/yv12extend.c
+++ b/third_party/aom/aom_scale/generic/yv12extend.c
@@ -10,8 +10,10 @@
*/
#include <assert.h>
-#include "./aom_config.h"
-#include "./aom_scale_rtcd.h"
+
+#include "config/aom_config.h"
+#include "config/aom_scale_rtcd.h"
+
#include "aom/aom_integer.h"
#include "aom_mem/aom_mem.h"
#include "aom_ports/mem.h"
@@ -57,7 +59,6 @@ static void extend_plane(uint8_t *const src, int src_stride, int width,
}
}
-#if CONFIG_HIGHBITDEPTH
static void extend_plane_high(uint8_t *const src8, int src_stride, int width,
int height, int extend_top, int extend_left,
int extend_bottom, int extend_right) {
@@ -98,18 +99,17 @@ static void extend_plane_high(uint8_t *const src8, int src_stride, int width,
dst_ptr2 += src_stride;
}
}
-#endif
-void aom_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
+void aom_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
+ const int num_planes) {
assert(ybf->border % 2 == 0);
assert(ybf->y_height - ybf->y_crop_height < 16);
assert(ybf->y_width - ybf->y_crop_width < 16);
assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0);
-#if CONFIG_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const int is_uv = plane > 0;
const int plane_border = ybf->border >> is_uv;
extend_plane_high(
@@ -120,8 +120,7 @@ void aom_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
}
return;
}
-#endif
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const int is_uv = plane > 0;
const int plane_border = ybf->border >> is_uv;
extend_plane(ybf->buffers[plane], ybf->strides[is_uv],
@@ -132,8 +131,8 @@ void aom_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
}
}
-#if CONFIG_AV1
-static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
+static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size,
+ const int num_planes) {
const int ss_x = ybf->uv_width < ybf->y_width;
const int ss_y = ybf->uv_height < ybf->y_height;
@@ -142,9 +141,8 @@ static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0);
-#if CONFIG_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const int is_uv = plane > 0;
const int top = ext_size >> (is_uv ? ss_y : 0);
const int left = ext_size >> (is_uv ? ss_x : 0);
@@ -156,8 +154,7 @@ static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
}
return;
}
-#endif
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const int is_uv = plane > 0;
const int top = ext_size >> (is_uv ? ss_y : 0);
const int left = ext_size >> (is_uv ? ss_x : 0);
@@ -169,15 +166,16 @@ static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
}
}
-void aom_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
- extend_frame(ybf, ybf->border);
+void aom_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf, const int num_planes) {
+ extend_frame(ybf, ybf->border, num_planes);
}
-void aom_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) {
+void aom_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf,
+ const int num_planes) {
const int inner_bw = (ybf->border > AOMINNERBORDERINPIXELS)
? AOMINNERBORDERINPIXELS
: ybf->border;
- extend_frame(ybf, inner_bw);
+ extend_frame(ybf, inner_bw, num_planes);
}
void aom_extend_frame_borders_y_c(YV12_BUFFER_CONFIG *ybf) {
@@ -187,7 +185,6 @@ void aom_extend_frame_borders_y_c(YV12_BUFFER_CONFIG *ybf) {
assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0);
-#if CONFIG_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
extend_plane_high(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_height, ext_size, ext_size,
@@ -195,27 +192,23 @@ void aom_extend_frame_borders_y_c(YV12_BUFFER_CONFIG *ybf) {
ext_size + ybf->y_width - ybf->y_crop_width);
return;
}
-#endif
extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_height, ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width);
}
-#endif // CONFIG_AV1
-#if CONFIG_HIGHBITDEPTH
static void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) {
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
memcpy(dst, src, num * sizeof(uint16_t));
}
-#endif // CONFIG_HIGHBITDEPTH
// Copies the source image into the destination image and updates the
// destination's UMV borders.
// Note: The frames are assumed to be identical in size.
void aom_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_bc,
- YV12_BUFFER_CONFIG *dst_bc) {
+ YV12_BUFFER_CONFIG *dst_bc, const int num_planes) {
#if 0
/* These assertions are valid in the codec, but the libaom-tester uses
* this code slightly differently.
@@ -224,12 +217,11 @@ void aom_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_bc,
assert(src_bc->y_height == dst_bc->y_height);
#endif
-#if CONFIG_HIGHBITDEPTH
assert((src_bc->flags & YV12_FLAG_HIGHBITDEPTH) ==
(dst_bc->flags & YV12_FLAG_HIGHBITDEPTH));
if (src_bc->flags & YV12_FLAG_HIGHBITDEPTH) {
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const uint8_t *plane_src = src_bc->buffers[plane];
uint8_t *plane_dst = dst_bc->buffers[plane];
const int is_uv = plane > 0;
@@ -240,11 +232,10 @@ void aom_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_bc,
plane_dst += dst_bc->strides[is_uv];
}
}
- aom_yv12_extend_frame_borders_c(dst_bc);
+ aom_yv12_extend_frame_borders_c(dst_bc, num_planes);
return;
}
-#endif
- for (int plane = 0; plane < 3; ++plane) {
+ for (int plane = 0; plane < num_planes; ++plane) {
const uint8_t *plane_src = src_bc->buffers[plane];
uint8_t *plane_dst = dst_bc->buffers[plane];
const int is_uv = plane > 0;
@@ -255,7 +246,7 @@ void aom_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_bc,
plane_dst += dst_bc->strides[is_uv];
}
}
- aom_yv12_extend_frame_borders_c(dst_bc);
+ aom_yv12_extend_frame_borders_c(dst_bc, num_planes);
}
void aom_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
@@ -264,7 +255,6 @@ void aom_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
const uint8_t *src = src_ybc->y_buffer;
uint8_t *dst = dst_ybc->y_buffer;
-#if CONFIG_HIGHBITDEPTH
if (src_ybc->flags & YV12_FLAG_HIGHBITDEPTH) {
const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
@@ -275,7 +265,6 @@ void aom_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
}
return;
}
-#endif // CONFIG_HIGHBITDEPTH
for (row = 0; row < src_ybc->y_height; ++row) {
memcpy(dst, src, src_ybc->y_width);
@@ -290,7 +279,6 @@ void aom_yv12_copy_u_c(const YV12_BUFFER_CONFIG *src_bc,
const uint8_t *src = src_bc->u_buffer;
uint8_t *dst = dst_bc->u_buffer;
-#if CONFIG_HIGHBITDEPTH
if (src_bc->flags & YV12_FLAG_HIGHBITDEPTH) {
const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
@@ -301,7 +289,6 @@ void aom_yv12_copy_u_c(const YV12_BUFFER_CONFIG *src_bc,
}
return;
}
-#endif // CONFIG_HIGHBITDEPTH
for (row = 0; row < src_bc->uv_height; ++row) {
memcpy(dst, src, src_bc->uv_width);
@@ -316,7 +303,6 @@ void aom_yv12_copy_v_c(const YV12_BUFFER_CONFIG *src_bc,
const uint8_t *src = src_bc->v_buffer;
uint8_t *dst = dst_bc->v_buffer;
-#if CONFIG_HIGHBITDEPTH
if (src_bc->flags & YV12_FLAG_HIGHBITDEPTH) {
const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
@@ -327,7 +313,6 @@ void aom_yv12_copy_v_c(const YV12_BUFFER_CONFIG *src_bc,
}
return;
}
-#endif // CONFIG_HIGHBITDEPTH
for (row = 0; row < src_bc->uv_height; ++row) {
memcpy(dst, src, src_bc->uv_width);
@@ -335,3 +320,92 @@ void aom_yv12_copy_v_c(const YV12_BUFFER_CONFIG *src_bc,
dst += dst_bc->uv_stride;
}
}
+
+void aom_yv12_partial_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
+ YV12_BUFFER_CONFIG *dst_ybc, int hstart,
+ int hend, int vstart, int vend) {
+ int row;
+ const uint8_t *src = src_ybc->y_buffer;
+ uint8_t *dst = dst_ybc->y_buffer;
+
+ if (src_ybc->flags & YV12_FLAG_HIGHBITDEPTH) {
+ const uint16_t *src16 =
+ CONVERT_TO_SHORTPTR(src + vstart * src_ybc->y_stride + hstart);
+ uint16_t *dst16 =
+ CONVERT_TO_SHORTPTR(dst + vstart * dst_ybc->y_stride + hstart);
+ for (row = vstart; row < vend; ++row) {
+ memcpy(dst16, src16, (hend - hstart) * sizeof(uint16_t));
+ src16 += src_ybc->y_stride;
+ dst16 += dst_ybc->y_stride;
+ }
+ return;
+ }
+ src = (src + vstart * src_ybc->y_stride + hstart);
+ dst = (dst + vstart * dst_ybc->y_stride + hstart);
+
+ for (row = vstart; row < vend; ++row) {
+ memcpy(dst, src, (hend - hstart));
+ src += src_ybc->y_stride;
+ dst += dst_ybc->y_stride;
+ }
+}
+
+void aom_yv12_partial_copy_u_c(const YV12_BUFFER_CONFIG *src_bc,
+ YV12_BUFFER_CONFIG *dst_bc, int hstart, int hend,
+ int vstart, int vend) {
+ int row;
+ const uint8_t *src = src_bc->u_buffer;
+ uint8_t *dst = dst_bc->u_buffer;
+
+ if (src_bc->flags & YV12_FLAG_HIGHBITDEPTH) {
+ const uint16_t *src16 =
+ CONVERT_TO_SHORTPTR(src + vstart * src_bc->uv_stride + hstart);
+ uint16_t *dst16 =
+ CONVERT_TO_SHORTPTR(dst + vstart * dst_bc->uv_stride + hstart);
+ for (row = vstart; row < vend; ++row) {
+ memcpy(dst16, src16, (hend - hstart) * sizeof(uint16_t));
+ src16 += src_bc->uv_stride;
+ dst16 += dst_bc->uv_stride;
+ }
+ return;
+ }
+
+ src = (src + vstart * src_bc->uv_stride + hstart);
+ dst = (dst + vstart * dst_bc->uv_stride + hstart);
+
+ for (row = vstart; row < vend; ++row) {
+ memcpy(dst, src, (hend - hstart));
+ src += src_bc->uv_stride;
+ dst += dst_bc->uv_stride;
+ }
+}
+
+void aom_yv12_partial_copy_v_c(const YV12_BUFFER_CONFIG *src_bc,
+ YV12_BUFFER_CONFIG *dst_bc, int hstart, int hend,
+ int vstart, int vend) {
+ int row;
+ const uint8_t *src = src_bc->v_buffer;
+ uint8_t *dst = dst_bc->v_buffer;
+
+ if (src_bc->flags & YV12_FLAG_HIGHBITDEPTH) {
+ const uint16_t *src16 =
+ CONVERT_TO_SHORTPTR(src + vstart * src_bc->uv_stride + hstart);
+ uint16_t *dst16 =
+ CONVERT_TO_SHORTPTR(dst + vstart * dst_bc->uv_stride + hstart);
+ for (row = vstart; row < vend; ++row) {
+ memcpy(dst16, src16, (hend - hstart) * sizeof(uint16_t));
+ src16 += src_bc->uv_stride;
+ dst16 += dst_bc->uv_stride;
+ }
+ return;
+ }
+
+ src = (src + vstart * src_bc->uv_stride + hstart);
+ dst = (dst + vstart * dst_bc->uv_stride + hstart);
+
+ for (row = vstart; row < vend; ++row) {
+ memcpy(dst, src, (hend - hstart));
+ src += src_bc->uv_stride;
+ dst += dst_bc->uv_stride;
+ }
+}
diff --git a/third_party/aom/aom_scale/mips/dspr2/yv12extend_dspr2.c b/third_party/aom/aom_scale/mips/dspr2/yv12extend_dspr2.c
index 51192f7b9..869e594d7 100644
--- a/third_party/aom/aom_scale/mips/dspr2/yv12extend_dspr2.c
+++ b/third_party/aom/aom_scale/mips/dspr2/yv12extend_dspr2.c
@@ -11,7 +11,8 @@
#include <assert.h>
-#include "./aom_config.h"
+#include "config/aom_config.h"
+
#include "aom_scale/yv12config.h"
#include "aom_mem/aom_mem.h"
#include "aom_scale/aom_scale.h"
@@ -126,14 +127,16 @@ static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
extend_plane(ybf->v_buffer, ybf->uv_stride, c_w, c_h, c_et, c_el, c_eb, c_er);
}
-void aom_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
- extend_frame(ybf, ybf->border);
+void aom_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf,
+ const int num_planes) {
+ extend_frame(ybf, ybf->border, num_planes);
}
-void aom_extend_frame_inner_borders_dspr2(YV12_BUFFER_CONFIG *ybf) {
+void aom_extend_frame_inner_borders_dspr2(YV12_BUFFER_CONFIG *ybf,
+ const int num_planes) {
const int inner_bw = (ybf->border > AOMINNERBORDERINPIXELS)
? AOMINNERBORDERINPIXELS
: ybf->border;
- extend_frame(ybf, inner_bw);
+ extend_frame(ybf, inner_bw, num_planes);
}
#endif
diff --git a/third_party/aom/aom_scale/yv12config.h b/third_party/aom/aom_scale/yv12config.h
index 0c47f650d..8f1c60069 100644
--- a/third_party/aom/aom_scale/yv12config.h
+++ b/third_party/aom/aom_scale/yv12config.h
@@ -16,22 +16,19 @@
extern "C" {
#endif
-#include "./aom_config.h"
+#include "config/aom_config.h"
+
#include "aom/aom_codec.h"
#include "aom/aom_frame_buffer.h"
#include "aom/aom_integer.h"
-#if CONFIG_EXT_PARTITION
#define AOMINNERBORDERINPIXELS 160
-#else
-#define AOMINNERBORDERINPIXELS 96
-#endif // CONFIG_EXT_PARTITION
#define AOM_INTERP_EXTEND 4
// TODO(jingning): Use unified inter predictor for encoder and
// decoder during the development process. Revisit the frame border
// to improve the decoder performance.
-#define AOM_BORDER_IN_PIXELS 160
+#define AOM_BORDER_IN_PIXELS 288
typedef struct yv12_buffer_config {
union {
@@ -82,12 +79,18 @@ typedef struct yv12_buffer_config {
uint8_t *buffers[4];
};
-#if CONFIG_HIGHBITDEPTH && CONFIG_GLOBAL_MOTION
+ // Indicate whether y_buffer, u_buffer, and v_buffer points to the internally
+ // allocated memory or external buffers.
+ int use_external_refernce_buffers;
+ // This is needed to store y_buffer, u_buffer, and v_buffer when set reference
+ // uses an external refernece, and restore those buffer pointers after the
+ // external reference frame is no longer used.
+ uint8_t *store_buf_adr[3];
+
// If the frame is stored in a 16-bit buffer, this stores an 8-bit version
// for use in global motion detection. It is allocated on-demand.
uint8_t *y_buffer_8bit;
int buf_8bit_valid;
-#endif
uint8_t *buffer_alloc;
size_t buffer_alloc_sz;
@@ -96,8 +99,10 @@ typedef struct yv12_buffer_config {
int subsampling_x;
int subsampling_y;
unsigned int bit_depth;
- aom_color_space_t color_space;
- aom_transfer_function_t transfer_function;
+ aom_color_primaries_t color_primaries;
+ aom_transfer_characteristics_t transfer_characteristics;
+ aom_matrix_coefficients_t matrix_coefficients;
+ int monochrome;
aom_chroma_sample_position_t chroma_sample_position;
aom_color_range_t color_range;
int render_width;
@@ -110,11 +115,8 @@ typedef struct yv12_buffer_config {
#define YV12_FLAG_HIGHBITDEPTH 8
int aom_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
- int ss_x, int ss_y,
-#if CONFIG_HIGHBITDEPTH
- int use_highbitdepth,
-#endif
- int border, int byte_alignment);
+ int ss_x, int ss_y, int use_highbitdepth, int border,
+ int byte_alignment);
// 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
@@ -124,10 +126,7 @@ int aom_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
// internally to decode the current frame. Returns 0 on success. Returns < 0
// on failure.
int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
- int ss_x, int ss_y,
-#if CONFIG_HIGHBITDEPTH
- int use_highbitdepth,
-#endif
+ int ss_x, int ss_y, int use_highbitdepth,
int border, int byte_alignment,
aom_codec_frame_buffer_t *fb,
aom_get_frame_buffer_cb_fn_t cb, void *cb_priv);