diff --git a/src/cli.c b/src/cli.c index ccfa2675..d53c0b95 100644 --- a/src/cli.c +++ b/src/cli.c @@ -57,6 +57,7 @@ static const struct option long_options[] = { { "tr-depth-intra", required_argument, NULL, 0 }, { "me", required_argument, NULL, 0 }, { "subme", required_argument, NULL, 0 }, + { "source-scan-type", required_argument, NULL, 0 }, { "sar", required_argument, NULL, 0 }, { "overscan", required_argument, NULL, 0 }, { "videoformat", required_argument, NULL, 0 }, @@ -284,6 +285,10 @@ void print_help(void) " --cpuid : Disable runtime cpu optimizations with value 0.\n" " --subme : Set fractional pixel motion estimation level [1].\n" " 0: only integer motion estimation\n" + " --source-scan-type : Set source scan type [\"progressive\"].\n" + " \"progressive\": progressive scan\n" + " \"tff\": top field first\n" + " \"bff\": bottom field first\n" " 1: fractional pixel motion estimation enabled\n" " --pu-depth-inter - : Range for sizes of inter prediction units to try.\n" " 0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8\n" diff --git a/src/config.c b/src/config.c index 35be7532..5bc57c54 100644 --- a/src/config.c +++ b/src/config.c @@ -70,6 +70,7 @@ int config_init(kvz_config *cfg) cfg->tr_depth_intra = 0; cfg->ime_algorithm = 0; /* hexbs */ cfg->fme_level = 1; + cfg->source_scan_type = 0; /* progressive */ cfg->vui.sar_width = 0; cfg->vui.sar_height = 0; cfg->vui.overscan = 0; /* undef */ @@ -276,6 +277,7 @@ static int parse_slice_specification(const char* const arg, int32_t * const nsli int config_parse(kvz_config *cfg, const char *name, const char *value) { static const char * const me_names[] = { "hexbs", "tz", NULL }; + static const char * const source_scan_type_names[] = { "progressive", "tff", "bff", NULL }; static const char * const overscan_names[] = { "undef", "show", "crop", NULL }; static const char * const videoformat_names[] = { "component", "pal", "ntsc", "secam", "mac", "undef", NULL }; @@ -356,6 +358,8 @@ int config_parse(kvz_config *cfg, const char *name, const char *value) } else if OPT("subme") cfg->fme_level = atoi(value); + else if OPT("source-scan-type") + return parse_enum(value, source_scan_type_names, &cfg->source_scan_type); else if OPT("sar") return sscanf(value, "%d:%d", &cfg->vui.sar_width, &cfg->vui.sar_height) == 2; else if OPT("overscan") diff --git a/src/encoder.c b/src/encoder.c index ef57340d..b01b300c 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -153,6 +153,8 @@ encoder_control_t* encoder_control_init(const kvz_config *const cfg) { // Rate-distortion optimization level encoder->rdo = 1; encoder->full_intra_search = 0; + // INTERLACING + encoder->in.source_scan_type = (int8_t)cfg->source_scan_type; // Initialize the scaling list scalinglist_init(&encoder->scaling_list); diff --git a/src/encoder.h b/src/encoder.h index 81eebe1d..0411eccf 100644 --- a/src/encoder.h +++ b/src/encoder.h @@ -55,6 +55,7 @@ typedef struct encoder_control_t int8_t video_format; int8_t bitdepth; /*!< \brief input bit depth (8,10) */ int64_t pixels_per_pic; + int8_t source_scan_type; } in; /* TODO: add ME data */ diff --git a/src/kvazaar.h b/src/kvazaar.h index 871d3622..8374a82e 100644 --- a/src/kvazaar.h +++ b/src/kvazaar.h @@ -112,6 +112,7 @@ typedef struct kvz_config int32_t tr_depth_intra; /*!< \brief Maximum transform depth for intra. */ enum kvz_ime_algorithm ime_algorithm; /*!< \brief Integer motion estimation algorithm. */ int32_t fme_level; /*!< \brief Fractional pixel motion estimation level (0: disabled, 1: enabled). */ + int8_t source_scan_type; /*!< \brief Source scan type (0: progressive, 1: top field first, 2: bottom field first).*/ int32_t bipred; /*!< \brief Bi-prediction (0: disabled, 1: enabled). */ int32_t deblock_beta; /*!< \brief (deblocking) beta offset (div 2), range -6...6 */ int32_t deblock_tc; /*!< \brief (deblocking) tc offset (div 2), range -6...6 */ diff --git a/src/kvazaar_version.h b/src/kvazaar_version.h index d1e87cd8..8c568647 100644 --- a/src/kvazaar_version.h +++ b/src/kvazaar_version.h @@ -21,6 +21,6 @@ ****************************************************************************/ // KVZ_API_VERSION is incremented every time the public api changes. -#define KVZ_API_VERSION 1 +#define KVZ_API_VERSION 2 #endif // KVAZAAR_VERSION_H_