Commit aa8a4a59 authored by Jingning Han's avatar Jingning Han
Browse files

Make entropy context scalable to atom transform block size

This commit makes the entropy context operation scalable to the
atom transform block size. No coding statistics change is incurred.

Change-Id: Id10161116d297a2e65815e115993b79542e5a031
parent f0aa420c
......@@ -218,13 +218,58 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
const ENTROPY_CONTEXT *l) {
ENTROPY_CONTEXT above_ec = 0, left_ec = 0;
switch (tx_size) {
#if CONFIG_CB4X4
switch (tx_size) {
case TX_2X2:
above_ec = a[0] != 0;
left_ec = l[0] != 0;
break;
case TX_4X4:
above_ec = !!*(const uint16_t *)a;
left_ec = !!*(const uint16_t *)l;
break;
case TX_4X8:
above_ec = !!*(const uint16_t *)a;
left_ec = !!*(const uint32_t *)l;
break;
case TX_8X4:
above_ec = !!*(const uint32_t *)a;
left_ec = !!*(const uint16_t *)l;
break;
case TX_8X8:
above_ec = !!*(const uint32_t *)a;
left_ec = !!*(const uint32_t *)l;
break;
case TX_8X16:
above_ec = !!*(const uint32_t *)a;
left_ec = !!*(const uint64_t *)l;
break;
case TX_16X8:
above_ec = !!*(const uint64_t *)a;
left_ec = !!*(const uint32_t *)l;
break;
case TX_16X16:
above_ec = !!*(const uint64_t *)a;
left_ec = !!*(const uint64_t *)l;
break;
case TX_16X32:
above_ec = !!*(const uint64_t *)a;
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
case TX_32X16:
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
left_ec = !!*(const uint64_t *)l;
break;
case TX_32X32:
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
default: assert(0 && "Invalid transform size."); break;
}
return combine_entropy_contexts(above_ec, left_ec);
#endif
switch (tx_size) {
case TX_4X4:
above_ec = a[0] != 0;
left_ec = l[0] != 0;
......
......@@ -562,10 +562,83 @@ static void get_entropy_contexts_plane(
const ENTROPY_CONTEXT *const left = pd->left_context;
int i;
switch (tx_size) {
#if CONFIG_CB4X4
switch (tx_size) {
case TX_2X2:
memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w);
memcpy(t_left, left, sizeof(ENTROPY_CONTEXT) * num_4x4_h);
break;
case TX_4X4:
for (i = 0; i < num_4x4_w; i += 2)
t_above[i] = !!*(const uint16_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 2)
t_left[i] = !!*(const uint16_t *)&left[i];
break;
case TX_8X8:
for (i = 0; i < num_4x4_w; i += 4)
t_above[i] = !!*(const uint32_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 4)
t_left[i] = !!*(const uint32_t *)&left[i];
break;
case TX_16X16:
for (i = 0; i < num_4x4_w; i += 8)
t_above[i] = !!*(const uint64_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 8)
t_left[i] = !!*(const uint64_t *)&left[i];
break;
case TX_32X32:
for (i = 0; i < num_4x4_w; i += 16)
t_above[i] =
!!(*(const uint64_t *)&above[i] | *(const uint64_t *)&above[i + 8]);
for (i = 0; i < num_4x4_h; i += 16)
t_left[i] =
!!(*(const uint64_t *)&left[i] | *(const uint64_t *)&left[i + 8]);
break;
case TX_4X8:
for (i = 0; i < num_4x4_w; i += 2)
t_above[i] = !!*(const uint16_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 4)
t_left[i] = !!*(const uint32_t *)&left[i];
break;
case TX_8X4:
for (i = 0; i < num_4x4_w; i += 4)
t_above[i] = !!*(const uint32_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 2)
t_left[i] = !!*(const uint16_t *)&left[i];
break;
case TX_8X16:
for (i = 0; i < num_4x4_w; i += 4)
t_above[i] = !!*(const uint32_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 8)
t_left[i] = !!*(const uint64_t *)&left[i];
break;
case TX_16X8:
for (i = 0; i < num_4x4_w; i += 8)
t_above[i] = !!*(const uint64_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 4)
t_left[i] = !!*(const uint32_t *)&left[i];
break;
case TX_16X32:
for (i = 0; i < num_4x4_w; i += 8)
t_above[i] = !!*(const uint64_t *)&above[i];
for (i = 0; i < num_4x4_h; i += 16)
t_left[i] =
!!(*(const uint64_t *)&left[i] | *(const uint64_t *)&left[i + 8]);
break;
case TX_32X16:
for (i = 0; i < num_4x4_w; i += 16)
t_above[i] =
!!(*(const uint64_t *)&above[i] | *(const uint64_t *)&above[i + 8]);
for (i = 0; i < num_4x4_h; i += 8)
t_left[i] = !!*(const uint64_t *)&left[i];
default: assert(0 && "Invalid transform size."); break;
}
return;
#endif
switch (tx_size) {
case TX_4X4:
memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w);
memcpy(t_left, left, sizeof(ENTROPY_CONTEXT) * num_4x4_h);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment