diff options
author | angiebird <angiebird@google.com> | 2019-11-02 15:22:13 -0700 |
---|---|---|
committer | angiebird <angiebird@google.com> | 2019-11-13 13:47:53 -0800 |
commit | 76cdfe2d732188847002d4bcbde3ed0964d77bb0 (patch) | |
tree | bf7cd376248621062ff1c7ac5b292c7d9869ed88 /vp9/vp9_cx_iface.c | |
parent | 8eb69628c5bd3c3815fe7da724345d8e2ec67a25 (diff) | |
download | libvpx-76cdfe2d732188847002d4bcbde3ed0964d77bb0.tar libvpx-76cdfe2d732188847002d4bcbde3ed0964d77bb0.tar.gz libvpx-76cdfe2d732188847002d4bcbde3ed0964d77bb0.tar.bz2 libvpx-76cdfe2d732188847002d4bcbde3ed0964d77bb0.zip |
Pack psnr pkt outside of vp9_get_compressed_data
Change-Id: I5549c3dbcbe1550824deaebf03178e38c1b07d54
Diffstat (limited to 'vp9/vp9_cx_iface.c')
-rw-r--r-- | vp9/vp9_cx_iface.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index d5aa09b5f..ae5dee47b 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -13,6 +13,7 @@ #include "./vpx_config.h" #include "vpx/vpx_encoder.h" +#include "vpx_dsp/psnr.h" #include "vpx_ports/vpx_once.h" #include "vpx_ports/system_state.h" #include "vpx_util/vpx_timestamp.h" @@ -1117,6 +1118,13 @@ static vpx_codec_frame_flags_t get_frame_pkt_flags(const VP9_COMP *cpi, return flags; } +static INLINE vpx_codec_cx_pkt_t get_psnr_pkt(const PSNR_STATS *psnr) { + vpx_codec_cx_pkt_t pkt; + pkt.kind = VPX_CODEC_PSNR_PKT; + pkt.data.psnr = *psnr; + return pkt; +} + const size_t kMinCompressedSize = 8192; static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, const vpx_image_t *img, @@ -1240,6 +1248,17 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, -1 != vp9_get_compressed_data(cpi, &lib_flags, &size, cx_data, &dst_time_stamp, &dst_end_time_stamp, !img)) { + // Pack psnr pkt + if (size > 0 && !cpi->use_svc) { + // TODO(angiebird): Figure out why we don't need psnr pkt when use_svc + // is on + PSNR_STATS psnr; + if (vp9_get_psnr(cpi, &psnr)) { + vpx_codec_cx_pkt_t psnr_pkt = get_psnr_pkt(&psnr); + vpx_codec_pkt_list_add(&ctx->pkt_list.head, &psnr_pkt); + } + } + if (size || (cpi->use_svc && cpi->svc.skip_enhancement_layer)) { // Pack invisible frames with the next visible frame if (!cpi->common.show_frame || |