Commit 68377282 authored by Yaowu Xu's avatar Yaowu Xu

Add num_plane to av1_copy_tree_context()

To support monochrome video and fixes a nightly test segfault.

BUG=aomedia:1273

Change-Id: I87dd3d5ca79e8f0ce51ee31738205ae5a53af072
parent 4e71fd94
...@@ -215,7 +215,7 @@ void av1_free_pc_tree(ThreadData *td, const int num_planes) { ...@@ -215,7 +215,7 @@ void av1_free_pc_tree(ThreadData *td, const int num_planes) {
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES
void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx, void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx,
PICK_MODE_CONTEXT *src_ctx) { PICK_MODE_CONTEXT *src_ctx, int num_planes) {
dst_ctx->mic = src_ctx->mic; dst_ctx->mic = src_ctx->mic;
dst_ctx->mbmi_ext = src_ctx->mbmi_ext; dst_ctx->mbmi_ext = src_ctx->mbmi_ext;
...@@ -224,7 +224,7 @@ void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx, ...@@ -224,7 +224,7 @@ void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx,
dst_ctx->skippable = src_ctx->skippable; dst_ctx->skippable = src_ctx->skippable;
dst_ctx->best_mode_index = src_ctx->best_mode_index; dst_ctx->best_mode_index = src_ctx->best_mode_index;
for (int i = 0; i < MAX_MB_PLANE; ++i) { for (int i = 0; i < num_planes; ++i) {
memcpy(dst_ctx->blk_skip[i], src_ctx->blk_skip[i], memcpy(dst_ctx->blk_skip[i], src_ctx->blk_skip[i],
sizeof(uint8_t) * src_ctx->num_4x4_blk); sizeof(uint8_t) * src_ctx->num_4x4_blk);
} }
......
...@@ -87,7 +87,7 @@ void av1_setup_pc_tree(struct AV1Common *cm, struct ThreadData *td); ...@@ -87,7 +87,7 @@ void av1_setup_pc_tree(struct AV1Common *cm, struct ThreadData *td);
void av1_free_pc_tree(struct ThreadData *td, const int num_planes); void av1_free_pc_tree(struct ThreadData *td, const int num_planes);
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES
void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx, void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx,
PICK_MODE_CONTEXT *src_ctx); PICK_MODE_CONTEXT *src_ctx, int num_planes);
#endif // CONFIG_EXT_PARTITON_TYPES #endif // CONFIG_EXT_PARTITON_TYPES
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -3029,12 +3029,13 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, ...@@ -3029,12 +3029,13 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
pc_tree->horizontala[1].rd_mode_is_ready = 0; pc_tree->horizontala[1].rd_mode_is_ready = 0;
pc_tree->horizontala[2].rd_mode_is_ready = 0; pc_tree->horizontala[2].rd_mode_is_ready = 0;
if (split_ctx_is_ready[0]) { if (split_ctx_is_ready[0]) {
av1_copy_tree_context(&pc_tree->horizontala[0], &pc_tree->split[0]->none); av1_copy_tree_context(&pc_tree->horizontala[0], &pc_tree->split[0]->none,
num_planes);
pc_tree->horizontala[0].mic.mbmi.partition = PARTITION_HORZ_A; pc_tree->horizontala[0].mic.mbmi.partition = PARTITION_HORZ_A;
pc_tree->horizontala[0].rd_mode_is_ready = 1; pc_tree->horizontala[0].rd_mode_is_ready = 1;
if (split_ctx_is_ready[1]) { if (split_ctx_is_ready[1]) {
av1_copy_tree_context(&pc_tree->horizontala[1], av1_copy_tree_context(&pc_tree->horizontala[1],
&pc_tree->split[1]->none); &pc_tree->split[1]->none, num_planes);
pc_tree->horizontala[1].mic.mbmi.partition = PARTITION_HORZ_A; pc_tree->horizontala[1].mic.mbmi.partition = PARTITION_HORZ_A;
pc_tree->horizontala[1].rd_mode_is_ready = 1; pc_tree->horizontala[1].rd_mode_is_ready = 1;
} }
...@@ -3053,7 +3054,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, ...@@ -3053,7 +3054,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
pc_tree->horizontalb[1].rd_mode_is_ready = 0; pc_tree->horizontalb[1].rd_mode_is_ready = 0;
pc_tree->horizontalb[2].rd_mode_is_ready = 0; pc_tree->horizontalb[2].rd_mode_is_ready = 0;
if (horz_ctx_is_ready) { if (horz_ctx_is_ready) {
av1_copy_tree_context(&pc_tree->horizontalb[0], &pc_tree->horizontal[0]); av1_copy_tree_context(&pc_tree->horizontalb[0], &pc_tree->horizontal[0],
num_planes);
pc_tree->horizontalb[0].mic.mbmi.partition = PARTITION_HORZ_B; pc_tree->horizontalb[0].mic.mbmi.partition = PARTITION_HORZ_B;
pc_tree->horizontalb[0].rd_mode_is_ready = 1; pc_tree->horizontalb[0].rd_mode_is_ready = 1;
} }
...@@ -3081,7 +3083,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, ...@@ -3081,7 +3083,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
pc_tree->verticala[1].rd_mode_is_ready = 0; pc_tree->verticala[1].rd_mode_is_ready = 0;
pc_tree->verticala[2].rd_mode_is_ready = 0; pc_tree->verticala[2].rd_mode_is_ready = 0;
if (split_ctx_is_ready[0]) { if (split_ctx_is_ready[0]) {
av1_copy_tree_context(&pc_tree->verticala[0], &pc_tree->split[0]->none); av1_copy_tree_context(&pc_tree->verticala[0], &pc_tree->split[0]->none,
num_planes);
pc_tree->verticala[0].mic.mbmi.partition = PARTITION_VERT_A; pc_tree->verticala[0].mic.mbmi.partition = PARTITION_VERT_A;
pc_tree->verticala[0].rd_mode_is_ready = 1; pc_tree->verticala[0].rd_mode_is_ready = 1;
} }
...@@ -3099,7 +3102,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, ...@@ -3099,7 +3102,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
pc_tree->verticalb[1].rd_mode_is_ready = 0; pc_tree->verticalb[1].rd_mode_is_ready = 0;
pc_tree->verticalb[2].rd_mode_is_ready = 0; pc_tree->verticalb[2].rd_mode_is_ready = 0;
if (vert_ctx_is_ready) { if (vert_ctx_is_ready) {
av1_copy_tree_context(&pc_tree->verticalb[0], &pc_tree->vertical[0]); av1_copy_tree_context(&pc_tree->verticalb[0], &pc_tree->vertical[0],
num_planes);
pc_tree->verticalb[0].mic.mbmi.partition = PARTITION_VERT_B; pc_tree->verticalb[0].mic.mbmi.partition = PARTITION_VERT_B;
pc_tree->verticalb[0].rd_mode_is_ready = 1; pc_tree->verticalb[0].rd_mode_is_ready = 1;
} }
......
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