Move some initialization to encoder_control_init.

- Removed some members from encoder_control_t that weren't really used
  very much anymore.
This commit is contained in:
Ari Koivula 2015-05-15 14:04:56 +03:00 committed by Arttu Ylä-Outinen
parent 504f3d9c9b
commit 0170e9280f
4 changed files with 38 additions and 48 deletions

View file

@ -143,46 +143,6 @@ int main(int argc, char *argv[])
goto exit_failure;
}
// Set output file
encoder.out.file = output;
// input init (TODO: read from commandline / config)
encoder.bitdepth = 8;
encoder.in.video_format = FORMAT_420;
// deblocking filter
encoder.deblock_enable = (int8_t)encoder.cfg->deblock_enable;
encoder.beta_offset_div2 = (int8_t)encoder.cfg->deblock_beta;
encoder.tc_offset_div2 = (int8_t)encoder.cfg->deblock_tc;
// SAO
encoder.sao_enable = (int8_t)encoder.cfg->sao_enable;
// RDO
encoder.rdoq_enable = (int8_t)encoder.cfg->rdoq_enable;
encoder.rdo = (int8_t)encoder.cfg->rdo;
encoder.sign_hiding = encoder.cfg->signhide_enable;
encoder.full_intra_search = (int8_t)encoder.cfg->full_intra_search;
// TR SKIP
encoder.trskip_enable = (int8_t)encoder.cfg->trskip_enable;
encoder.tr_depth_intra = (int8_t)encoder.cfg->tr_depth_intra;
// MOTION ESTIMATION
encoder.fme_level = (int8_t)encoder.cfg->fme_level;
// VUI
encoder.vui.sar_width = (int16_t)encoder.cfg->vui.sar_width;
encoder.vui.sar_height = (int16_t)encoder.cfg->vui.sar_height;
encoder.vui.overscan = encoder.cfg->vui.overscan;
encoder.vui.videoformat = encoder.cfg->vui.videoformat;
encoder.vui.fullrange = encoder.cfg->vui.fullrange;
encoder.vui.colorprim = encoder.cfg->vui.colorprim;
encoder.vui.transfer = encoder.cfg->vui.transfer;
encoder.vui.colormatrix = encoder.cfg->vui.colormatrix;
encoder.vui.chroma_loc = (int8_t)encoder.cfg->vui.chroma_loc;
// AUD
encoder.aud_enable = (int8_t)encoder.cfg->aud_enable;
encoder.vps_period = encoder.cfg->vps_period * encoder.cfg->intra_period;
encoder.in.file = input;
fprintf(stderr, "Input: %s, output: %s\n", cfg->input, cfg->output);
fprintf(stderr, " Video size: %dx%d (input=%dx%d)\n",
encoder.in.width, encoder.in.height,
@ -209,6 +169,7 @@ int main(int argc, char *argv[])
if (!encoder_state_init(&encoder_states[i], NULL)) {
goto exit_failure;
}
encoder_states[i].stream.file.output = output;
encoder_states[i].global->QP = (int8_t)encoder.cfg->qp;
}

View file

@ -297,7 +297,7 @@ int encoder_control_init(encoder_control_t * const encoder, const config_t * con
printf("\n");
#endif //_DEBUG
}
assert(WITHIN(cfg->pu_depth_inter.min, PU_DEPTH_INTER_MIN, PU_DEPTH_INTER_MAX));
assert(WITHIN(cfg->pu_depth_inter.max, PU_DEPTH_INTER_MIN, PU_DEPTH_INTER_MAX));
assert(WITHIN(cfg->pu_depth_intra.min, PU_DEPTH_INTRA_MIN, PU_DEPTH_INTRA_MAX));
@ -307,6 +307,41 @@ int encoder_control_init(encoder_control_t * const encoder, const config_t * con
encoder->pu_depth_intra.min = cfg->pu_depth_intra.min;
encoder->pu_depth_intra.max = cfg->pu_depth_intra.max;
// input init (TODO: read from commandline / config)
encoder->bitdepth = 8;
encoder->in.video_format = FORMAT_420;
// deblocking filter
encoder->deblock_enable = (int8_t)encoder->cfg->deblock_enable;
encoder->beta_offset_div2 = (int8_t)encoder->cfg->deblock_beta;
encoder->tc_offset_div2 = (int8_t)encoder->cfg->deblock_tc;
// SAO
encoder->sao_enable = (int8_t)encoder->cfg->sao_enable;
// RDO
encoder->rdoq_enable = (int8_t)encoder->cfg->rdoq_enable;
encoder->rdo = (int8_t)encoder->cfg->rdo;
encoder->sign_hiding = encoder->cfg->signhide_enable;
encoder->full_intra_search = (int8_t)encoder->cfg->full_intra_search;
// TR SKIP
encoder->trskip_enable = (int8_t)encoder->cfg->trskip_enable;
encoder->tr_depth_intra = (int8_t)encoder->cfg->tr_depth_intra;
// MOTION ESTIMATION
encoder->fme_level = (int8_t)encoder->cfg->fme_level;
// VUI
encoder->vui.sar_width = (int16_t)encoder->cfg->vui.sar_width;
encoder->vui.sar_height = (int16_t)encoder->cfg->vui.sar_height;
encoder->vui.overscan = encoder->cfg->vui.overscan;
encoder->vui.videoformat = encoder->cfg->vui.videoformat;
encoder->vui.fullrange = encoder->cfg->vui.fullrange;
encoder->vui.colorprim = encoder->cfg->vui.colorprim;
encoder->vui.transfer = encoder->cfg->vui.transfer;
encoder->vui.colormatrix = encoder->cfg->vui.colormatrix;
encoder->vui.chroma_loc = (int8_t)encoder->cfg->vui.chroma_loc;
// AUD
encoder->aud_enable = (int8_t)encoder->cfg->aud_enable;
encoder->vps_period = encoder->cfg->vps_period * encoder->cfg->intra_period;
return 1;
}

View file

@ -46,7 +46,6 @@ typedef struct encoder_control_t
/* Input */
struct {
FILE *file;
int32_t width;
int32_t height;
int32_t width_in_lcu;
@ -58,11 +57,6 @@ typedef struct encoder_control_t
int64_t pixels_per_pic;
} in;
/* Output */
struct {
FILE *file;
} out;
/* TODO: add ME data */
struct {
void(*IME)();

View file

@ -334,7 +334,7 @@ int encoder_state_init(encoder_state_t * const child_state, encoder_state_t * co
fprintf(stderr, "Could not initialize stream!\n");
return 0;
}
child_state->stream.file.output = child_state->encoder_control->out.file;
child_state->stream.file.output = NULL;
} else {
//Other encoders use a memory bitstream
if (!bitstream_init(&child_state->stream, BITSTREAM_TYPE_MEMORY)) {