From 7144200a4713442cafae5089dec1c580e8902a9b Mon Sep 17 00:00:00 2001 From: Gregory Maxwell <greg@xiph.org> Date: Fri, 5 Jun 2009 15:01:54 -0400 Subject: [PATCH] Add support for interframe prediction control in celtenc. --- tools/celtenc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/celtenc.c b/tools/celtenc.c index 580e9999c..7ed615ddb 100644 --- a/tools/celtenc.c +++ b/tools/celtenc.c @@ -217,6 +217,8 @@ void usage(void) printf (" --vbr Use variable bitrate encoding\n"); printf (" --comp n Encoding complexity (0-10)\n"); printf (" --framesize n Frame size (Default: 256)\n"); + printf (" --noltp Do not use long-term prediction\n"); + printf (" --independent Encode frames independently (implies noltp)\n"); printf (" --skeleton Outputs ogg skeleton metadata (may cause incompatibilities)\n"); printf (" --comment Add the given string as an extra comment. This may be\n"); printf (" used multiple times\n"); @@ -260,6 +262,8 @@ int main(int argc, char **argv) {"bitrate", required_argument, NULL, 0}, {"vbr",no_argument,NULL, 0}, {"comp", required_argument, NULL, 0}, + {"noltp", no_argument, NULL, 0}, + {"independent", no_argument, NULL, 0}, {"framesize", required_argument, NULL, 0}, {"skeleton",no_argument,NULL, 0}, {"help", no_argument, NULL, 0}, @@ -302,6 +306,7 @@ int main(int argc, char **argv) celt_int32_t lookahead = 0; int bytes_per_packet=48; int complexity=-127; + int prediction=2; int bitstream; @@ -367,6 +372,13 @@ int main(int argc, char **argv) } else if (strcmp(long_options[option_index].name,"framesize")==0) { frame_size=atoi (optarg); + } else if (strcmp(long_options[option_index].name,"noltp")==0) + { + if (prediction>1) + prediction=1; + } else if (strcmp(long_options[option_index].name,"independent")==0) + { + prediction=0; } else if (strcmp(long_options[option_index].name,"comment")==0) { if (!strchr(optarg, '=')) @@ -518,6 +530,12 @@ int main(int argc, char **argv) } } + if (celt_encoder_ctl(st, CELT_SET_PREDICTION(prediction)) != CELT_OK) + { + fprintf (stderr, "Prediction request failed\n"); + return 1; + } + if (complexity!=-127) { if (celt_encoder_ctl(st, CELT_SET_COMPLEXITY(complexity)) != CELT_OK) { -- GitLab