diff --git a/src/encoder.c b/src/encoder.c index 2ad4ab95..2376b1c2 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -1112,7 +1112,15 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb, ti.cb_top[2] = (ti.cb[0] & 0x4 || ti.cb[1] & 0x4 || ti.cb[2] & 0x4 || ti.cb[3] & 0x4)?1:0; residual = ti.cb_top[0] | ti.cb_top[1] | ti.cb_top[2]; - picture_set_block_residual(encoder->in.cur_pic,x_ctb,y_ctb,depth,ti.cb_top[0]); + if(depth == 0) { + picture_set_block_residual(encoder->in.cur_pic,x_ctb ,y_ctb ,depth+1,ti.cb[0] & 0x1); + picture_set_block_residual(encoder->in.cur_pic,x_ctb + 4,y_ctb ,depth+1,ti.cb[1] & 0x1); + picture_set_block_residual(encoder->in.cur_pic,x_ctb ,y_ctb + 4,depth+1,ti.cb[2] & 0x1); + picture_set_block_residual(encoder->in.cur_pic,x_ctb + 4,y_ctb + 4,depth+1,ti.cb[3] & 0x1); + } else { + picture_set_block_residual(encoder->in.cur_pic,x_ctb,y_ctb,depth,ti.cb_top[0]); + } + cabac.ctx = &g_cu_qt_root_cbf_model; CABAC_BIN(&cabac, residual, "rqt_root_cbf"); diff --git a/src/filter.c b/src/filter.c index fe125c88..2d084812 100644 --- a/src/filter.c +++ b/src/filter.c @@ -190,21 +190,20 @@ void filter_deblock_edge_luma(encoder_control *encoder, if((block_idx & 1) == 0) { // CU in the side we are filtering, update every 8-pixels - cu_p = &encoder->in.cur_pic->cu_array[MAX_DEPTH][(x_cu - (dir == EDGE_VER) + (dir == EDGE_HOR ? block_idx/2 : 0)) + - (y_cu - (dir == EDGE_HOR) + (dir == EDGE_VER ? block_idx/2 : 0)) + cu_p = &encoder->in.cur_pic->cu_array[MAX_DEPTH][(x_cu - (dir == EDGE_VER) + (dir == EDGE_HOR ? block_idx>>1 : 0)) + + (y_cu - (dir == EDGE_HOR) + (dir == EDGE_VER ? block_idx>>1 : 0)) * (encoder->in.width_in_lcu << MAX_DEPTH)]; // Filter strength - strength = 0; + strength = 0; // Intra blocks have strength 2 if(cu_q->type == CU_INTRA || cu_p->type == CU_INTRA) { strength = 2; // Non-zero residual and transform boundary - } else if((cu_q->residual || cu_p->residual) && (cu_q->depth==0 ? !((dir == EDGE_VER ? y_cu + (block_idx>>1) : x_cu + (block_idx>>1) )&0x3) : 1 ) ) { + } else if(cu_q->residual || cu_p->residual) { strength = 1; // Absolute motion vector diff between blocks >= 1 (Integer pixel) } else if((abs(cu_q->inter.mv[0] - cu_p->inter.mv[0]) >= 4) || (abs(cu_q->inter.mv[1] - cu_p->inter.mv[1]) >= 4)) { - strength = 1; - + strength = 1; } tc_index = CLIP(0, 51 + 2, (int32_t)(qp + 2*(strength - 1) + (tc_offset_div2 << 1))); tc = g_tc_table_8x8[tc_index] * bitdepth_scale;