]> granicus.if.org Git - libvpx/commitdiff
Rename AOM_ENC/DEC_BORDER_IN_PIXELS
authorYaowu Xu <yaowu@google.com>
Fri, 30 Sep 2016 22:07:57 +0000 (15:07 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 30 Sep 2016 22:17:16 +0000 (15:17 -0700)
Cherry-picked from aom/master:
e2721a65cbfb5b560cd884d60eb17f53539df5f0

Change-Id: I4ade58be91e7bca0cc4f2bed98a43177d7f590a5

aom_scale/yv12config.h
av1/av1_iface_common.h
av1/common/quant_common.c
av1/common/restoration.c
av1/decoder/decodeframe.c
av1/encoder/encoder.c
av1/encoder/lookahead.c
av1/encoder/rdopt.c

index da730c62b5235aa2240ca2ba8b9ef3edc5369fac..315718e01c108303b9e6403502f46f170cdd4d4e 100644 (file)
@@ -28,8 +28,11 @@ extern "C" {
 #define AOMINNERBORDERINPIXELS 96
 #endif  // CONFIG_EXT_PARTITION
 #define AOM_INTERP_EXTEND 4
-#define AOM_ENC_BORDER_IN_PIXELS 160
-#define AOM_DEC_BORDER_IN_PIXELS 160
+
+// 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
 
 typedef struct yv12_buffer_config {
   int y_width;
index 621764d9109106e4b7fc607f79f606a3dfc4aa78..3e6024ccc7c85bed8c95cfb22dc0e2ec38e997a5 100644 (file)
@@ -41,7 +41,7 @@ static void yuvconfig2image(aom_image_t *img, const YV12_BUFFER_CONFIG *yv12,
   img->range = yv12->color_range;
   img->bit_depth = 8;
   img->w = yv12->y_stride;
-  img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * AOM_ENC_BORDER_IN_PIXELS, 3);
+  img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * AOM_BORDER_IN_PIXELS, 3);
   img->d_w = yv12->y_crop_width;
   img->d_h = yv12->y_crop_height;
   img->r_w = yv12->render_width;
index 4f3d481c465602f28096245984a1660ca7539067..536529ab6f0aea61901864501f932beae1937197 100644 (file)
@@ -48,7 +48,7 @@ static const qprofile_type nuq_lossless[COEF_BANDS] = {
 static const qprofile_type nuq[QUANT_PROFILES][QUANT_RANGES][COEF_BANDS] = {
   { {
         { { 64, 128, 128 }, 8 },   // dc, band 0
-        { { 64, 128, 128 }, 10 },   // band 1
+        { { 64, 128, 128 }, 10 },  // band 1
         { { 64, 128, 128 }, 12 },  // band 2
         { { 72, 128, 128 }, 14 },  // band 3
         { { 76, 128, 128 }, 16 },  // band 4
@@ -56,8 +56,8 @@ static const qprofile_type nuq[QUANT_PROFILES][QUANT_RANGES][COEF_BANDS] = {
     },
     {
         { { 64, 128, 128 }, 4 },   // dc, band 0
-        { { 64, 128, 128 }, 6 },  // band 1
-        { { 64, 128, 128 }, 8 },  // band 2
+        { { 64, 128, 128 }, 6 },   // band 1
+        { { 64, 128, 128 }, 8 },   // band 2
         { { 64, 128, 128 }, 10 },  // band 3
         { { 72, 128, 128 }, 12 },  // band 4
         { { 80, 128, 128 }, 14 }   // band 5
@@ -74,7 +74,7 @@ static const qprofile_type nuq[QUANT_PROFILES][QUANT_RANGES][COEF_BANDS] = {
     {
         { { 64, 128, 128 }, 4 },   // dc, band 0
         { { 64, 128, 128 }, 6 },   // band 1
-        { { 64, 128, 128 }, 8 },  // band 2
+        { { 64, 128, 128 }, 8 },   // band 2
         { { 64, 128, 128 }, 10 },  // band 3
         { { 72, 128, 128 }, 12 },  // band 4
         { { 80, 128, 128 }, 14 }   // band 5
@@ -91,7 +91,7 @@ static const qprofile_type nuq[QUANT_PROFILES][QUANT_RANGES][COEF_BANDS] = {
     {
         { { 64, 128, 128 }, 4 },   // dc, band 0
         { { 64, 128, 128 }, 6 },   // band 1
-        { { 64, 128, 128 }, 8 },  // band 2
+        { { 64, 128, 128 }, 8 },   // band 2
         { { 64, 128, 128 }, 10 },  // band 3
         { { 72, 128, 128 }, 12 },  // band 4
         { { 80, 128, 128 }, 14 }   // band 5
index f58d91a917ca04ecd86ad508456e8608735acf6c..97c89e12fec3bda6bb29dded80fec7352ea9f6ba 100644 (file)
@@ -585,7 +585,7 @@ void av1_loop_restoration_rows(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
 #if CONFIG_AOM_HIGHBITDEPTH
           cm->use_highbitdepth,
 #endif
-          AOM_DEC_BORDER_IN_PIXELS, cm->byte_alignment, NULL, NULL, NULL) < 0)
+          AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL, NULL, NULL) < 0)
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate tmp restoration buffer");
 
index c2f187036beea569c32356d2761e0dc9603f8081..d54035e9320f04bab22c6e39eb4c8ed7dfbae77b 100644 (file)
@@ -2236,7 +2236,7 @@ static void setup_frame_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
 #if CONFIG_AOM_HIGHBITDEPTH
           cm->use_highbitdepth,
 #endif
-          AOM_DEC_BORDER_IN_PIXELS, cm->byte_alignment,
+          AOM_BORDER_IN_PIXELS, cm->byte_alignment,
           &pool->frame_bufs[cm->new_fb_idx].raw_frame_buffer, pool->get_fb_cb,
           pool->cb_priv)) {
     unlock_buffer_pool(pool);
@@ -2319,7 +2319,7 @@ static void setup_frame_size_with_refs(AV1_COMMON *cm,
 #if CONFIG_AOM_HIGHBITDEPTH
           cm->use_highbitdepth,
 #endif
-          AOM_DEC_BORDER_IN_PIXELS, cm->byte_alignment,
+          AOM_BORDER_IN_PIXELS, cm->byte_alignment,
           &pool->frame_bufs[cm->new_fb_idx].raw_frame_buffer, pool->get_fb_cb,
           pool->cb_priv)) {
     unlock_buffer_pool(pool);
index 56ba676cf6274ca6e8f2af15da4095a4919f0bfd..935d65ea587f9a8b6fe30015e623541e2648e6b9 100644 (file)
@@ -738,8 +738,8 @@ static void alloc_raw_frame_buffers(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               AOM_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL,
+                               NULL, NULL))
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate altref buffer");
 }
@@ -751,8 +751,8 @@ static void alloc_util_frame_buffers(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               AOM_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL,
+                               NULL, NULL))
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate last frame buffer");
 
@@ -762,8 +762,8 @@ static void alloc_util_frame_buffers(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               AOM_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL,
+                               NULL, NULL))
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate last frame deblocked buffer");
 #endif  // CONFIG_LOOP_RESTORATION
@@ -773,8 +773,8 @@ static void alloc_util_frame_buffers(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               AOM_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL,
+                               NULL, NULL))
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate scaled source buffer");
 
@@ -783,8 +783,8 @@ static void alloc_util_frame_buffers(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               AOM_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL,
+                               NULL, NULL))
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate scaled last source buffer");
 }
@@ -3005,7 +3005,7 @@ static INLINE int upsample_ref_frame(AV1_COMP *cpi,
 #if CONFIG_AOM_HIGHBITDEPTH
                                    cm->use_highbitdepth,
 #endif
-                                   (AOM_ENC_BORDER_IN_PIXELS << 3),
+                                   (AOM_BORDER_IN_PIXELS << 3),
                                    cm->byte_alignment, NULL, NULL, NULL))
         aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                            "Failed to allocate up-sampled frame buffer");
@@ -3537,11 +3537,10 @@ void av1_scale_references(AV1_COMP *cpi) {
         new_fb_ptr = &pool->frame_bufs[new_fb];
         if (force_scaling || new_fb_ptr->buf.y_crop_width != cm->width ||
             new_fb_ptr->buf.y_crop_height != cm->height) {
-          if (aom_realloc_frame_buffer(&new_fb_ptr->buf, cm->width, cm->height,
-                                       cm->subsampling_x, cm->subsampling_y,
-                                       cm->use_highbitdepth,
-                                       AOM_ENC_BORDER_IN_PIXELS,
-                                       cm->byte_alignment, NULL, NULL, NULL))
+          if (aom_realloc_frame_buffer(
+                  &new_fb_ptr->buf, cm->width, cm->height, cm->subsampling_x,
+                  cm->subsampling_y, cm->use_highbitdepth, AOM_BORDER_IN_PIXELS,
+                  cm->byte_alignment, NULL, NULL, NULL))
             aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                                "Failed to allocate frame buffer");
           scale_and_extend_frame(ref, &new_fb_ptr->buf, MAX_MB_PLANE,
@@ -3564,8 +3563,8 @@ void av1_scale_references(AV1_COMP *cpi) {
             new_fb_ptr->buf.y_crop_height != cm->height) {
           if (aom_realloc_frame_buffer(&new_fb_ptr->buf, cm->width, cm->height,
                                        cm->subsampling_x, cm->subsampling_y,
-                                       AOM_ENC_BORDER_IN_PIXELS,
-                                       cm->byte_alignment, NULL, NULL, NULL))
+                                       AOM_BORDER_IN_PIXELS, cm->byte_alignment,
+                                       NULL, NULL, NULL))
             aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                                "Failed to allocate frame buffer");
           scale_and_extend_frame(ref, &new_fb_ptr->buf, MAX_MB_PLANE);
@@ -3587,7 +3586,7 @@ void av1_scale_references(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                        cm->use_highbitdepth,
 #endif
-                                       (AOM_ENC_BORDER_IN_PIXELS << 3),
+                                       (AOM_BORDER_IN_PIXELS << 3),
                                        cm->byte_alignment, NULL, NULL, NULL))
             aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                                "Failed to allocate up-sampled frame buffer");
@@ -3863,8 +3862,8 @@ static void set_frame_size(AV1_COMP *cpi) {
 #if CONFIG_AOM_HIGHBITDEPTH
                                cm->use_highbitdepth,
 #endif
-                               AOM_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
-                               NULL, NULL, NULL))
+                               AOM_BORDER_IN_PIXELS, cm->byte_alignment, NULL,
+                               NULL, NULL))
     aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate frame buffer");
 
index f5a0aa5a9b1f33db78c16651785ab13cf279b7e3..6b4500b5058719e5c0c12efd6c41b02bed0c8c6f 100644 (file)
@@ -67,12 +67,12 @@ struct lookahead_ctx *av1_lookahead_init(unsigned int width,
     ctx->buf = calloc(depth, sizeof(*ctx->buf));
     if (!ctx->buf) goto bail;
     for (i = 0; i < depth; i++)
-      if (aom_alloc_frame_buffer(
-              &ctx->buf[i].img, width, height, subsampling_x, subsampling_y,
+      if (aom_alloc_frame_buffer(&ctx->buf[i].img, width, height, subsampling_x,
+                                 subsampling_y,
 #if CONFIG_AOM_HIGHBITDEPTH
-              use_highbitdepth,
+                                 use_highbitdepth,
 #endif
-              AOM_ENC_BORDER_IN_PIXELS, legacy_byte_alignment))
+                                 AOM_BORDER_IN_PIXELS, legacy_byte_alignment))
         goto bail;
   }
   return ctx;
@@ -164,7 +164,7 @@ int av1_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src,
 #if CONFIG_AOM_HIGHBITDEPTH
                                  use_highbitdepth,
 #endif
-                                 AOM_ENC_BORDER_IN_PIXELS, 0))
+                                 AOM_BORDER_IN_PIXELS, 0))
         return 1;
       aom_free_frame_buffer(&buf->img);
       buf->img = new_img;
index 44b56bdbb351eb4f9370e6aa540be34e93457e32..d822d09c8d41dc16e49898fe028dd00db5a2f1b1 100644 (file)
@@ -6297,9 +6297,8 @@ static int discount_newmv_test(const AV1_COMP *cpi, int this_mode,
            (mode_mv[NEARMV][ref_frame].as_int == INVALID_MV)));
 }
 
-#define LEFT_TOP_MARGIN ((AOM_ENC_BORDER_IN_PIXELS - AOM_INTERP_EXTEND) << 3)
-#define RIGHT_BOTTOM_MARGIN \
-  ((AOM_ENC_BORDER_IN_PIXELS - AOM_INTERP_EXTEND) << 3)
+#define LEFT_TOP_MARGIN ((AOM_BORDER_IN_PIXELS - AOM_INTERP_EXTEND) << 3)
+#define RIGHT_BOTTOM_MARGIN ((AOM_BORDER_IN_PIXELS - AOM_INTERP_EXTEND) << 3)
 
 // TODO(jingning): this mv clamping function should be block size dependent.
 static INLINE void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {