Remove CONFIG_TRAILING_BITS

This tool is adopted.

Change-Id: I2eac0a5bcab50f8179f95b9d8fe7dca3d0102ddf
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 0c86e6d..cfb87d3 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -62,7 +62,6 @@
 #define MAX_AV1_HEADER_SIZE 80
 #define ACCT_STR __func__
 
-#if CONFIG_TRAILING_BITS
 // Checks that the remaining bits start with a 1 and ends with 0s.
 // It consumes an additional byte, if already byte aligned before the check.
 int av1_check_trailing_bits(AV1Decoder *pbi, struct aom_read_bit_buffer *rb) {
@@ -76,7 +75,6 @@
   }
   return 0;
 }
-#endif
 
 // Use only_chroma = 1 to only set the chroma planes
 static void set_planes_to_neutral_grey(AV1_COMMON *const cm,
@@ -1838,7 +1836,6 @@
     decode_tile_sb_row(pbi, td, tile_info, mi_row);
   }
 
-#if CONFIG_TRAILING_BITS
   uint32_t nb_bits = aom_reader_tell(&td->bit_reader);
   uint32_t nb_bytes = (nb_bits + 7) >> 3;
 
@@ -1857,7 +1854,6 @@
     if (*p != 0) cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
     p++;
   }
-#endif
 }
 
 static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
@@ -3129,13 +3125,8 @@
 }
 
 int av1_decode_frame_headers_and_setup(AV1Decoder *pbi,
-#if CONFIG_TRAILING_BITS
                                        struct aom_read_bit_buffer *rb,
-#endif
                                        const uint8_t *data,
-#if !CONFIG_TRAILING_BITS
-                                       const uint8_t *data_end,
-#endif
                                        const uint8_t **p_data_end) {
   AV1_COMMON *const cm = &pbi->common;
   const int num_planes = av1_num_planes(cm);
@@ -3154,19 +3145,9 @@
   }
   xd->global_motion = cm->global_motion;
 
-#if !CONFIG_TRAILING_BITS
-  struct aom_read_bit_buffer rb;
-#endif
-  read_uncompressed_header(pbi,
-#if CONFIG_TRAILING_BITS
-                           rb);
-#else
-                           av1_init_read_bit_buffer(pbi, &rb, data, data_end));
-#endif
+  read_uncompressed_header(pbi, rb);
 
-#if CONFIG_TRAILING_BITS
   av1_check_trailing_bits(pbi, rb);
-#endif
 
   // If cm->single_tile_decoding = 0, the independent decoding of a single tile
   // or a section of a frame is not allowed.
@@ -3176,11 +3157,7 @@
     pbi->dec_tile_col = -1;
   }
 
-#if CONFIG_TRAILING_BITS
   pbi->uncomp_hdr_size = aom_rb_bytes_read(rb);
-#else
-  pbi->uncomp_hdr_size = aom_rb_bytes_read(&rb);
-#endif
   YV12_BUFFER_CONFIG *new_fb = get_frame_new_buffer(cm);
   xd->cur_buf = new_fb;
   if (av1_allow_intrabc(cm)) {
@@ -3190,12 +3167,8 @@
   }
 
   if (cm->show_existing_frame) {
-  // showing a frame directly
-#if CONFIG_TRAILING_BITS
+    // showing a frame directly
     *p_data_end = data + aom_rb_bytes_read(rb);
-#else
-    *p_data_end = data + aom_rb_bytes_read(&rb);
-#endif
     if (cm->reset_decoder_state) {
       // Use the default frame context values.
       *cm->fc = cm->frame_contexts[FRAME_CONTEXT_DEFAULTS];
diff --git a/av1/decoder/decodeframe.h b/av1/decoder/decodeframe.h
index a849c71..fd0a358 100644
--- a/av1/decoder/decodeframe.h
+++ b/av1/decoder/decodeframe.h
@@ -26,22 +26,15 @@
                          int num_bits_height, int *width, int *height);
 BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
 
-#if CONFIG_TRAILING_BITS
 int av1_check_trailing_bits(struct AV1Decoder *pbi,
                             struct aom_read_bit_buffer *rb);
-#endif
 
 // This function is now obsolete
 void av1_decode_frame(struct AV1Decoder *pbi, const uint8_t *data,
                       const uint8_t *data_end, const uint8_t **p_data_end);
 int av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
-#if CONFIG_TRAILING_BITS
                                        struct aom_read_bit_buffer *rb,
-#endif
                                        const uint8_t *data,
-#if !CONFIG_TRAILING_BITS
-                                       const uint8_t *data_end,
-#endif
                                        const uint8_t **p_data_end);
 
 void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c
index 40434bf..cdf4983 100644
--- a/av1/decoder/obu.c
+++ b/av1/decoder/obu.c
@@ -172,9 +172,7 @@
 
   cm->film_grain_params_present = aom_rb_read_bit(rb);
 
-#if CONFIG_TRAILING_BITS
   av1_check_trailing_bits(pbi, rb);
-#endif
 
   pbi->sequence_header_ready = 1;
 
@@ -182,23 +180,10 @@
 }
 
 static uint32_t read_frame_header_obu(AV1Decoder *pbi,
-#if CONFIG_TRAILING_BITS
                                       struct aom_read_bit_buffer *rb,
-#endif
                                       const uint8_t *data,
-#if !CONFIG_TRAILING_BITS
-                                      const uint8_t *data_end,
-#endif
                                       const uint8_t **p_data_end) {
-  av1_decode_frame_headers_and_setup(pbi,
-#if CONFIG_TRAILING_BITS
-                                     rb,
-#endif
-                                     data,
-#if !CONFIG_TRAILING_BITS
-                                     data_end,
-#endif
-                                     p_data_end);
+  av1_decode_frame_headers_and_setup(pbi, rb, data, p_data_end);
   return (uint32_t)(pbi->uncomp_hdr_size);
 }
 
@@ -456,18 +441,8 @@
         }
         // Only decode first frame header received
         if (!frame_header_received) {
-#if CONFIG_TRAILING_BITS
           av1_init_read_bit_buffer(pbi, &rb, data, data_end);
-#endif
-          frame_header_size = read_frame_header_obu(pbi,
-#if CONFIG_TRAILING_BITS
-                                                    &rb,
-#endif
-                                                    data,
-#if !CONFIG_TRAILING_BITS
-                                                    data_end,
-#endif
-                                                    p_data_end);
+          frame_header_size = read_frame_header_obu(pbi, &rb, data, p_data_end);
           frame_header_received = 1;
         }
         decoded_payload_size = frame_header_size;
@@ -477,9 +452,6 @@
         }
         if (obu_header.type != OBU_FRAME) break;
         obu_payload_offset = frame_header_size;
-#if !CONFIG_TRAILING_BITS
-        av1_init_read_bit_buffer(pbi, &rb, data + obu_payload_offset, data_end);
-#endif                             // !CONFIG_TRAILING_BITS
         AOM_FALLTHROUGH_INTENDED;  // fall through to read tile group.
       case OBU_TILE_GROUP:
         if (!frame_header_received) {