Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add encoding mode support #203

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions awcy_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function process_build_queue() {
env['CODEC'] = build_job.codec;
env['EXTRA_OPTIONS'] = build_job.extra_options;
env['BUILD_OPTIONS'] = build_job.build_options;
env['ENCODING_MODE'] = build_job.encoding_mode;
env['RUN_ID'] = build_job.run_id;
env['APP_DIR'] = app_dir;
env['CODECS_SRC_DIR'] = codecs_src_dir;
Expand Down Expand Up @@ -390,6 +391,7 @@ app.post('/submit/job',function(req,res) {
'extra_options': req.body.extra_options,
'build_options': req.body.build_options,
'qualities': req.body.qualities,
'encoding_mode': req.body.encoding_mode,
'master': req.body.master,
'ab_compare': req.body.ab_compare,
'save_encode': req.body.save_encode,
Expand Down
1 change: 1 addition & 0 deletions www/src/components/Job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class JobComponent extends React.Component<JobProps, {
details.push(keyValue("Commit", job.commit));
details.push(keyValue("Task", job.task));
details.push(keyValue("Qualities", job.qualities));
details.push(keyValue("Encoding Mode", job.encodingMode));
details.push(keyValue("Run A/B Compare", job.runABCompare));
details.push(keyValue("Save Encoded Files", job.saveEncodedFiles));
details.push(keyValue("Status", JobStatus[job.status]));
Expand Down
30 changes: 28 additions & 2 deletions www/src/components/SubmitJobForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class SubmitJobFormComponent extends React.Component<{
job: Job;
set: Option;
codec: Option;
encoding_mode: Option;
}> {
constructor() {
super();
Expand All @@ -28,6 +29,7 @@ export class SubmitJobFormComponent extends React.Component<{
job.extraOptions = template.extraOptions;
job.nick = template.nick;
job.qualities = template.qualities;
job.encodingMode = template.encodingMode;
job.id = template.id;
if (job.id.indexOf("@") > 0) {
job.id = job.id.substr(0, job.id.indexOf("@"));
Expand All @@ -37,11 +39,13 @@ export class SubmitJobFormComponent extends React.Component<{
}
let task = job.task ? job.task : "objective-1-fast";
let codec = job.codec ? job.codec : "av1";
let encoding_mode = job.encodingMode ? job.encodingMode : "quantizer";
job.id += "@" + formatDate(new Date());
this.state = {
job: null,
set: {label: task, value: task},
codec: {label: Job.codecs[codec], value: codec}
codec: {label: Job.codecs[codec], value: codec},
encoding_mode: {label: Job.encodingModes[encoding_mode], value: encoding_mode}
} as any;
job.saveEncodedFiles = true;
this.setState({ job } as any);
Expand All @@ -56,7 +60,7 @@ export class SubmitJobFormComponent extends React.Component<{
let job = this.state.job;
switch (name) {
case "all":
return ["id", "commit", "codec", "set", "nick", "qualities"].every(name =>
return ["id", "commit", "codec", "encoding_mode", "set", "nick", "qualities"].every(name =>
(this.getValidationState(name) === "success")
) ? "success" : "error";
case "id":
Expand All @@ -81,6 +85,11 @@ export class SubmitJobFormComponent extends React.Component<{
case "codec":
if (this.state.codec.value) return "success";
break;
case "encoding_mode":
if (this.state.encoding_mode.value) {
return "success";
}
break;
case "set":
if (this.state.set.value) return "success";
break;
Expand Down Expand Up @@ -120,15 +129,21 @@ export class SubmitJobFormComponent extends React.Component<{
job.date = new Date();
job.task = this.state.set.value;
job.codec = this.state.codec.value;
job.encodingMode = this.state.encoding_mode.value;
this.props.onCreate(job);
}
onCancel() {
this.props.onCancel();
}

onChangeCodec(codec: Option) {
this.setState({ codec } as any, () => { });
}

onChangeEncodingMode(encoding_mode: Option) {
this.setState({ encoding_mode } as any, () => { });
}

onChangeSet(set: Option) {
this.setState({ set } as any, () => { });
}
Expand All @@ -149,6 +164,12 @@ export class SubmitJobFormComponent extends React.Component<{
codecOptions.push({ value: key, label: name });
}

let encodingModeOptions = [];
for (let key in Job.encodingModes) {
let name = Job.encodingModes[key];
encodingModeOptions.push({ value: key, label: name });
}

let setOptions = [];
for (let key in Job.sets) {
let set = Job.sets[key];
Expand All @@ -171,6 +192,11 @@ export class SubmitJobFormComponent extends React.Component<{
<Select clearable={false} placeholder="Encoder" value={this.state.codec} options={codecOptions} onChange={this.onChangeCodec.bind(this)} />
</FormGroup>

<FormGroup validationState={this.getValidationState("encoding_mode")}>
<ControlLabel>Encoding Mode</ControlLabel>
<Select clearable={false} placeholder="Encoding Mode" value={this.state.encoding_mode} options={encodingModeOptions} onChange={this.onChangeEncodingMode.bind(this)} />
</FormGroup>

<FormGroup validationState={this.getValidationState("set")}>
<ControlLabel>Set</ControlLabel>
<Select clearable={false} placeholder="Set" value={this.state.set} options={setOptions} onChange={this.onChangeSet.bind(this)} />
Expand Down
8 changes: 8 additions & 0 deletions www/src/stores/Stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export class Job {
extraOptions: string = "";
nick: string = "";
qualities: string = "";
encodingMode: string = "";
id: string = "";
task: string = "";
taskType: string = "";
Expand Down Expand Up @@ -477,6 +478,7 @@ export class Job {
job.id = json.run_id;
job.nick = json.nick;
job.qualities = json.qualities || "";
job.encodingMode = json.encoding_mode;
job.buildOptions = json.build_options;
job.codec = json.codec;
job.commit = json.commit;
Expand Down Expand Up @@ -508,6 +510,11 @@ export class Job {
"vvc-vtm": "VVC VTM"
};

static encodingModes = {
"quantizer": "Target Quantizer",
"bitrate": "Target Bitrate (single-pass, rav1e only)",
};

static sets = {};
}

Expand Down Expand Up @@ -728,6 +735,7 @@ export class AppStore {
extra_options: job.extraOptions,
build_options: job.buildOptions,
qualities: job.qualities,
encoding_mode: job.encodingMode,
nick: job.nick,
ab_compare: job.runABCompare,
save_encode: job.saveEncodedFiles
Expand Down