PDA

View Full Version : [Delphi] Are my presets good?


Sirber
28th September 2005, 01:38
begin
// Presets
case setting.video_quality of
0: // Lowest
begin
strOptions := GetFast();
end;
1: // Low
begin
// Analysis
strOptions := strOptions + '--me dia ';
strOptions := strOptions + '--subme 2 ';
strOptions := strOptions + '--weightb ';

// Frame-type
strOptions := strOptions + '--ref 2 ';

// Inloop
if (setting.video_inloop = true) then
strOptions := strOptions + '--filter ' + IntToStr(setting.video_inloop_val) + ':0 '
else
strOptions := strOptions + '--nf ';

// Bloc size
strOptions := strOptions + '--analyse "p4x4,p8x8,b8x8" ';

// BFrames
strOptions := strOptions + '--bframes ' + IntToStr(setting.video_bframe) + ' ';
strOptions := strOptions + '--b-pyramid ';
end;
2: // Medium
begin
// Analysis
strOptions := strOptions + '--me hex ';
strOptions := strOptions + '--subme 4 ';
strOptions := strOptions + '--weightb ';

// Frame-type
strOptions := strOptions + '--ref 3 ';

// Inloop
if (setting.video_inloop = true) then
strOptions := strOptions + '--filter ' + IntToStr(setting.video_inloop_val) + ':0 '
else
strOptions := strOptions + '--nf ';

// Bloc size
strOptions := strOptions + '--analyse "i4x4,p4x4,p8x8,b8x8" ';

// BFrames
strOptions := strOptions + '--bframes ' + IntToStr(setting.video_bframe) + ' ';
strOptions := strOptions + '--b-pyramid ';
end;
3: // High
begin
// Analysis
strOptions := strOptions + '--me umh ';
strOptions := strOptions + '--subme 5 ';
strOptions := strOptions + '--weightb ';
strOptions := strOptions + '--8x8dct ';

// Frame-type
strOptions := strOptions + '--ref 5 ';

// Inloop
if (setting.video_inloop = true) then
strOptions := strOptions + '--filter ' + IntToStr(setting.video_inloop_val) + ':0 '
else
strOptions := strOptions + '--nf ';

// Bloc size
strOptions := strOptions + '--analyse "i4x4,i8x8,p4x4,p8x8,b8x8" ';

// BFrames
strOptions := strOptions + '--bframes ' + IntToStr(setting.video_bframe) + ' ';
strOptions := strOptions + '--b-pyramid ';
end;
4: // Highest
begin
// Analysis
strOptions := strOptions + '--me esa ';
strOptions := strOptions + '--subme 6 ';
strOptions := strOptions + '--weightb ';
strOptions := strOptions + '--8x8dct ';

// Frame-type
strOptions := strOptions + '--ref 8 ';

// Inloop
if (setting.video_inloop = true) then
strOptions := strOptions + '--filter ' + IntToStr(setting.video_inloop_val) + ':0 '
else
strOptions := strOptions + '--nf ';

// Bloc size
strOptions := strOptions + '--analyse "i4x4,i8x8,p4x4,p8x8,b8x8" ';

// BFrames
strOptions := strOptions + '--bframes ' + IntToStr(setting.video_bframe) + ' ';
strOptions := strOptions + '--b-pyramid ';
end;
end;
end;
function Tx264.GetFast(): string;
var
strOptions: string;
begin
// Analysis
strOptions := strOptions + '--me dia ';
strOptions := strOptions + '--subme 1 ';
strOptions := strOptions + '--weightb ';

// Frame-type
strOptions := strOptions + '--ref 1 ';

// Inloop
if (setting.video_inloop = true) then
strOptions := strOptions + '--filter ' + IntToStr(setting.video_inloop_val) + ':0 '
else
strOptions := strOptions + '--nf ';

// Bloc size
strOptions := strOptions + '--analyse "none" ';

// BFrames
strOptions := strOptions + '--bframes ' + IntToStr(setting.video_bframe) + ' ';
strOptions := strOptions + '--b-pyramid ';

Result := strOptions;
end;

Thanks for your help! :D

MeteorRain
28th September 2005, 03:05
hey, my friend, why not just post 3 command lines here?

Sirber
28th September 2005, 03:09
Are your pascal skills far? ;)

I can't since some options depends on user input. All options are hold in "strOptions" then it shouldn't be hard to fellow.

akupenguin
28th September 2005, 03:37
Why don't you allow control of the deblock_beta parameter? If you want a single deblock strength number, it should control both.
'--analyse p4x4' belongs only in video_quality>=3. Maybe also remove b8x8 from video_quality=1.
'--me esa' shouldn't be in any preset, the highest should be umh.

MeteorRain
28th September 2005, 03:38
well, my pascal skill's not bad.:o

but it's hard to say whether your presets are good or not becuz everyone encodes videos in there own mind.

eg, i like to use ipratio=1.0; pbratio=1.0 at any time, while use subme=6(RDO); ref=4; b-frame=16 at highest preset, which some ppl think crazy :o

akupenguin
28th September 2005, 03:39
yes, you're crazy ;)

MeteorRain
28th September 2005, 03:43
yes, you're crazy ;)
well, the ratio option comes from my xvid option. some ppl say b-frame will decrease the video quality as they are encoded in higher quantization. so, if we decrease the quantization, the b-frame will no longer in low quality. at the same quantization, b-frame gives higher compression ratio, so i love to set quantization of b-frame as the same as i/p-frame :o

Sirber
28th September 2005, 03:45
Why don't you allow control of the deblock_beta parameter? If you want a single deblock strength number, it should control both.
'--analyse p4x4' belongs only in video_quality>=3. Maybe also remove b8x8 from video_quality=1.
'--me esa' shouldn't be in any preset, the highest should be umh.Thanks for the hints! In my newcoming GUI, I don't let the user chosoe every settings, but presets. You can get full control with RealAnime 3.x.

In RealAnime 3.x, loop filter I use the same value for both fields, but it seems more logical that "threshold" should stay 0. No? :confused:

@MeteorRain

Why complaining on delphi then? It did you no harm. Leave him alone :devil:

akupenguin
28th September 2005, 05:14
IMHO deblock=0:0 looks best, so don't ask me which alternatives are better.
But if you just want logic, then:
The numbers in deblock are QP offsets (times 2). So a frame with QP=25 and deblock=-1:-1 is filtered the same as a frame with QP=23 and deblock=0:0. I think that's more logical than mixing AlphaC0 from QP23 with Beta from QP25.
Also note that when I call AlphaC0 "strength" and Beta "threshold", that's a simplification. There are some thresholds that depend on Alpha, some that depend on Beta, and the amount of change per pixel is (sometimes) capped by C0, but is also affected by Beta...

MeteorRain
28th September 2005, 10:29
@MeteorRain

Why complaining on delphi then? It did you no harm. Leave him alone :devil:
Well, i have no sense on complaining :o

Sirber
28th September 2005, 13:10
IMHO deblock=0:0 looks best, so don't ask me which alternatives are better.
But if you just want logic, then:
The numbers in deblock are QP offsets (times 2). So a frame with QP=25 and deblock=-1:-1 is filtered the same as a frame with QP=23 and deblock=0:0. I think that's more logical than mixing AlphaC0 from QP23 with Beta from QP25.
Also note that when I call AlphaC0 "strength" and Beta "threshold", that's a simplification. There are some thresholds that depend on Alpha, some that depend on Beta, and the amount of change per pixel is (sometimes) capped by C0, but is also affected by Beta...
I will just say o.k., master ;)

Kinda complicated, so I will fellow your hint on that.