New CLPF: New kernel and RDO for strength and block size
This commit ports a CLPF change from aom/master by manually
cherry-picking:
7560123c066854aa40c4685625454aea03410b18
Change-Id: I61eb08862a101df74a6b65ece459833401e81117
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index a01baa2..bd33881 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2590,7 +2590,22 @@
#if CONFIG_CLPF
static void encode_clpf(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
- aom_wb_write_literal(wb, cm->clpf, 1);
+ aom_wb_write_literal(wb, cm->clpf_strength, 2);
+ if (cm->clpf_strength) {
+ aom_wb_write_literal(wb, cm->clpf_size, 2);
+ if (cm->clpf_size) {
+ int i;
+ // TODO(stemidts): The number of bits to transmit could be
+ // implicitly deduced if transmitted after the filter block or
+ // after the frame (when it's known whether the block is all
+ // skip and implicitly unfiltered). And the bits do not have
+ // 50% probability, so a more efficient coding is possible.
+ aom_wb_write_literal(wb, cm->clpf_numblocks, av1_clpf_maxbits(cm));
+ for (i = 0; i < cm->clpf_numblocks; i++) {
+ aom_wb_write_literal(wb, cm->clpf_blocks[i], 1);
+ }
+ }
+ }
}
#endif