diff options
-rw-r--r-- | gtk/src/presets.c | 36 | ||||
-rw-r--r-- | libhb/encavcodec.c | 17 | ||||
-rw-r--r-- | libhb/enctheora.c | 10 | ||||
-rw-r--r-- | libhb/encx264.c | 15 | ||||
-rw-r--r-- | libhb/muxcommon.c | 2 | ||||
-rw-r--r-- | libhb/work.c | 6 | ||||
-rw-r--r-- | macosx/Controller.m | 55 | ||||
-rw-r--r-- | macosx/HBPresets.m | 5 |
8 files changed, 21 insertions, 125 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 2e231bfd1..4d7217f8a 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -2749,42 +2749,6 @@ import_xlat_preset(GValue *dict) } g_free(str); } - - gdouble vquality; - const GValue *gval; - - vquality = ghb_value_double(preset_dict_get_value(dict, "VideoQualitySlider")); - if (vquality > 0.0 && vquality < 1.0) - { - gint vcodec; - - gval = preset_dict_get_value(dict, "VideoEncoder"); - vcodec = ghb_lookup_combo_int("VideoEncoder", gval); - switch (vcodec) - { - case HB_VCODEC_X264: - { - vquality = 51. - vquality * 51.; - } break; - - case HB_VCODEC_FFMPEG: - { - vquality = 31. - vquality * 30.; - } break; - - case HB_VCODEC_THEORA: - { - vquality = vquality * 63.; - } break; - - default: - { - vquality = 0.; - } break; - } - ghb_dict_insert(dict, g_strdup("VideoQualitySlider"), - ghb_double_value_new(vquality)); - } } static void diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index b2cebee64..a9d567016 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -212,7 +212,7 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) // the user to override. if( job->vquality < 0.0 ) { - /* Rate control */ + /* Average bitrate */ context->bit_rate = 1000 * job->vbitrate; // ffmpeg's mpeg2 encoder requires that the bit_rate_tolerance be >= // bitrate * fps @@ -224,20 +224,7 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) // These settings produce better image quality than // what was previously used context->flags |= CODEC_FLAG_QSCALE; - if (job->vquality < 1.0) - { - float vquality; - vquality = 31 - job->vquality * 31; - // A value of 0 has undefined behavior - // and ffmpeg qp has integral increments - if (vquality < 1.0) - vquality = 1.0; - context->global_quality = FF_QP2LAMBDA * vquality + 0.5; - } - else - { - context->global_quality = FF_QP2LAMBDA * job->vquality + 0.5; - } + context->global_quality = FF_QP2LAMBDA * job->vquality + 0.5; hb_log( "encavcodec: encoding at constant quantizer %d", context->global_quality ); } diff --git a/libhb/enctheora.c b/libhb/enctheora.c index 2ced60693..20d532362 100644 --- a/libhb/enctheora.c +++ b/libhb/enctheora.c @@ -96,15 +96,7 @@ int enctheoraInit( hb_work_object_t * w, hb_job_t * job ) else { ti.target_bitrate = 0; - - if( job->vquality > 0 && job->vquality < 1 ) - { - ti.quality = 63 * job->vquality; - } - else - { - ti.quality = job->vquality; - } + ti.quality = job->vquality; } keyframe_frequency = 10 * (int)( (double)job->vrate / (double)job->vrate_base + 0.5 ); diff --git a/libhb/encx264.c b/libhb/encx264.c index ed76a1f70..cc45cef79 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -269,25 +269,16 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) } - if( job->vquality > 0.0 && job->vquality < 1.0 ) + if( job->vquality >= 0 ) { - /*Constant RF*/ - param.rc.i_rc_method = X264_RC_CRF; - param.rc.f_rf_constant = 51 - job->vquality * 51; - hb_log( "encx264: Encoding at constant RF %f", param.rc.f_rf_constant ); - } - else if( job->vquality == 0 || job->vquality >= 1.0 ) - { - /* Use the vquality as a raw RF or QP - instead of treating it like a percentage. */ - /*Constant RF*/ + /* Constant RF */ param.rc.i_rc_method = X264_RC_CRF; param.rc.f_rf_constant = job->vquality; hb_log( "encx264: Encoding at constant RF %f", param.rc.f_rf_constant ); } else { - /* Rate control */ + /* Average bitrate */ param.rc.i_rc_method = X264_RC_ABR; param.rc.i_bitrate = job->vbitrate; switch( job->pass ) diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c index f47b442b5..98a978d0d 100644 --- a/libhb/muxcommon.c +++ b/libhb/muxcommon.c @@ -352,7 +352,7 @@ void muxClose( hb_work_object_t * w ) i, track->frames, track->bytes, 90000.0 * track->bytes / mux->pts / 125, track->mf.flen ); - if( !i && ( job->vquality < 0.0 || job->vquality > 1.0 ) ) + if( !i && job->vquality < 0 ) { /* Video */ hb_deep_log( 2, "mux: video bitrate error, %+"PRId64" bytes", diff --git a/libhb/work.c b/libhb/work.c index e8c2a4e1e..c5785bdb9 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -283,11 +283,7 @@ void hb_display_job_info( hb_job_t * job ) break; } - if( job->vquality >= 0.0 && job->vquality <= 1.0 ) - { - hb_log( " + quality: %.2f", job->vquality ); - } - else if( job->vquality > 1 ) + if( job->vquality >= 0 ) { hb_log( " + quality: %.2f %s", job->vquality, job->vcodec == HB_VCODEC_X264 ? "(RF)" : "(QP)" ); } diff --git a/macosx/Controller.m b/macosx/Controller.m index 4bdc32895..359f86558 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2753,30 +2753,16 @@ fWorkingCount = 0; [fVidQualityMatrix selectCellAtRow:[[queueToApply objectForKey:@"VideoQualityType"] intValue] column:0]; [fVidBitrateField setStringValue:[queueToApply objectForKey:@"VideoAvgBitrate"]]; - /* Since we are now using RF Values for the slider, we detect if the preset uses an old quality float. - * So, check to see if the quality value is less than 1.0 which should indicate the old ".062" type - * quality preset. Caveat: in the case of x264, where the RF scale starts at 0, it would misinterpret - * a preset that uses 0.0 - 0.99 for RF as an old style preset. Not sure how to get around that one yet, - * though it should be a corner case since it would pretty much be a preset for lossless encoding. */ - if ([[queueToApply objectForKey:@"VideoQualitySlider"] floatValue] < 1.0) - { - /* For the quality slider we need to convert the old percent's to the new rf scales */ - float rf = (([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) * [[queueToApply objectForKey:@"VideoQualitySlider"] floatValue]); - [fVidQualitySlider setFloatValue:rf]; - + + if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA) + { + /* Since theora's qp value goes up from left to right, we can just set the slider float value */ + [fVidQualitySlider setFloatValue:[[queueToApply objectForKey:@"VideoQualitySlider"] floatValue]]; } else { - /* Since theora's qp value goes up from left to right, we can just set the slider float value */ - if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA) - { - [fVidQualitySlider setFloatValue:[[queueToApply objectForKey:@"VideoQualitySlider"] floatValue]]; - } - else - { - /* since ffmpeg and x264 use an "inverted" slider (lower qp/rf values indicate a higher quality) we invert the value on the slider */ - [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] + [fVidQualitySlider minValue]) - [[queueToApply objectForKey:@"VideoQualitySlider"] floatValue]]; - } + /* Since ffmpeg and x264 use an "inverted" slider (lower qp/rf values indicate a higher quality) we invert the value on the slider */ + [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] + [fVidQualitySlider minValue]) - [[queueToApply objectForKey:@"VideoQualitySlider"] floatValue]]; } [self videoMatrixChanged:nil]; @@ -5522,30 +5508,15 @@ return YES; [fVidBitrateField setStringValue:[chosenPreset objectForKey:@"VideoAvgBitrate"]]; - /* Since we are now using RF Values for the slider, we detect if the preset uses an old quality float. - * So, check to see if the quality value is less than 1.0 which should indicate the old ".062" type - * quality preset. Caveat: in the case of x264, where the RF scale starts at 0, it would misinterpret - * a preset that uses 0.0 - 0.99 for RF as an old style preset. Not sure how to get around that one yet, - * though it should be a corner case since it would pretty much be a preset for lossless encoding. */ - if ([[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue] < 1.0) - { - /* For the quality slider we need to convert the old percent's to the new rf scales */ - float rf = (([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) * [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]); - [fVidQualitySlider setFloatValue:rf]; - + if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA) + { + /* Since theora's qp value goes up from left to right, we can just set the slider float value */ + [fVidQualitySlider setFloatValue:[[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; } else { - /* Since theora's qp value goes up from left to right, we can just set the slider float value */ - if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA) - { - [fVidQualitySlider setFloatValue:[[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; - } - else - { - /* since ffmpeg and x264 use an "inverted" slider (lower qp/rf values indicate a higher quality) we invert the value on the slider */ - [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] + [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; - } + /* Since ffmpeg and x264 use an "inverted" slider (lower qp/rf values indicate a higher quality) we invert the value on the slider */ + [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] + [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; } [self videoMatrixChanged:nil]; diff --git a/macosx/HBPresets.m b/macosx/HBPresets.m index a574979d3..170e455bc 100644 --- a/macosx/HBPresets.m +++ b/macosx/HBPresets.m @@ -302,7 +302,6 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -833,7 +832,6 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; [preset setObject:@"1000" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -1128,7 +1126,6 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; [preset setObject:@"960" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -1221,7 +1218,6 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; [preset setObject:@"1500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -1314,7 +1310,6 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; [preset setObject:@"700" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; |