Merge "Fix loopfilter delta zero transitions"
This commit is contained in:
commit
a047fee606
@ -262,9 +262,9 @@ typedef struct
|
|||||||
unsigned char mode_ref_lf_delta_update;
|
unsigned char mode_ref_lf_delta_update;
|
||||||
|
|
||||||
// Delta values have the range +/- MAX_LOOP_FILTER
|
// Delta values have the range +/- MAX_LOOP_FILTER
|
||||||
//char ref_lf_deltas[MAX_REF_LF_DELTAS]; // 0 = Intra, Last, GF, ARF
|
signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; // 0 = Intra, Last, GF, ARF
|
||||||
//char mode_lf_deltas[MAX_MODE_LF_DELTAS]; // 0 = BPRED, ZERO_MV, MV, SPLIT
|
|
||||||
signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; // 0 = Intra, Last, GF, ARF
|
signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; // 0 = Intra, Last, GF, ARF
|
||||||
|
signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; // 0 = BPRED, ZERO_MV, MV, SPLIT
|
||||||
signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; // 0 = BPRED, ZERO_MV, MV, SPLIT
|
signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; // 0 = BPRED, ZERO_MV, MV, SPLIT
|
||||||
|
|
||||||
// Distance of MB away from frame edges
|
// Distance of MB away from frame edges
|
||||||
|
@ -1490,9 +1490,11 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
|
|||||||
if (xd->mode_ref_lf_delta_enabled)
|
if (xd->mode_ref_lf_delta_enabled)
|
||||||
{
|
{
|
||||||
// Do the deltas need to be updated
|
// 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;
|
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];
|
Data = xd->ref_lf_deltas[i];
|
||||||
|
|
||||||
// Frame level data
|
// 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);
|
vp8_write_bit(bc, 1);
|
||||||
|
|
||||||
if (Data > 0)
|
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];
|
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);
|
vp8_write_bit(bc, 1);
|
||||||
|
|
||||||
if (Data > 0)
|
if (Data > 0)
|
||||||
|
@ -272,6 +272,8 @@ static void setup_features(VP8_COMP *cpi)
|
|||||||
cpi->mb.e_mbd.mode_ref_lf_delta_update = 0;
|
cpi->mb.e_mbd.mode_ref_lf_delta_update = 0;
|
||||||
vpx_memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas));
|
vpx_memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas));
|
||||||
vpx_memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas));
|
vpx_memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas));
|
||||||
|
vpx_memset(cpi->mb.e_mbd.last_ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas));
|
||||||
|
vpx_memset(cpi->mb.e_mbd.last_mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas));
|
||||||
|
|
||||||
// jbb trial !
|
// jbb trial !
|
||||||
mode_ref_lf_test_function(cpi);
|
mode_ref_lf_test_function(cpi);
|
||||||
@ -4093,6 +4095,9 @@ static void encode_frame_to_data_rate
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// Reset the loop filter deltas and segmentation map
|
||||||
|
setup_features(cpi);
|
||||||
|
|
||||||
// If segmentation is enabled force a map update for key frames
|
// If segmentation is enabled force a map update for key frames
|
||||||
if (cpi->mb.e_mbd.segmentation_enabled)
|
if (cpi->mb.e_mbd.segmentation_enabled)
|
||||||
{
|
{
|
||||||
@ -4100,12 +4105,6 @@ static void encode_frame_to_data_rate
|
|||||||
cpi->mb.e_mbd.update_mb_segmentation_data = 1;
|
cpi->mb.e_mbd.update_mb_segmentation_data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If mode or reference frame based loop filter deltas are enabled then force an update for key frames.
|
|
||||||
if (cpi->mb.e_mbd.mode_ref_lf_delta_enabled)
|
|
||||||
{
|
|
||||||
cpi->mb.e_mbd.mode_ref_lf_delta_update = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The alternate reference frame cannot be active for a key frame
|
// The alternate reference frame cannot be active for a key frame
|
||||||
cpi->source_alt_ref_active = FALSE;
|
cpi->source_alt_ref_active = FALSE;
|
||||||
|
|
||||||
@ -4527,6 +4526,9 @@ static void encode_frame_to_data_rate
|
|||||||
// Clear the Alt reference frame active flag when we have a key frame
|
// Clear the Alt reference frame active flag when we have a key frame
|
||||||
cpi->source_alt_ref_active = FALSE;
|
cpi->source_alt_ref_active = FALSE;
|
||||||
|
|
||||||
|
// Reset the loop filter deltas and segmentation map
|
||||||
|
setup_features(cpi);
|
||||||
|
|
||||||
// If segmentation is enabled force a map update for key frames
|
// If segmentation is enabled force a map update for key frames
|
||||||
if (cpi->mb.e_mbd.segmentation_enabled)
|
if (cpi->mb.e_mbd.segmentation_enabled)
|
||||||
{
|
{
|
||||||
@ -4534,12 +4536,6 @@ static void encode_frame_to_data_rate
|
|||||||
cpi->mb.e_mbd.update_mb_segmentation_data = 1;
|
cpi->mb.e_mbd.update_mb_segmentation_data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If mode or reference frame based loop filter deltas are enabled then force an update for key frames.
|
|
||||||
if (cpi->mb.e_mbd.mode_ref_lf_delta_enabled)
|
|
||||||
{
|
|
||||||
cpi->mb.e_mbd.mode_ref_lf_delta_update = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
vp8_restore_coding_context(cpi);
|
vp8_restore_coding_context(cpi);
|
||||||
|
|
||||||
Q = vp8_regulate_q(cpi, cpi->this_frame_target);
|
Q = vp8_regulate_q(cpi, cpi->this_frame_target);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user