Merge changes I56cddcb4,I40c5a652 into nextgenv2

* changes:
  Mark bogus palette color probabilities as zero
  get_palette_color_context: code cleanup
This commit is contained in:
Urvang Joshi 2016-10-26 18:28:56 +00:00 коммит произвёл Gerrit Code Review
Родитель 180566d854 f8306bfdc7
Коммит 839b07feec
1 изменённых файлов: 255 добавлений и 256 удалений

Просмотреть файл

@ -567,117 +567,117 @@ const aom_prob
[PALETTE_COLORS - 1] = {
{
// 2 colors
{ 230, 255, 128, 128, 128, 128, 128 },
{ 214, 255, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 240, 255, 128, 128, 128, 128, 128 },
{ 73, 255, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 130, 255, 128, 128, 128, 128, 128 },
{ 227, 255, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 188, 255, 128, 128, 128, 128, 128 },
{ 75, 255, 128, 128, 128, 128, 128 },
{ 250, 255, 128, 128, 128, 128, 128 },
{ 223, 255, 128, 128, 128, 128, 128 },
{ 252, 255, 128, 128, 128, 128, 128 },
{ 230, 0, 0, 0, 0, 0, 0 },
{ 214, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 240, 0, 0, 0, 0, 0, 0 },
{ 73, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 130, 0, 0, 0, 0, 0, 0 },
{ 227, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 188, 0, 0, 0, 0, 0, 0 },
{ 75, 0, 0, 0, 0, 0, 0 },
{ 250, 0, 0, 0, 0, 0, 0 },
{ 223, 0, 0, 0, 0, 0, 0 },
{ 252, 0, 0, 0, 0, 0, 0 },
},
{
// 3 colors
{ 229, 137, 255, 128, 128, 128, 128 },
{ 197, 120, 255, 128, 128, 128, 128 },
{ 107, 195, 255, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 27, 151, 255, 128, 128, 128, 128 },
{ 230, 130, 255, 128, 128, 128, 128 },
{ 37, 230, 255, 128, 128, 128, 128 },
{ 67, 221, 255, 128, 128, 128, 128 },
{ 124, 230, 255, 128, 128, 128, 128 },
{ 195, 109, 255, 128, 128, 128, 128 },
{ 99, 122, 255, 128, 128, 128, 128 },
{ 205, 208, 255, 128, 128, 128, 128 },
{ 40, 235, 255, 128, 128, 128, 128 },
{ 251, 132, 255, 128, 128, 128, 128 },
{ 237, 186, 255, 128, 128, 128, 128 },
{ 253, 112, 255, 128, 128, 128, 128 },
{ 229, 137, 0, 0, 0, 0, 0 },
{ 197, 120, 0, 0, 0, 0, 0 },
{ 107, 195, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 27, 151, 0, 0, 0, 0, 0 },
{ 230, 130, 0, 0, 0, 0, 0 },
{ 37, 230, 0, 0, 0, 0, 0 },
{ 67, 221, 0, 0, 0, 0, 0 },
{ 124, 230, 0, 0, 0, 0, 0 },
{ 195, 109, 0, 0, 0, 0, 0 },
{ 99, 122, 0, 0, 0, 0, 0 },
{ 205, 208, 0, 0, 0, 0, 0 },
{ 40, 235, 0, 0, 0, 0, 0 },
{ 251, 132, 0, 0, 0, 0, 0 },
{ 237, 186, 0, 0, 0, 0, 0 },
{ 253, 112, 0, 0, 0, 0, 0 },
},
{
// 4 colors
{ 195, 87, 128, 255, 128, 128, 128 },
{ 143, 100, 123, 255, 128, 128, 128 },
{ 94, 124, 119, 255, 128, 128, 128 },
{ 77, 91, 130, 255, 128, 128, 128 },
{ 39, 114, 178, 255, 128, 128, 128 },
{ 222, 94, 125, 255, 128, 128, 128 },
{ 44, 203, 132, 255, 128, 128, 128 },
{ 68, 175, 122, 255, 128, 128, 128 },
{ 110, 187, 124, 255, 128, 128, 128 },
{ 152, 91, 128, 255, 128, 128, 128 },
{ 70, 109, 181, 255, 128, 128, 128 },
{ 133, 113, 164, 255, 128, 128, 128 },
{ 47, 205, 133, 255, 128, 128, 128 },
{ 247, 94, 136, 255, 128, 128, 128 },
{ 205, 122, 146, 255, 128, 128, 128 },
{ 251, 100, 141, 255, 128, 128, 128 },
{ 195, 87, 128, 0, 0, 0, 0 },
{ 143, 100, 123, 0, 0, 0, 0 },
{ 94, 124, 119, 0, 0, 0, 0 },
{ 77, 91, 130, 0, 0, 0, 0 },
{ 39, 114, 178, 0, 0, 0, 0 },
{ 222, 94, 125, 0, 0, 0, 0 },
{ 44, 203, 132, 0, 0, 0, 0 },
{ 68, 175, 122, 0, 0, 0, 0 },
{ 110, 187, 124, 0, 0, 0, 0 },
{ 152, 91, 128, 0, 0, 0, 0 },
{ 70, 109, 181, 0, 0, 0, 0 },
{ 133, 113, 164, 0, 0, 0, 0 },
{ 47, 205, 133, 0, 0, 0, 0 },
{ 247, 94, 136, 0, 0, 0, 0 },
{ 205, 122, 146, 0, 0, 0, 0 },
{ 251, 100, 141, 0, 0, 0, 0 },
},
{
// 5 colors
{ 195, 65, 84, 125, 255, 128, 128 },
{ 150, 76, 84, 121, 255, 128, 128 },
{ 94, 110, 81, 117, 255, 128, 128 },
{ 79, 85, 91, 139, 255, 128, 128 },
{ 26, 102, 139, 127, 255, 128, 128 },
{ 220, 73, 91, 119, 255, 128, 128 },
{ 38, 203, 86, 127, 255, 128, 128 },
{ 61, 186, 72, 124, 255, 128, 128 },
{ 132, 199, 84, 128, 255, 128, 128 },
{ 172, 52, 62, 120, 255, 128, 128 },
{ 102, 89, 121, 122, 255, 128, 128 },
{ 182, 48, 69, 186, 255, 128, 128 },
{ 36, 206, 87, 126, 255, 128, 128 },
{ 249, 55, 67, 122, 255, 128, 128 },
{ 218, 88, 75, 122, 255, 128, 128 },
{ 253, 64, 80, 119, 255, 128, 128 },
{ 195, 65, 84, 125, 0, 0, 0 },
{ 150, 76, 84, 121, 0, 0, 0 },
{ 94, 110, 81, 117, 0, 0, 0 },
{ 79, 85, 91, 139, 0, 0, 0 },
{ 26, 102, 139, 127, 0, 0, 0 },
{ 220, 73, 91, 119, 0, 0, 0 },
{ 38, 203, 86, 127, 0, 0, 0 },
{ 61, 186, 72, 124, 0, 0, 0 },
{ 132, 199, 84, 128, 0, 0, 0 },
{ 172, 52, 62, 120, 0, 0, 0 },
{ 102, 89, 121, 122, 0, 0, 0 },
{ 182, 48, 69, 186, 0, 0, 0 },
{ 36, 206, 87, 126, 0, 0, 0 },
{ 249, 55, 67, 122, 0, 0, 0 },
{ 218, 88, 75, 122, 0, 0, 0 },
{ 253, 64, 80, 119, 0, 0, 0 },
},
{
// 6 colors
{ 182, 54, 64, 75, 118, 255, 128 },
{ 126, 67, 70, 76, 116, 255, 128 },
{ 79, 92, 67, 85, 120, 255, 128 },
{ 63, 61, 81, 118, 132, 255, 128 },
{ 21, 80, 105, 83, 119, 255, 128 },
{ 215, 72, 74, 74, 111, 255, 128 },
{ 50, 176, 63, 79, 120, 255, 128 },
{ 72, 148, 66, 77, 120, 255, 128 },
{ 105, 177, 57, 78, 130, 255, 128 },
{ 150, 66, 66, 80, 127, 255, 128 },
{ 81, 76, 109, 85, 116, 255, 128 },
{ 113, 81, 62, 96, 148, 255, 128 },
{ 54, 179, 69, 82, 121, 255, 128 },
{ 244, 47, 48, 67, 118, 255, 128 },
{ 198, 83, 53, 65, 121, 255, 128 },
{ 250, 42, 51, 69, 110, 255, 128 },
{ 182, 54, 64, 75, 118, 0, 0 },
{ 126, 67, 70, 76, 116, 0, 0 },
{ 79, 92, 67, 85, 120, 0, 0 },
{ 63, 61, 81, 118, 132, 0, 0 },
{ 21, 80, 105, 83, 119, 0, 0 },
{ 215, 72, 74, 74, 111, 0, 0 },
{ 50, 176, 63, 79, 120, 0, 0 },
{ 72, 148, 66, 77, 120, 0, 0 },
{ 105, 177, 57, 78, 130, 0, 0 },
{ 150, 66, 66, 80, 127, 0, 0 },
{ 81, 76, 109, 85, 116, 0, 0 },
{ 113, 81, 62, 96, 148, 0, 0 },
{ 54, 179, 69, 82, 121, 0, 0 },
{ 244, 47, 48, 67, 118, 0, 0 },
{ 198, 83, 53, 65, 121, 0, 0 },
{ 250, 42, 51, 69, 110, 0, 0 },
},
{
// 7 colors
{ 182, 45, 54, 62, 74, 113, 255 },
{ 124, 63, 57, 62, 77, 114, 255 },
{ 77, 80, 56, 66, 76, 117, 255 },
{ 63, 57, 69, 98, 85, 131, 255 },
{ 19, 81, 98, 63, 80, 116, 255 },
{ 215, 56, 60, 63, 68, 105, 255 },
{ 50, 174, 50, 60, 79, 118, 255 },
{ 68, 151, 50, 58, 73, 117, 255 },
{ 104, 182, 53, 57, 79, 127, 255 },
{ 156, 50, 51, 63, 77, 111, 255 },
{ 88, 67, 97, 59, 82, 120, 255 },
{ 114, 81, 46, 65, 103, 132, 255 },
{ 55, 166, 57, 66, 82, 120, 255 },
{ 245, 34, 38, 43, 63, 114, 255 },
{ 203, 68, 45, 47, 60, 118, 255 },
{ 250, 35, 37, 47, 66, 110, 255 },
{ 182, 45, 54, 62, 74, 113, 0 },
{ 124, 63, 57, 62, 77, 114, 0 },
{ 77, 80, 56, 66, 76, 117, 0 },
{ 63, 57, 69, 98, 85, 131, 0 },
{ 19, 81, 98, 63, 80, 116, 0 },
{ 215, 56, 60, 63, 68, 105, 0 },
{ 50, 174, 50, 60, 79, 118, 0 },
{ 68, 151, 50, 58, 73, 117, 0 },
{ 104, 182, 53, 57, 79, 127, 0 },
{ 156, 50, 51, 63, 77, 111, 0 },
{ 88, 67, 97, 59, 82, 120, 0 },
{ 114, 81, 46, 65, 103, 132, 0 },
{ 55, 166, 57, 66, 82, 120, 0 },
{ 245, 34, 38, 43, 63, 114, 0 },
{ 203, 68, 45, 47, 60, 118, 0 },
{ 250, 35, 37, 47, 66, 110, 0 },
},
{
// 8 colors
@ -700,141 +700,144 @@ const aom_prob
}
};
const aom_prob av1_default_palette_uv_color_prob
[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS]
[PALETTE_COLORS - 1] = { {
// 2 colors
{ 228, 255, 128, 128, 128, 128, 128 },
{ 195, 255, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 228, 255, 128, 128, 128, 128, 128 },
{ 71, 255, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 129, 255, 128, 128, 128, 128, 128 },
{ 206, 255, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 136, 255, 128, 128, 128, 128, 128 },
{ 98, 255, 128, 128, 128, 128, 128 },
{ 236, 255, 128, 128, 128, 128, 128 },
{ 222, 255, 128, 128, 128, 128, 128 },
{ 249, 255, 128, 128, 128, 128, 128 },
},
{
// 3 colors
{ 198, 136, 255, 128, 128, 128, 128 },
{ 178, 105, 255, 128, 128, 128, 128 },
{ 100, 206, 255, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128 },
{ 12, 136, 255, 128, 128, 128, 128 },
{ 219, 134, 255, 128, 128, 128, 128 },
{ 50, 198, 255, 128, 128, 128, 128 },
{ 61, 231, 255, 128, 128, 128, 128 },
{ 110, 209, 255, 128, 128, 128, 128 },
{ 173, 106, 255, 128, 128, 128, 128 },
{ 145, 166, 255, 128, 128, 128, 128 },
{ 156, 175, 255, 128, 128, 128, 128 },
{ 69, 183, 255, 128, 128, 128, 128 },
{ 241, 163, 255, 128, 128, 128, 128 },
{ 224, 160, 255, 128, 128, 128, 128 },
{ 246, 154, 255, 128, 128, 128, 128 },
},
{
// 4 colors
{ 173, 88, 143, 255, 128, 128, 128 },
{ 146, 81, 127, 255, 128, 128, 128 },
{ 84, 134, 102, 255, 128, 128, 128 },
{ 69, 138, 140, 255, 128, 128, 128 },
{ 31, 103, 200, 255, 128, 128, 128 },
{ 217, 101, 139, 255, 128, 128, 128 },
{ 51, 174, 121, 255, 128, 128, 128 },
{ 64, 177, 109, 255, 128, 128, 128 },
{ 96, 179, 145, 255, 128, 128, 128 },
{ 164, 77, 114, 255, 128, 128, 128 },
{ 87, 94, 156, 255, 128, 128, 128 },
{ 105, 57, 173, 255, 128, 128, 128 },
{ 63, 158, 137, 255, 128, 128, 128 },
{ 236, 102, 156, 255, 128, 128, 128 },
{ 197, 115, 153, 255, 128, 128, 128 },
{ 245, 106, 154, 255, 128, 128, 128 },
},
{
// 5 colors
{ 179, 64, 97, 129, 255, 128, 128 },
{ 137, 56, 88, 125, 255, 128, 128 },
{ 82, 107, 61, 118, 255, 128, 128 },
{ 59, 113, 86, 115, 255, 128, 128 },
{ 23, 88, 118, 130, 255, 128, 128 },
{ 213, 66, 90, 125, 255, 128, 128 },
{ 37, 181, 103, 121, 255, 128, 128 },
{ 47, 188, 61, 131, 255, 128, 128 },
{ 104, 185, 103, 144, 255, 128, 128 },
{ 163, 39, 76, 112, 255, 128, 128 },
{ 94, 74, 131, 126, 255, 128, 128 },
{ 142, 42, 103, 163, 255, 128, 128 },
{ 53, 162, 99, 149, 255, 128, 128 },
{ 239, 54, 84, 108, 255, 128, 128 },
{ 203, 84, 110, 147, 255, 128, 128 },
{ 248, 70, 105, 151, 255, 128, 128 },
},
{
// 6 colors
{ 189, 50, 67, 90, 130, 255, 128 },
{ 114, 50, 55, 90, 123, 255, 128 },
{ 66, 76, 54, 82, 128, 255, 128 },
{ 43, 69, 69, 80, 129, 255, 128 },
{ 22, 59, 87, 88, 141, 255, 128 },
{ 203, 49, 68, 87, 122, 255, 128 },
{ 43, 157, 74, 104, 146, 255, 128 },
{ 54, 138, 51, 95, 138, 255, 128 },
{ 82, 171, 58, 102, 146, 255, 128 },
{ 129, 38, 59, 64, 168, 255, 128 },
{ 56, 67, 119, 92, 112, 255, 128 },
{ 96, 62, 53, 132, 82, 255, 128 },
{ 60, 147, 77, 108, 145, 255, 128 },
{ 238, 76, 73, 93, 148, 255, 128 },
{ 189, 86, 73, 103, 157, 255, 128 },
{ 246, 62, 75, 83, 167, 255, 128 },
},
{
// 7 colors
{ 179, 42, 51, 73, 99, 134, 255 },
{ 119, 52, 52, 61, 64, 114, 255 },
{ 53, 77, 35, 65, 71, 131, 255 },
{ 38, 70, 51, 68, 89, 144, 255 },
{ 23, 65, 128, 73, 97, 131, 255 },
{ 210, 47, 52, 63, 81, 143, 255 },
{ 42, 159, 57, 68, 98, 143, 255 },
{ 49, 153, 45, 82, 93, 143, 255 },
{ 81, 169, 52, 72, 113, 151, 255 },
{ 136, 46, 35, 56, 75, 96, 255 },
{ 57, 84, 109, 47, 107, 131, 255 },
{ 128, 78, 57, 36, 128, 85, 255 },
{ 54, 149, 68, 77, 94, 153, 255 },
{ 243, 58, 50, 71, 81, 167, 255 },
{ 189, 92, 64, 70, 121, 173, 255 },
{ 248, 35, 38, 51, 82, 201, 255 },
},
{
// 8 colors
{ 201, 40, 36, 42, 64, 92, 123 },
{ 116, 43, 33, 43, 73, 102, 128 },
{ 46, 77, 37, 69, 62, 78, 150 },
{ 40, 65, 52, 50, 76, 89, 133 },
{ 28, 48, 91, 17, 64, 77, 133 },
{ 218, 43, 43, 37, 56, 72, 163 },
{ 41, 155, 44, 83, 82, 129, 180 },
{ 44, 141, 29, 55, 64, 89, 147 },
{ 92, 166, 48, 45, 59, 126, 179 },
{ 169, 35, 49, 41, 36, 99, 139 },
{ 55, 77, 77, 56, 60, 75, 156 },
{ 155, 81, 51, 64, 57, 182, 255 },
{ 60, 134, 49, 49, 93, 128, 174 },
{ 244, 98, 51, 46, 22, 73, 238 },
{ 189, 70, 40, 87, 93, 79, 201 },
{ 248, 54, 49, 40, 29, 42, 227 },
} };
const aom_prob
av1_default_palette_uv_color_prob[PALETTE_MAX_SIZE - 1]
[PALETTE_COLOR_CONTEXTS]
[PALETTE_COLORS - 1] = {
{
// 2 colors
{ 228, 0, 0, 0, 0, 0, 0 },
{ 195, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 228, 0, 0, 0, 0, 0, 0 },
{ 71, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 129, 0, 0, 0, 0, 0, 0 },
{ 206, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 136, 0, 0, 0, 0, 0, 0 },
{ 98, 0, 0, 0, 0, 0, 0 },
{ 236, 0, 0, 0, 0, 0, 0 },
{ 222, 0, 0, 0, 0, 0, 0 },
{ 249, 0, 0, 0, 0, 0, 0 },
},
{
// 3 colors
{ 198, 136, 0, 0, 0, 0, 0 },
{ 178, 105, 0, 0, 0, 0, 0 },
{ 100, 206, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 },
{ 12, 136, 0, 0, 0, 0, 0 },
{ 219, 134, 0, 0, 0, 0, 0 },
{ 50, 198, 0, 0, 0, 0, 0 },
{ 61, 231, 0, 0, 0, 0, 0 },
{ 110, 209, 0, 0, 0, 0, 0 },
{ 173, 106, 0, 0, 0, 0, 0 },
{ 145, 166, 0, 0, 0, 0, 0 },
{ 156, 175, 0, 0, 0, 0, 0 },
{ 69, 183, 0, 0, 0, 0, 0 },
{ 241, 163, 0, 0, 0, 0, 0 },
{ 224, 160, 0, 0, 0, 0, 0 },
{ 246, 154, 0, 0, 0, 0, 0 },
},
{
// 4 colors
{ 173, 88, 143, 0, 0, 0, 0 },
{ 146, 81, 127, 0, 0, 0, 0 },
{ 84, 134, 102, 0, 0, 0, 0 },
{ 69, 138, 140, 0, 0, 0, 0 },
{ 31, 103, 200, 0, 0, 0, 0 },
{ 217, 101, 139, 0, 0, 0, 0 },
{ 51, 174, 121, 0, 0, 0, 0 },
{ 64, 177, 109, 0, 0, 0, 0 },
{ 96, 179, 145, 0, 0, 0, 0 },
{ 164, 77, 114, 0, 0, 0, 0 },
{ 87, 94, 156, 0, 0, 0, 0 },
{ 105, 57, 173, 0, 0, 0, 0 },
{ 63, 158, 137, 0, 0, 0, 0 },
{ 236, 102, 156, 0, 0, 0, 0 },
{ 197, 115, 153, 0, 0, 0, 0 },
{ 245, 106, 154, 0, 0, 0, 0 },
},
{
// 5 colors
{ 179, 64, 97, 129, 0, 0, 0 },
{ 137, 56, 88, 125, 0, 0, 0 },
{ 82, 107, 61, 118, 0, 0, 0 },
{ 59, 113, 86, 115, 0, 0, 0 },
{ 23, 88, 118, 130, 0, 0, 0 },
{ 213, 66, 90, 125, 0, 0, 0 },
{ 37, 181, 103, 121, 0, 0, 0 },
{ 47, 188, 61, 131, 0, 0, 0 },
{ 104, 185, 103, 144, 0, 0, 0 },
{ 163, 39, 76, 112, 0, 0, 0 },
{ 94, 74, 131, 126, 0, 0, 0 },
{ 142, 42, 103, 163, 0, 0, 0 },
{ 53, 162, 99, 149, 0, 0, 0 },
{ 239, 54, 84, 108, 0, 0, 0 },
{ 203, 84, 110, 147, 0, 0, 0 },
{ 248, 70, 105, 151, 0, 0, 0 },
},
{
// 6 colors
{ 189, 50, 67, 90, 130, 0, 0 },
{ 114, 50, 55, 90, 123, 0, 0 },
{ 66, 76, 54, 82, 128, 0, 0 },
{ 43, 69, 69, 80, 129, 0, 0 },
{ 22, 59, 87, 88, 141, 0, 0 },
{ 203, 49, 68, 87, 122, 0, 0 },
{ 43, 157, 74, 104, 146, 0, 0 },
{ 54, 138, 51, 95, 138, 0, 0 },
{ 82, 171, 58, 102, 146, 0, 0 },
{ 129, 38, 59, 64, 168, 0, 0 },
{ 56, 67, 119, 92, 112, 0, 0 },
{ 96, 62, 53, 132, 82, 0, 0 },
{ 60, 147, 77, 108, 145, 0, 0 },
{ 238, 76, 73, 93, 148, 0, 0 },
{ 189, 86, 73, 103, 157, 0, 0 },
{ 246, 62, 75, 83, 167, 0, 0 },
},
{
// 7 colors
{ 179, 42, 51, 73, 99, 134, 0 },
{ 119, 52, 52, 61, 64, 114, 0 },
{ 53, 77, 35, 65, 71, 131, 0 },
{ 38, 70, 51, 68, 89, 144, 0 },
{ 23, 65, 128, 73, 97, 131, 0 },
{ 210, 47, 52, 63, 81, 143, 0 },
{ 42, 159, 57, 68, 98, 143, 0 },
{ 49, 153, 45, 82, 93, 143, 0 },
{ 81, 169, 52, 72, 113, 151, 0 },
{ 136, 46, 35, 56, 75, 96, 0 },
{ 57, 84, 109, 47, 107, 131, 0 },
{ 128, 78, 57, 36, 128, 85, 0 },
{ 54, 149, 68, 77, 94, 153, 0 },
{ 243, 58, 50, 71, 81, 167, 0 },
{ 189, 92, 64, 70, 121, 173, 0 },
{ 248, 35, 38, 51, 82, 201, 0 },
},
{
// 8 colors
{ 201, 40, 36, 42, 64, 92, 123 },
{ 116, 43, 33, 43, 73, 102, 128 },
{ 46, 77, 37, 69, 62, 78, 150 },
{ 40, 65, 52, 50, 76, 89, 133 },
{ 28, 48, 91, 17, 64, 77, 133 },
{ 218, 43, 43, 37, 56, 72, 163 },
{ 41, 155, 44, 83, 82, 129, 180 },
{ 44, 141, 29, 55, 64, 89, 147 },
{ 92, 166, 48, 45, 59, 126, 179 },
{ 169, 35, 49, 41, 36, 99, 139 },
{ 55, 77, 77, 56, 60, 75, 156 },
{ 155, 81, 51, 64, 57, 182, 255 },
{ 60, 134, 49, 49, 93, 128, 174 },
{ 244, 98, 51, 46, 22, 73, 238 },
{ 189, 70, 40, 87, 93, 79, 201 },
{ 248, 54, 49, 40, 29, 42, 227 },
}
};
static const int palette_color_context_lookup[PALETTE_COLOR_CONTEXTS] = {
// (3, 0, 0, 0), (3, 2, 0, 0), (3, 3, 2, 0), (3, 3, 2, 2),
@ -902,30 +905,24 @@ static const aom_prob default_rect_tx_prob[TX_SIZES - 1] = { 192, 192, 192 };
int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
int c, int n, uint8_t *color_order,
int *color_idx) {
int i, j, max, max_idx, temp;
int i;
// The +10 below should not be needed. But we get a warning "array subscript
// is above array bounds [-Werror=array-bounds]" without it, possibly due to
// this (or similar) bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124
int scores[PALETTE_MAX_SIZE + 10];
int weights[4] = { 3, 2, 3, 2 };
const int weights[4] = { 3, 2, 3, 2 };
int color_ctx = 0;
int color_neighbors[4];
int inverse_color_order[PALETTE_MAX_SIZE];
assert(n <= PALETTE_MAX_SIZE);
if (c - 1 >= 0)
color_neighbors[0] = color_map[r * cols + c - 1];
else
color_neighbors[0] = -1;
if (c - 1 >= 0 && r - 1 >= 0)
color_neighbors[1] = color_map[(r - 1) * cols + c - 1];
else
color_neighbors[1] = -1;
if (r - 1 >= 0)
color_neighbors[2] = color_map[(r - 1) * cols + c];
else
color_neighbors[2] = -1;
if (r - 1 >= 0 && c + 1 <= cols - 1)
color_neighbors[3] = color_map[(r - 1) * cols + c + 1];
else
color_neighbors[3] = -1;
color_neighbors[0] = (c - 1 >= 0) ? color_map[r * cols + c - 1] : -1;
color_neighbors[1] =
(c - 1 >= 0 && r - 1 >= 0) ? color_map[(r - 1) * cols + c - 1] : -1;
color_neighbors[2] = (r - 1 >= 0) ? color_map[(r - 1) * cols + c] : -1;
color_neighbors[3] = (r - 1 >= 0 && c + 1 <= cols - 1)
? color_map[(r - 1) * cols + c + 1]
: -1;
for (i = 0; i < PALETTE_MAX_SIZE; ++i) {
color_order[i] = i;
@ -933,23 +930,25 @@ int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
}
memset(scores, 0, PALETTE_MAX_SIZE * sizeof(scores[0]));
for (i = 0; i < 4; ++i) {
if (color_neighbors[i] >= 0) scores[color_neighbors[i]] += weights[i];
if (color_neighbors[i] >= 0) {
scores[color_neighbors[i]] += weights[i];
}
}
// Get the top 4 scores (sorted from large to small).
for (i = 0; i < 4; ++i) {
max = scores[i];
max_idx = i;
j = i + 1;
while (j < n) {
int max = scores[i];
int max_idx = i;
int j;
for (j = i + 1; j < n; ++j) {
if (scores[j] > max) {
max = scores[j];
max_idx = j;
}
++j;
}
if (max_idx != i) {
temp = scores[i];
int temp = scores[i];
scores[i] = scores[max_idx];
scores[max_idx] = temp;