Commit cc5dcedc authored by Fiona Glaser's avatar Fiona Glaser

Export the average effective CRF of each frame

Useful to judge the resulting quality of a frame when VBV is enabled.
parent f8fd6412
......@@ -61,6 +61,7 @@ typedef struct x264_frame
uint8_t i_bframes; /* number of bframes following this nonb in coded order */
float f_qp_avg_rc; /* QPs as decided by ratecontrol */
float f_qp_avg_aq; /* QPs as decided by AQ in addition to ratecontrol */
float f_crf_avg; /* Average effective CRF for this frame */
int i_poc_l0ref0; /* poc of first refframe in L0, used to check if direct temporal is possible */
/* YUV buffer */
......
......@@ -3306,6 +3306,7 @@ static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
return -1;
pic_out->hrd_timing = h->fenc->hrd_timing;
pic_out->prop.f_crf_avg = h->fdec->f_crf_avg;
while( filler > 0 )
{
......
......@@ -1787,6 +1787,7 @@ int x264_ratecontrol_end( x264_t *h, int bits, int *filler )
h->fdec->f_qp_avg_rc = rc->qpa_rc /= h->mb.i_mb_count;
h->fdec->f_qp_avg_aq = (float)rc->qpa_aq / h->mb.i_mb_count;
h->fdec->f_crf_avg = h->param.rc.f_rf_constant + h->fdec->f_qp_avg_rc - rc->qp_novbv;
if( h->param.rc.b_stat_write )
{
......@@ -2429,6 +2430,7 @@ static float rate_estimate_qscale( x264_t *h )
double w = x264_clip3f( cur_time*100, 0.0, 1.0 );
q *= pow( (double)total_bits / rcc->expected_bits_sum, w );
}
rcc->qp_novbv = qscale2qp( q );
if( rcc->b_vbv )
{
/* Do not overflow vbv */
......
......@@ -41,7 +41,7 @@
#include "x264_config.h"
#define X264_BUILD 125
#define X264_BUILD 126
/* Application developers planning to link against a shared library version of
* libx264 from a Microsoft Visual Studio or similar development environment
......@@ -728,6 +728,9 @@ typedef struct
double f_psnr_avg;
/* Out: PSNR of Y, U, and V (if x264_param_t.b_psnr is set) */
double f_psnr[3];
/* Out: Average effective CRF of the encoded frame */
double f_crf_avg;
} x264_image_properties_t;
typedef struct
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment