]> granicus.if.org Git - libvpx/commitdiff
CLPF: Don't assume sb size=64 and w&h multiple of 8 + valgrind fix.
authorSteinar Midtskogen <stemidts@cisco.com>
Thu, 25 Aug 2016 10:22:24 +0000 (12:22 +0200)
committerYaowu Xu <yaowu@google.com>
Mon, 10 Oct 2016 18:21:23 +0000 (11:21 -0700)
Change-Id: I518ad9c58973910eb0bdcb377f2d90138208c570

av1/common/clpf.c
av1/encoder/bitstream.c
av1/encoder/encoder.c

index 6739809c0bf411b39cd7cf76a4c0ac5debd8333d..668c75fcebab1900f94b584f5d3c05ff1f1e345d 100644 (file)
@@ -14,9 +14,8 @@
 
 int av1_clpf_maxbits(const AV1_COMMON *cm) {
   return get_msb(
-             ALIGN_POWER_OF_TWO(cm->mi_cols * MAX_MIB_SIZE, cm->clpf_size + 4) *
-                 ALIGN_POWER_OF_TWO(cm->mi_rows * MAX_MIB_SIZE,
-                                    cm->clpf_size + 4) >>
+             ALIGN_POWER_OF_TWO(cm->mi_cols * MI_SIZE, cm->clpf_size + 4) *
+                 ALIGN_POWER_OF_TWO(cm->mi_rows * MI_SIZE, cm->clpf_size + 4) >>
              (cm->clpf_size * 2 + 8)) +
          1;
 }
@@ -59,11 +58,11 @@ int av1_clpf_frame(const YV12_BUFFER_CONFIG *dst, const YV12_BUFFER_CONFIG *rec,
                                    unsigned int, unsigned int, uint8_t *)) {
   /* Constrained low-pass filter (CLPF) */
   int c, k, l, m, n;
-  int width = rec->y_crop_width;
-  int height = rec->y_crop_height;
+  const int bs = MI_SIZE;
+  int width = cm->mi_cols * bs;
+  int height = cm->mi_rows * bs;
   int xpos, ypos;
   int stride_y = rec->y_stride;
-  const int bs = MAX_MIB_SIZE;
   int num_fb_hor = (width + (1 << fb_size_log2) - bs) >> fb_size_log2;
   int num_fb_ver = (height + (1 << fb_size_log2) - bs) >> fb_size_log2;
   int block_index = 0;
index bd33881100cc34dcac54624d509306bac0001363..77aee229f11bc19b0a0ff6c46ecf324a185c3ad0 100644 (file)
@@ -2602,7 +2602,7 @@ static void encode_clpf(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
       // 50% probability, so a more efficient coding is possible.
       aom_wb_write_literal(wb, cm->clpf_numblocks, av1_clpf_maxbits(cm));
       for (i = 0; i < cm->clpf_numblocks; i++) {
-        aom_wb_write_literal(wb, cm->clpf_blocks[i], 1);
+        aom_wb_write_literal(wb, cm->clpf_blocks ? cm->clpf_blocks[i] : 0, 1);
       }
     }
   }
index 20cabb679653d3697b60c1b84d65acb2b41f0744..3fbf6cf290d727c3132bcad174543eba5e81d3ac 100644 (file)
@@ -4732,6 +4732,7 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
 
 #if CONFIG_CLPF
   aom_free(cm->clpf_blocks);
+  cm->clpf_blocks = 0;
 #endif
 
   if (cm->seg.update_map) update_reference_segmentation_map(cpi);