Commit c6cc1f5e authored by Rupert Swarbrick's avatar Rupert Swarbrick
Browse files

Fix rate costing for small blocks with skip flag

In av1_rd_pick_intra_mode_sb, the code calculates the rate for Y and
UV planes separately. If the transform coefficient should be zero,
rd_pick_intra_sby_mode and rd_pick_intra_sbuv_mode return the cost of
actually coding up the zero coefficient, but also set a flag (y_skip
or uv_skip) saying that this could be skipped.

Since the skip flag isn't per-plane, av1_rd_pick_intra_mode_sb checks
to see whether both y_skip and uv_skip were true. In that case, it
costs the block for setting the skip flag rather than outputting zero
transform coefficients.

If a small block (less than 8x8) has no chroma information,
x->skip_chroma_rd is true. In that case, we don't call
rd_pick_intra_sbuv_mode and so uv_skip is never set. However, when we
come to write the block, it will be written using the skip flag. This
patch gets the costing right in that case.

Change-Id: Ib31b80b4b44a5c8ed9d9b3f86d782c54927345f3
parent 9dccdf24
......@@ -9654,7 +9654,7 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
&uv_skip, AOMMAX(BLOCK_8X8, bsize), max_uv_tx_size);
#endif // CONFIG_CB4X4
if (y_skip && uv_skip) {
if (y_skip && (uv_skip || x->skip_chroma_rd)) {
rd_cost->rate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly +
av1_cost_bit(av1_get_skip_prob(cm, xd), 1);
rd_cost->dist = dist_y + dist_uv;
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