Commit c6504a99 authored by Thomas Daede's avatar Thomas Daede Committed by Thomas Daede

Add quantizer parameter.

parent f2df7169
......@@ -13,7 +13,7 @@ fn main() {
Some(rec_file) => Some(y4m::encode(width, height, framerate).write_header(rec_file).unwrap()),
None => None
};
let mut fi = FrameInvariants::new(width, height);
let mut fi = FrameInvariants::new(width, height, files.quantizer);
let sequence = Sequence::new();
write_ivf_header(&mut files.output_file, fi.sb_width*64, fi.sb_height*64, framerate.num, framerate.den);
......
......@@ -17,7 +17,7 @@ fn main() {
Some(rec_file) => Some(y4m::encode(width, height, framerate).write_header(rec_file).unwrap()),
None => None
};
let mut fi = FrameInvariants::new(width, height);
let mut fi = FrameInvariants::new(width, height, files.quantizer);
let sequence = Sequence::new();
write_ivf_header(&mut files.output_file, fi.sb_width*64, fi.sb_height*64, framerate.num, framerate.den);
......
......@@ -92,9 +92,9 @@ pub struct FrameInvariants {
}
impl FrameInvariants {
pub fn new(width: usize, height: usize) -> FrameInvariants {
pub fn new(width: usize, height: usize, qindex: usize) -> FrameInvariants {
FrameInvariants {
qindex: 100,
qindex: qindex,
width: width,
height: height,
sb_width: (width+63)/64,
......@@ -137,7 +137,8 @@ pub struct EncoderConfig {
pub input_file: Box<Read>,
pub output_file: Box<Write>,
pub rec_file: Option<Box<Write>>,
pub limit: u64
pub limit: u64,
pub quantizer: usize
}
impl EncoderConfig {
......@@ -164,6 +165,11 @@ impl EncoderConfig {
.long("limit")
.takes_value(true)
.default_value("0"))
.arg(Arg::with_name("QP")
.help("Quantizer (0-255)")
.long("quantizer")
.takes_value(true)
.default_value("100"))
.get_matches();
EncoderConfig {
......@@ -178,7 +184,8 @@ impl EncoderConfig {
rec_file: matches.value_of("RECONSTRUCTION").map(|f| {
Box::new(File::create(&f).unwrap()) as Box<Write>
}),
limit: matches.value_of("LIMIT").unwrap().parse().unwrap()
limit: matches.value_of("LIMIT").unwrap().parse().unwrap(),
quantizer: matches.value_of("QP").unwrap().parse().unwrap()
}
}
}
......
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