oci->above_context[Y2CONTEXT] = 0;
oci->mip = 0;
- // Structure used to minitor GF useage
- if (oci->gf_active_flags != 0)
- vpx_free(oci->gf_active_flags);
-
- oci->gf_active_flags = 0;
}
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
vp8_update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols);
- // Structures used to minitor GF usage
- if (oci->gf_active_flags != 0)
- vpx_free(oci->gf_active_flags);
-
- oci->gf_active_flags = (unsigned char *)vpx_calloc(oci->mb_rows * oci->mb_cols, 1);
-
- if (!oci->gf_active_flags)
- {
- vp8_de_alloc_frame_buffers(oci);
- return ALLOC_FAILURE;
- }
-
- oci->gf_active_count = oci->mb_rows * oci->mb_cols;
-
return 0;
}
void vp8_setup_version(VP8_COMMON *cm)
int mb_to_top_edge;
int mb_to_bottom_edge;
- //char * gf_active_ptr;
- signed char *gf_active_ptr;
-
unsigned int frames_since_golden;
unsigned int frames_till_alt_ref_frame;
vp8_subpix_fn_t subpixel_predict;
unsigned int frames_since_golden;
unsigned int frames_till_alt_ref_frame;
- unsigned char *gf_active_flags; // Record of which MBs still refer to last golden frame either directly or through 0,0
- int gf_active_count;
/* We allocate a MODE_INFO struct for each macroblock, together with
an extra row on top and column on the left to simplify prediction. */
#include "segmentation_common.h"
#include "vpx_mem/vpx_mem.h"
-void vp8_update_gf_useage_maps(VP8_COMMON *cm, MACROBLOCKD *xd)
+void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x)
{
int mb_row, mb_col;
MODE_INFO *this_mb_mode_info = cm->mi;
- xd->gf_active_ptr = (signed char *)cm->gf_active_flags;
+ x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
if ((cm->frame_type == KEY_FRAME) || (cm->refresh_golden_frame))
{
// Reset Gf useage monitors
- vpx_memset(cm->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cm->gf_active_count = cm->mb_rows * cm->mb_cols;
+ vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
+ cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
}
else
{
// else if using non 0,0 motion or intra modes then clear flag if it is currently set
if ((this_mb_mode_info->mbmi.ref_frame == GOLDEN_FRAME) || (this_mb_mode_info->mbmi.ref_frame == ALTREF_FRAME))
{
- if (*(xd->gf_active_ptr) == 0)
+ if (*(x->gf_active_ptr) == 0)
{
- *(xd->gf_active_ptr) = 1;
- cm->gf_active_count ++;
+ *(x->gf_active_ptr) = 1;
+ cpi->gf_active_count ++;
}
}
- else if ((this_mb_mode_info->mbmi.mode != ZEROMV) && *(xd->gf_active_ptr))
+ else if ((this_mb_mode_info->mbmi.mode != ZEROMV) && *(x->gf_active_ptr))
{
- *(xd->gf_active_ptr) = 0;
- cm->gf_active_count--;
+ *(x->gf_active_ptr) = 0;
+ cpi->gf_active_count--;
}
- xd->gf_active_ptr++; // Step onto next entry
+ x->gf_active_ptr++; // Step onto next entry
this_mb_mode_info++; // skip to next mb
}
#include "string.h"
#include "blockd.h"
-#include "onyxc_int.h"
+#include "onyx_int.h"
-extern void vp8_update_gf_useage_maps(VP8_COMMON *cm, MACROBLOCKD *xd);
+extern void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x);
#include "alloccommon.h"
#include "entropymode.h"
#include "quant_common.h"
-#include "segmentation_common.h"
+
#include "setupintrarecon.h"
#include "demode.h"
#include "decodemv.h"
++xd->mode_info_context; /* next mb */
- xd->gf_active_ptr++; // GF useage flag for next MB
-
xd->above_context[Y1CONTEXT] += 4;
xd->above_context[UCONTEXT ] += 2;
xd->above_context[VCONTEXT ] += 2;
vpx_memset(pc->above_context[VCONTEXT ], 0, sizeof(ENTROPY_CONTEXT) * pc->mb_cols * 2);
vpx_memset(pc->above_context[Y2CONTEXT], 0, sizeof(ENTROPY_CONTEXT) * pc->mb_cols);
- xd->gf_active_ptr = (signed char *)pc->gf_active_flags; // Point to base of GF active flags data structure
-
-
vpx_memcpy(&xd->block[0].bmi, &xd->mode_info_context->bmi[0], sizeof(B_MODE_INFO));
#include "threading.h"
#include "decoderthreading.h"
#include <stdio.h>
-#include "segmentation_common.h"
+
#include "quant_common.h"
#include "vpx_scale/vpxscale.h"
#include "systemdependent.h"
return retcode;
}
- // Update the GF useage maps.
- vp8_update_gf_useage_maps(cm, &pbi->mb);
-
if (pbi->b_multithreaded_lf && pbi->common.filter_level != 0)
vp8_stop_lfthread(pbi);
mbd->subpixel_predict8x4 = xd->subpixel_predict8x4;
mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
- mbd->gf_active_ptr = xd->gf_active_ptr;
mbd->mode_info = pc->mi - 1;
mbd->mode_info_context = pc->mi + pc->mode_info_stride * (i + 1);
//mbd->subpixel_predict8x4 = xd->subpixel_predict8x4;
//mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
//mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
- //mbd->gf_active_ptr = xd->gf_active_ptr;
mbd->mode_info = pc->mi - 1;
mbd->mode_info_context = pc->mi + pc->mode_info_stride * (i + 1);
++xd->mode_info_context; /* next mb */
- xd->gf_active_ptr++; // GF useage flag for next MB
-
xd->above_context[Y1CONTEXT] += 4;
xd->above_context[UCONTEXT ] += 2;
xd->above_context[VCONTEXT ] += 2;
++xd->mode_info_context; /* next mb */
- xd->gf_active_ptr++; // GF useage flag for next MB
-
xd->above_context[Y1CONTEXT] += 4;
xd->above_context[UCONTEXT ] += 2;
xd->above_context[VCONTEXT ] += 2;
int encode_breakout;
+ //char * gf_active_ptr;
+ signed char *gf_active_ptr;
+
unsigned char *active_ptr;
MV_CONTEXT *mvc;
cpi->tplist[mb_row].stop = *tp;
- xd->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
+ x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
// store macroblock mode info into context array
vpx_memcpy(&xd->mode_info_context->mbmi, &xd->mbmi, sizeof(xd->mbmi));
//}
- xd->gf_active_ptr = (signed char *)cm->gf_active_flags; // Point to base of GF active flags data structure
+ x->gf_active_ptr = (signed char *)cpi->gf_active_flags; // Point to base of GF active flags data structure
x->vector_range = 32;
cpi->tplist[mb_row].stop = *tp;
- xd->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
+ x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
// store macroblock mode info into context array
vpx_memcpy(&xd->mode_info_context->mbmi, &xd->mbmi, sizeof(xd->mbmi));
#if CONFIG_RUNTIME_CPU_DETECT
mbd->rtcd = xd->rtcd;
#endif
- mbd->gf_active_ptr = xd->gf_active_ptr;
+ mb->gf_active_ptr = x->gf_active_ptr;
mb->vector_range = 32;
vpx_free(cpi->tok);
cpi->tok = 0;
+ // Structure used to minitor GF useage
+ if (cpi->gf_active_flags != 0)
+ vpx_free(cpi->gf_active_flags);
+
+ cpi->gf_active_flags = 0;
+
}
static void enable_segmentation(VP8_PTR ptr)
cpi->inter_zz_count = 0;
cpi->gf_bad_count = 0;
cpi->gf_update_recommended = 0;
+
+
+ // Structures used to minitor GF usage
+ if (cpi->gf_active_flags != 0)
+ vpx_free(cpi->gf_active_flags);
+
+ CHECK_MEM_ERROR(cpi->gf_active_flags, vpx_calloc(1, cm->mb_rows * cm->mb_cols));
+
+ cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
}
}
// Update data structure that monitors level of reference to last GF
- vpx_memset(cm->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cm->gf_active_count = cm->mb_rows * cm->mb_cols;
+ vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
+ cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
// this frame refreshes means next frames don't unless specified by user
cpi->common.frames_since_golden = 0;
}
// Update data structure that monitors level of reference to last GF
- vpx_memset(cm->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cm->gf_active_count = cm->mb_rows * cm->mb_cols;
+ vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
+ cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
// this frame refreshes means next frames don't unless specified by user
cm->refresh_golden_frame = 0;
{
if ((frames_to_blur_backward + frames_to_blur_forward) >= max_frames)
{
- frames_to_blur_backward
+ frames_to_blur_backward
= max_frames - frames_to_blur_forward - 1;
}
}
// Update the GF useage maps.
// This is done after completing the compression of a frame when all modes etc. are finalized but before loop filter
- vp8_update_gf_useage_maps(cm, &cpi->mb.e_mbd);
+ vp8_update_gf_useage_maps(cpi, cm, &cpi->mb);
if (cm->frame_type == KEY_FRAME)
cm->refresh_last_frame = 1;
if (0)
{
FILE *f = fopen("gfactive.stt", "a");
- fprintf(f, "%8d %8d %8d %8d %8d\n", cm->current_video_frame, (100 * cpi->common.gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols), cpi->this_iiratio, cpi->next_iiratio, cm->refresh_golden_frame);
+ fprintf(f, "%8d %8d %8d %8d %8d\n", cm->current_video_frame, (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols), cpi->this_iiratio, cpi->next_iiratio, cm->refresh_golden_frame);
fclose(f);
}
void vp8_check_gf_quality(VP8_COMP *cpi)
{
VP8_COMMON *cm = &cpi->common;
- int gf_active_pct = (100 * cm->gf_active_count) / (cm->mb_rows * cm->mb_cols);
+ int gf_active_pct = (100 * cpi->gf_active_count) / (cm->mb_rows * cm->mb_cols);
int gf_ref_usage_pct = (cpi->count_mb_ref_frame_usage[GOLDEN_FRAME] * 100) / (cm->mb_rows * cm->mb_cols);
int last_ref_zz_useage = (cpi->inter_zz_count * 100) / (cm->mb_rows * cm->mb_cols);
int b_calculate_ssimg;
#endif
int b_calculate_psnr;
+
+
+ unsigned char *gf_active_flags; // Record of which MBs still refer to last golden frame either directly or through 0,0
+ int gf_active_count;
+
+
} VP8_COMP;
void control_data_rate(VP8_COMP *cpi);
cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
cpi->recent_ref_frame_usage[ALTREF_FRAME];
- int pct_gf_active = (100 * cpi->common.gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
+ int pct_gf_active = (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
// Reset the last boost indicator
//cpi->last_boost = 100;
cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
cpi->recent_ref_frame_usage[ALTREF_FRAME];
- int pct_gf_active = (100 * cpi->common.gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
+ int pct_gf_active = (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
// Reset the last boost indicator
//cpi->last_boost = 100;