diff options
author | Yaowu Xu <yaowu@google.com> | 2016-07-13 20:05:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-07-13 20:05:09 +0000 |
commit | d6197b621d92d0519552e27a799faff49a2c5c2c (patch) | |
tree | 19cefe184e708a4309505594bbb7629171fd5137 | |
parent | fed14a3e949d27f0484c5f4901994f846d7b7474 (diff) | |
parent | 98431cde070a33fe346f1316abd8437cd873dbfa (diff) | |
download | libvpx-d6197b621d92d0519552e27a799faff49a2c5c2c.tar libvpx-d6197b621d92d0519552e27a799faff49a2c5c2c.tar.gz libvpx-d6197b621d92d0519552e27a799faff49a2c5c2c.tar.bz2 libvpx-d6197b621d92d0519552e27a799faff49a2c5c2c.zip |
Merge "Fix encoder crashes for odd size input"
-rw-r--r-- | vp9/vp9_cx_iface.c | 5 | ||||
-rw-r--r-- | vpx_dsp/psnrhvs.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 51c6fbb02..f4e989fb5 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -992,6 +992,7 @@ static vpx_codec_frame_flags_t get_frame_pkt_flags(const VP9_COMP *cpi, return flags; } +const size_t kMinCompressedSize = 8192; static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, const vpx_image_t *img, vpx_codec_pts_t pts, @@ -1013,8 +1014,8 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, // instance for its status to determine the compressed data size. data_sz = ctx->cfg.g_w * ctx->cfg.g_h * get_image_bps(img) / 8 * (cpi->multi_arf_allowed ? 8 : 2); - if (data_sz < 4096) - data_sz = 4096; + if (data_sz < kMinCompressedSize) + data_sz = kMinCompressedSize; if (ctx->cx_data == NULL || ctx->cx_data_sz < data_sz) { ctx->cx_data_sz = data_sz; free(ctx->cx_data); diff --git a/vpx_dsp/psnrhvs.c b/vpx_dsp/psnrhvs.c index 095ba5d13..3708cc3c8 100644 --- a/vpx_dsp/psnrhvs.c +++ b/vpx_dsp/psnrhvs.c @@ -245,6 +245,8 @@ static double calc_psnrhvs(const unsigned char *src, int _systride, } } } + if (pixels <=0) + return 0; ret /= pixels; return ret; } |