OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <assert.h> | 11 #include <assert.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <limits.h> | 13 #include <limits.h> |
14 | 14 |
15 #include "vpx/vpx_encoder.h" | 15 #include "vpx/vpx_encoder.h" |
16 #include "vpx_dsp/bitwriter_buffer.h" | 16 #include "vpx_dsp/bitwriter_buffer.h" |
17 #include "vpx_mem/vpx_mem.h" | 17 #include "vpx_mem/vpx_mem.h" |
18 #include "vpx_ports/mem_ops.h" | 18 #include "vpx_ports/mem_ops.h" |
| 19 #include "vpx_ports/system_state.h" |
19 | 20 |
20 #include "vp9/common/vp9_entropy.h" | 21 #include "vp9/common/vp9_entropy.h" |
21 #include "vp9/common/vp9_entropymode.h" | 22 #include "vp9/common/vp9_entropymode.h" |
22 #include "vp9/common/vp9_entropymv.h" | 23 #include "vp9/common/vp9_entropymv.h" |
23 #include "vp9/common/vp9_mvref_common.h" | 24 #include "vp9/common/vp9_mvref_common.h" |
24 #include "vp9/common/vp9_pred_common.h" | 25 #include "vp9/common/vp9_pred_common.h" |
25 #include "vp9/common/vp9_seg_common.h" | 26 #include "vp9/common/vp9_seg_common.h" |
26 #include "vp9/common/vp9_systemdependent.h" | |
27 #include "vp9/common/vp9_tile_common.h" | 27 #include "vp9/common/vp9_tile_common.h" |
28 | 28 |
29 #include "vp9/encoder/vp9_cost.h" | 29 #include "vp9/encoder/vp9_cost.h" |
30 #include "vp9/encoder/vp9_bitstream.h" | 30 #include "vp9/encoder/vp9_bitstream.h" |
31 #include "vp9/encoder/vp9_encodemv.h" | 31 #include "vp9/encoder/vp9_encodemv.h" |
32 #include "vp9/encoder/vp9_mcomp.h" | 32 #include "vp9/encoder/vp9_mcomp.h" |
33 #include "vp9/encoder/vp9_segmentation.h" | 33 #include "vp9/encoder/vp9_segmentation.h" |
34 #include "vp9/encoder/vp9_subexp.h" | 34 #include "vp9/encoder/vp9_subexp.h" |
35 #include "vp9/encoder/vp9_tokenize.h" | 35 #include "vp9/encoder/vp9_tokenize.h" |
36 | 36 |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 } | 808 } |
809 } | 809 } |
810 } | 810 } |
811 } | 811 } |
812 } | 812 } |
813 } | 813 } |
814 | 814 |
815 static void encode_txfm_probs(VP9_COMMON *cm, vpx_writer *w, | 815 static void encode_txfm_probs(VP9_COMMON *cm, vpx_writer *w, |
816 FRAME_COUNTS *counts) { | 816 FRAME_COUNTS *counts) { |
817 // Mode | 817 // Mode |
818 vpx_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2); | 818 vpx_write_literal(w, VPXMIN(cm->tx_mode, ALLOW_32X32), 2); |
819 if (cm->tx_mode >= ALLOW_32X32) | 819 if (cm->tx_mode >= ALLOW_32X32) |
820 vpx_write_bit(w, cm->tx_mode == TX_MODE_SELECT); | 820 vpx_write_bit(w, cm->tx_mode == TX_MODE_SELECT); |
821 | 821 |
822 // Probabilities | 822 // Probabilities |
823 if (cm->tx_mode == TX_MODE_SELECT) { | 823 if (cm->tx_mode == TX_MODE_SELECT) { |
824 int i, j; | 824 int i, j; |
825 unsigned int ct_8x8p[TX_SIZES - 3][2]; | 825 unsigned int ct_8x8p[TX_SIZES - 3][2]; |
826 unsigned int ct_16x16p[TX_SIZES - 2][2]; | 826 unsigned int ct_16x16p[TX_SIZES - 2][2]; |
827 unsigned int ct_32x32p[TX_SIZES - 1][2]; | 827 unsigned int ct_32x32p[TX_SIZES - 1][2]; |
828 | 828 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 struct vpx_write_bit_buffer wb = {data, 0}; | 1233 struct vpx_write_bit_buffer wb = {data, 0}; |
1234 struct vpx_write_bit_buffer saved_wb; | 1234 struct vpx_write_bit_buffer saved_wb; |
1235 | 1235 |
1236 write_uncompressed_header(cpi, &wb); | 1236 write_uncompressed_header(cpi, &wb); |
1237 saved_wb = wb; | 1237 saved_wb = wb; |
1238 vpx_wb_write_literal(&wb, 0, 16); // don't know in advance first part. size | 1238 vpx_wb_write_literal(&wb, 0, 16); // don't know in advance first part. size |
1239 | 1239 |
1240 uncompressed_hdr_size = vpx_wb_bytes_written(&wb); | 1240 uncompressed_hdr_size = vpx_wb_bytes_written(&wb); |
1241 data += uncompressed_hdr_size; | 1241 data += uncompressed_hdr_size; |
1242 | 1242 |
1243 vp9_clear_system_state(); | 1243 vpx_clear_system_state(); |
1244 | 1244 |
1245 first_part_size = write_compressed_header(cpi, data); | 1245 first_part_size = write_compressed_header(cpi, data); |
1246 data += first_part_size; | 1246 data += first_part_size; |
1247 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. | 1247 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. |
1248 vpx_wb_write_literal(&saved_wb, (int)first_part_size, 16); | 1248 vpx_wb_write_literal(&saved_wb, (int)first_part_size, 16); |
1249 | 1249 |
1250 data += encode_tiles(cpi, data); | 1250 data += encode_tiles(cpi, data); |
1251 | 1251 |
1252 *size = data - dest; | 1252 *size = data - dest; |
1253 } | 1253 } |
OLD | NEW |