}
}
+#if CONFIG_FP_MB_STATS
+static int input_fpmb_stats(FIRSTPASS_MB_STATS *firstpass_mb_stats,
+ VP9_COMMON *cm, uint8_t **this_frame_mb_stats) {
+ uint8_t *mb_stats_in = firstpass_mb_stats->mb_stats_start +
+ cm->current_video_frame * cm->MBs * sizeof(uint8_t);
+
+ if (mb_stats_in > firstpass_mb_stats->mb_stats_end)
+ return EOF;
+
+ *this_frame_mb_stats = mb_stats_in;
+
+ return 1;
+}
+#endif
+
static void encode_frame_internal(VP9_COMP *cpi) {
SPEED_FEATURES *const sf = &cpi->sf;
RD_OPT *const rd_opt = &cpi->rd;
struct vpx_usec_timer emr_timer;
vpx_usec_timer_start(&emr_timer);
+#if CONFIG_FP_MB_STATS
+ if (cpi->use_fp_mb_stats) {
+ input_fpmb_stats(&cpi->twopass.firstpass_mb_stats, cm,
+ &cpi->twopass.this_frame_mb_stats);
+ }
+#endif
+
encode_tiles(cpi);
vpx_usec_timer_mark(&emr_timer);
cpi->twopass.firstpass_mb_stats.mb_stats_start =
oxcf->firstpass_mb_stats_in.buf;
- cpi->twopass.firstpass_mb_stats.mb_stats_in =
- cpi->twopass.firstpass_mb_stats.mb_stats_start;
cpi->twopass.firstpass_mb_stats.mb_stats_end =
cpi->twopass.firstpass_mb_stats.mb_stats_start +
(ps - 1) * cpi->common.MBs * sizeof(uint8_t);
}
#if CONFIG_FP_MB_STATS
-static int input_fpmb_stats(FIRSTPASS_MB_STATS *firstpass_mb_stats,
- VP9_COMMON *cm, uint8_t **this_frame_mb_stats) {
- if (firstpass_mb_stats->mb_stats_in > firstpass_mb_stats->mb_stats_end)
- return EOF;
-
- *this_frame_mb_stats = firstpass_mb_stats->mb_stats_in;
- firstpass_mb_stats->mb_stats_in += cm->MBs * sizeof(uint8_t);
- return 1;
-}
-
static void output_fpmb_stats(uint8_t *this_frame_mb_stats, VP9_COMMON *cm,
struct vpx_codec_pkt_list *pktlist) {
struct vpx_codec_cx_pkt pkt;
// Update the total stats remaining structure.
subtract_stats(&twopass->total_left_stats, &this_frame);
-
-#if CONFIG_FP_MB_STATS
- if (cpi->use_fp_mb_stats) {
- input_fpmb_stats(&twopass->firstpass_mb_stats, cm,
- &twopass->this_frame_mb_stats);
- }
-#endif
}
void vp9_twopass_postencode_update(VP9_COMP *cpi) {
#if CONFIG_FP_MB_STATS
typedef struct {
- uint8_t *mb_stats_in;
uint8_t *mb_stats_start;
uint8_t *mb_stats_end;
} FIRSTPASS_MB_STATS;