summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2020-10-02 10:47:47 -0700
committerJerome Jiang <jianj@google.com>2020-10-02 12:09:01 -0700
commit7e8ea22e4056a3da04b139fcc812a3f6937bbed7 (patch)
treeafe4b9b2c9562ccfda7c4941960851823d32b577 /vp9
parentd017a63feba93bb4ecaee5515e466edfc51712e3 (diff)
downloadlibvpx-7e8ea22e4056a3da04b139fcc812a3f6937bbed7.tar.gz
libvpx-7e8ea22e4056a3da04b139fcc812a3f6937bbed7.tar.bz2
libvpx-7e8ea22e4056a3da04b139fcc812a3f6937bbed7.zip
Add codec control to disable loopfilter for vp9
Change-Id: I6d693e84570c353d20ec314acea43363956c0590
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_encoder.c6
-rw-r--r--vp9/encoder/vp9_encoder.h8
-rw-r--r--vp9/vp9_cx_iface.c9
3 files changed, 23 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 048559061..e513cef84 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3316,6 +3316,12 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
return;
}
+ if (cpi->loopfilter_ctrl == NO_LOOPFILTER ||
+ (!is_reference_frame && cpi->loopfilter_ctrl == LOOPFILTER_REFERENCE)) {
+ lf->filter_level = 0;
+ return;
+ }
+
if (xd->lossless) {
lf->filter_level = 0;
lf->last_filt_level = 0;
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index b201e25c1..263b10cdb 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -147,6 +147,12 @@ typedef enum {
kVeryHighSad = 6,
} CONTENT_STATE_SB;
+typedef enum {
+ LOOPFILTER_ALL = 0,
+ LOOPFILTER_REFERENCE = 1, // Disable loopfilter on non reference frames.
+ NO_LOOPFILTER = 2, // Disable loopfilter on all frames.
+} LOOPFILTER_CONTROL;
+
typedef struct VP9EncoderConfig {
BITSTREAM_PROFILE profile;
vpx_bit_depth_t bit_depth; // Codec bit-depth.
@@ -958,6 +964,8 @@ typedef struct VP9_COMP {
int multi_layer_arf;
vpx_roi_map_t roi;
+
+ LOOPFILTER_CONTROL loopfilter_ctrl;
#if CONFIG_RATE_CTRL
ENCODE_COMMAND encode_command;
PARTITION_INFO *partition_info;
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 172a24823..958693792 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -1724,6 +1724,14 @@ static vpx_codec_err_t ctrl_set_disable_overshoot_maxq_cbr(
return VPX_CODEC_OK;
}
+static vpx_codec_err_t ctrl_set_disable_loopfilter(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ VP9_COMP *const cpi = ctx->cpi;
+ const unsigned int data = va_arg(args, unsigned int);
+ cpi->loopfilter_ctrl = data;
+ return VPX_CODEC_OK;
+}
+
static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ VP8_COPY_REFERENCE, ctrl_copy_reference },
@@ -1775,6 +1783,7 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ VP9E_SET_SVC_GF_TEMPORAL_REF, ctrl_set_svc_gf_temporal_ref },
{ VP9E_SET_SVC_SPATIAL_LAYER_SYNC, ctrl_set_svc_spatial_layer_sync },
{ VP9E_SET_DELTA_Q_UV, ctrl_set_delta_q_uv },
+ { VP9E_SET_DISABLE_LOOPFILTER, ctrl_set_disable_loopfilter },
// Getters
{ VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer },