summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorMinghai Shang <minghai@google.com>2014-09-12 10:52:42 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-09-12 10:52:42 -0700
commit3e7b04af54e9133c94527aa970b398c009adcbef (patch)
treec4b4553b341257ad646154ea91ffc44d28203f8e /vp9
parent7f77a1c3c96ec582fa6b8682320d60fb389be94b (diff)
parente3fff31aff4f6be8aad493bc954f60ad5cc2f8f5 (diff)
downloadlibvpx-3e7b04af54e9133c94527aa970b398c009adcbef.tar
libvpx-3e7b04af54e9133c94527aa970b398c009adcbef.tar.gz
libvpx-3e7b04af54e9133c94527aa970b398c009adcbef.tar.bz2
libvpx-3e7b04af54e9133c94527aa970b398c009adcbef.zip
Merge "[spatial svc] Output psnr for all layers in one packet."
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_encoder.c5
-rw-r--r--vp9/encoder/vp9_svc_layercontext.h1
-rw-r--r--vp9/vp9_cx_iface.c17
3 files changed, 16 insertions, 7 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 627bff68a..b3884d056 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1280,7 +1280,10 @@ static void generate_psnr_packet(VP9_COMP *cpi) {
pkt.data.psnr.psnr[i] = psnr.psnr[i];
}
pkt.kind = VPX_CODEC_PSNR_PKT;
- vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
+ if (is_two_pass_svc(cpi))
+ cpi->svc.layer_context[cpi->svc.spatial_layer_id].psnr_pkt = pkt.data.psnr;
+ else
+ vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
}
int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags) {
diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h
index 1fc43a427..d180d1a8c 100644
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -36,6 +36,7 @@ typedef struct {
int gold_ref_idx;
int has_alt_frame;
size_t layer_size;
+ struct vpx_psnr_pkt psnr_pkt;
} LAYER_CONTEXT;
typedef struct {
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 9bf1aa270..0851d8a08 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -985,15 +985,20 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
cx_data_sz -= size;
#if CONFIG_SPATIAL_SVC
if (is_two_pass_svc(cpi)) {
- vpx_codec_cx_pkt_t pkt;
+ vpx_codec_cx_pkt_t pkt_sizes, pkt_psnr;
int i;
- vp9_zero(pkt);
- pkt.kind = VPX_CODEC_SPATIAL_SVC_LAYER_SIZES;
+ vp9_zero(pkt_sizes);
+ vp9_zero(pkt_psnr);
+ pkt_sizes.kind = VPX_CODEC_SPATIAL_SVC_LAYER_SIZES;
+ pkt_psnr.kind = VPX_CODEC_SPATIAL_SVC_LAYER_PSNR;
for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
- pkt.data.layer_sizes[i] = cpi->svc.layer_context[i].layer_size;
- cpi->svc.layer_context[i].layer_size = 0;
+ LAYER_CONTEXT *lc = &cpi->svc.layer_context[i];
+ pkt_sizes.data.layer_sizes[i] = lc->layer_size;
+ pkt_psnr.data.layer_psnr[i] = lc->psnr_pkt;
+ lc->layer_size = 0;
}
- vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
+ vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt_sizes);
+ vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt_psnr);
}
#endif
}