From: John Koleszar Date: Thu, 7 Jul 2011 14:38:23 +0000 (-0400) Subject: Set VPX_FRAME_IS_DROPPABLE X-Git-Tag: v0.9.7~51^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37de0b8bdf163e2177f54a8694e952188218282c;p=libvpx Set VPX_FRAME_IS_DROPPABLE Allow the encoder to inform the application that the encoded frame will not be used as a reference. Change-Id: I90e41962325ef73d44da03327deb340d6f7f4860 --- diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index a6d7a4304..a84a7b4da 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -4589,6 +4589,20 @@ int vp8_receive_raw_frame(VP8_PTR ptr, unsigned int frame_flags, YV12_BUFFER_CON } +static int frame_is_reference(const VP8_COMP *cpi) +{ + const VP8_COMMON *cm = &cpi->common; + const MACROBLOCKD *xd = &cpi->mb.e_mbd; + + return cm->frame_type == KEY_FRAME || cm->refresh_last_frame + || cm->refresh_golden_frame || cm->refresh_alt_ref_frame + || cm->copy_buffer_to_gf || cm->copy_buffer_to_arf + || cm->refresh_entropy_probs + || xd->mode_ref_lf_delta_update + || xd->update_mb_segmentation_map || xd->update_mb_segmentation_data; +} + + int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, INT64 *time_stamp, INT64 *time_end, int flush) { #if HAVE_ARMV7 @@ -4845,6 +4859,7 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon // if its a dropped frame honor the requests on subsequent frames if (*size > 0) { + cpi->droppable = !frame_is_reference(cpi); // return to normal state cm->refresh_entropy_probs = 1; diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index b9544a171..ed2073aab 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -615,6 +615,7 @@ typedef struct VP8_COMP #if CONFIG_REALTIME_ONLY int force_next_frame_intra; /* force next frame to intra when kf_auto says so */ #endif + int droppable; } VP8_COMP; void control_data_rate(VP8_COMP *cpi); diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index 5e1278a4c..966355da1 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -798,6 +798,9 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx, pkt.data.frame.duration = 0; } + if (cpi->droppable) + pkt.data.frame.flags |= VPX_FRAME_IS_DROPPABLE; + if (cpi->output_partition) { int i;