| 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 | 11 |
| 12 #include "onyx_int.h" | 12 #include "onyx_int.h" |
| 13 #include "mcomp.h" | 13 #include "mcomp.h" |
| 14 #include "vpx_mem/vpx_mem.h" | 14 #include "vpx_mem/vpx_mem.h" |
| 15 #include "vpx_config.h" | 15 #include "vpx_config.h" |
| 16 #include <stdio.h> | 16 #include <stdio.h> |
| 17 #include <limits.h> | 17 #include <limits.h> |
| 18 #include <math.h> | 18 #include <math.h> |
| 19 #include "vp8/common/findnearmv.h" | 19 #include "vp8/common/findnearmv.h" |
| 20 | 20 |
| 21 #ifdef ENTROPY_STATS | 21 #ifdef VP8_ENTROPY_STATS |
| 22 static int mv_ref_ct [31] [4] [2]; | 22 static int mv_ref_ct [31] [4] [2]; |
| 23 static int mv_mode_cts [4] [2]; | 23 static int mv_mode_cts [4] [2]; |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight) | 26 int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight) |
| 27 { | 27 { |
| 28 /* MV costing is based on the distribution of vectors in the previous | 28 /* MV costing is based on the distribution of vectors in the previous |
| 29 * frame and as such will tend to over state the cost of vectors. In | 29 * frame and as such will tend to over state the cost of vectors. In |
| 30 * addition coding a new vector can have a knock on effect on the cost | 30 * addition coding a new vector can have a knock on effect on the cost |
| 31 * of subsequent vectors and the quality of prediction from NEAR and | 31 * of subsequent vectors and the quality of prediction from NEAR and |
| (...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 } | 1905 } |
| 1906 } | 1906 } |
| 1907 | 1907 |
| 1908 this_mv.as_mv.row = ref_mv->as_mv.row << 3; | 1908 this_mv.as_mv.row = ref_mv->as_mv.row << 3; |
| 1909 this_mv.as_mv.col = ref_mv->as_mv.col << 3; | 1909 this_mv.as_mv.col = ref_mv->as_mv.col << 3; |
| 1910 | 1910 |
| 1911 return fn_ptr->vf(what, what_stride, best_address, in_what_stride, &thissad) | 1911 return fn_ptr->vf(what, what_stride, best_address, in_what_stride, &thissad) |
| 1912 + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit); | 1912 + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit); |
| 1913 } | 1913 } |
| 1914 | 1914 |
| 1915 #ifdef ENTROPY_STATS | 1915 #ifdef VP8_ENTROPY_STATS |
| 1916 void print_mode_context(void) | 1916 void print_mode_context(void) |
| 1917 { | 1917 { |
| 1918 FILE *f = fopen("modecont.c", "w"); | 1918 FILE *f = fopen("modecont.c", "w"); |
| 1919 int i, j; | 1919 int i, j; |
| 1920 | 1920 |
| 1921 fprintf(f, "#include \"entropy.h\"\n"); | 1921 fprintf(f, "#include \"entropy.h\"\n"); |
| 1922 fprintf(f, "const int vp8_mode_contexts[6][4] =\n"); | 1922 fprintf(f, "const int vp8_mode_contexts[6][4] =\n"); |
| 1923 fprintf(f, "{\n"); | 1923 fprintf(f, "{\n"); |
| 1924 | 1924 |
| 1925 for (j = 0; j < 6; j++) | 1925 for (j = 0; j < 6; j++) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 fprintf(f, "%5d, ", this_prob); | 1958 fprintf(f, "%5d, ", this_prob); |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 fprintf(f, " },\n"); | 1961 fprintf(f, " },\n"); |
| 1962 } | 1962 } |
| 1963 | 1963 |
| 1964 fprintf(f, "};\n"); | 1964 fprintf(f, "};\n"); |
| 1965 fclose(f); | 1965 fclose(f); |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 /* MV ref count ENTROPY_STATS stats code */ | 1968 /* MV ref count VP8_ENTROPY_STATS stats code */ |
| 1969 #ifdef ENTROPY_STATS | 1969 #ifdef VP8_ENTROPY_STATS |
| 1970 void init_mv_ref_counts() | 1970 void init_mv_ref_counts() |
| 1971 { | 1971 { |
| 1972 vpx_memset(mv_ref_ct, 0, sizeof(mv_ref_ct)); | 1972 vpx_memset(mv_ref_ct, 0, sizeof(mv_ref_ct)); |
| 1973 vpx_memset(mv_mode_cts, 0, sizeof(mv_mode_cts)); | 1973 vpx_memset(mv_mode_cts, 0, sizeof(mv_mode_cts)); |
| 1974 } | 1974 } |
| 1975 | 1975 |
| 1976 void accum_mv_refs(MB_PREDICTION_MODE m, const int ct[4]) | 1976 void accum_mv_refs(MB_PREDICTION_MODE m, const int ct[4]) |
| 1977 { | 1977 { |
| 1978 if (m == ZEROMV) | 1978 if (m == ZEROMV) |
| 1979 { | 1979 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 else | 2013 else |
| 2014 { | 2014 { |
| 2015 ++mv_ref_ct [ct[3]] [3] [1]; | 2015 ++mv_ref_ct [ct[3]] [3] [1]; |
| 2016 ++mv_mode_cts[3][1]; | 2016 ++mv_mode_cts[3][1]; |
| 2017 } | 2017 } |
| 2018 } | 2018 } |
| 2019 } | 2019 } |
| 2020 } | 2020 } |
| 2021 } | 2021 } |
| 2022 | 2022 |
| 2023 #endif/* END MV ref count ENTROPY_STATS stats code */ | 2023 #endif/* END MV ref count VP8_ENTROPY_STATS stats code */ |
| 2024 | 2024 |
| 2025 #endif | 2025 #endif |
| OLD | NEW |