summaryrefslogtreecommitdiff
path: root/vp8/encoder/bitstream.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2010-09-29 13:04:04 -0400
committerJohn Koleszar <jkoleszar@google.com>2010-09-29 13:04:04 -0400
commitb9be7a464f065c3700f937eea01d9298002b37eb (patch)
treef9d9d22690afe087df44733543fe29a68ef66e31 /vp8/encoder/bitstream.c
parent7288cdf79dd179d5bbf927db6240e3b9a4da412b (diff)
downloadlibvpx-b9be7a464f065c3700f937eea01d9298002b37eb.tar
libvpx-b9be7a464f065c3700f937eea01d9298002b37eb.tar.gz
libvpx-b9be7a464f065c3700f937eea01d9298002b37eb.tar.bz2
libvpx-b9be7a464f065c3700f937eea01d9298002b37eb.zip
Fix loopfilter delta zero transitions
Loopfilter deltas are initialized to zero on keyframes in the decoder. The values then persist from the previous frame unless an update bit is set in the bitstream. This data is not included in the entropy data saved by the 'refresh entropy' bit in the bitstream, so it is effectively an additional contextual element beyond the 3 ref-frames and the entropy data. The encoder was treating this delta update bit as update-if-nonzero, meaning that the value would be refreshed even if it hadn't changed, and more significantly, if the correct value for the delta changed to zero, the update wouldn't be sent, and the decoder would preserve the last (presumably non-zero) value. This patch updates the encoder to send an update only if the value has changed from the previously transmitted value. It also forces the value to be transmitted in error resilient mode, to account for lost context in the event of lost frames. Change-Id: I56671d5b42965d0166ac226765dbfce3e5301868
Diffstat (limited to 'vp8/encoder/bitstream.c')
-rw-r--r--vp8/encoder/bitstream.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 929c17841..412542d10 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -1490,9 +1490,11 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
if (xd->mode_ref_lf_delta_enabled)
{
// Do the deltas need to be updated
- vp8_write_bit(bc, (xd->mode_ref_lf_delta_update) ? 1 : 0);
+ int send_update = xd->mode_ref_lf_delta_update
+ || cpi->oxcf.error_resilient_mode;
- if (xd->mode_ref_lf_delta_update)
+ vp8_write_bit(bc, send_update);
+ if (send_update)
{
int Data;
@@ -1502,8 +1504,10 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
Data = xd->ref_lf_deltas[i];
// Frame level data
- if (Data)
+ if (xd->ref_lf_deltas[i] != xd->last_ref_lf_deltas[i]
+ || cpi->oxcf.error_resilient_mode)
{
+ xd->last_ref_lf_deltas[i] = xd->ref_lf_deltas[i];
vp8_write_bit(bc, 1);
if (Data > 0)
@@ -1527,8 +1531,10 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
{
Data = xd->mode_lf_deltas[i];
- if (Data)
+ if (xd->mode_lf_deltas[i] != xd->last_mode_lf_deltas[i]
+ || cpi->oxcf.error_resilient_mode)
{
+ xd->last_mode_lf_deltas[i] = xd->mode_lf_deltas[i];
vp8_write_bit(bc, 1);
if (Data > 0)