[Flake-enc-svnlog] SF.net SVN: flake-enc:[253] libflake/encode.c
Status: Beta
Brought to you by:
jbr79
From: <jb...@us...> - 2009-06-08 00:06:40
|
Revision: 253 http://flake-enc.svn.sourceforge.net/flake-enc/?rev=253&view=rev Author: jbr79 Date: 2009-06-08 00:06:27 +0000 (Mon, 08 Jun 2009) Log Message: ----------- Make the vbs flag and frame/sample count depend on the allow_vbs parameter instead of variable_block_size. Modified Paths: -------------- libflake/encode.c Modified: libflake/encode.c =================================================================== --- libflake/encode.c 2009-06-07 23:02:49 UTC (rev 252) +++ libflake/encode.c 2009-06-08 00:06:27 UTC (rev 253) @@ -234,12 +234,14 @@ params->order_method = FLAKE_ORDER_METHOD_LOG; params->max_prediction_order = 12; params->max_partition_order = 8; + params->allow_vbs = 1; params->variable_block_size = 1; break; case 10: params->order_method = FLAKE_ORDER_METHOD_SEARCH; params->max_prediction_order = 12; params->max_partition_order = 8; + params->allow_vbs = 1; params->variable_block_size = 1; break; case 11: @@ -247,6 +249,7 @@ params->order_method = FLAKE_ORDER_METHOD_LOG; params->max_prediction_order = 32; params->max_partition_order = 8; + params->allow_vbs = 1; params->variable_block_size = 1; break; case 12: @@ -254,6 +257,7 @@ params->order_method = FLAKE_ORDER_METHOD_SEARCH; params->max_prediction_order = 32; params->max_partition_order = 8; + params->allow_vbs = 1; params->variable_block_size = 1; break; } @@ -356,12 +360,12 @@ if(params->variable_block_size < 0 || params->variable_block_size > 1) { return -1; } + if(params->variable_block_size > 0 && !params->allow_vbs) { + return -1; + } - // don't allow block size of 16 in variable block size mode. this is a bug - // in the spec which has been fixed in FLAC 1.2.0, but is not backwards - // compatible. this constraint will be removed when Flake is updated to - // the new spec version. - if(bs == 16 && (params->variable_block_size > 0 || params->allow_vbs)) { + // don't allow block size of less than 128 in variable block size mode + if(bs < VBS_MIN_BLOCK_SIZE && params->allow_vbs) { return -1; } @@ -722,7 +726,7 @@ bitwriter_writebits(ctx->bw, 15, 0x7FFC); // new bitstream syntax for variable blocksize in FLAC 1.2.0 - bitwriter_writebits(ctx->bw, 1, ctx->params.variable_block_size > 0); + bitwriter_writebits(ctx->bw, 1, ctx->params.allow_vbs); bitwriter_writebits(ctx->bw, 4, frame->bs_code[0]); bitwriter_writebits(ctx->bw, 4, ctx->sr_code[0]); @@ -963,7 +967,7 @@ ctx->max_frame_size = MAX(ctx->max_frame_size, bitwriter_count(ctx->bw)); if(frame_buffer != NULL) { - if(ctx->params.variable_block_size || ctx->params.allow_vbs) { + if(ctx->params.allow_vbs) { ctx->frame_count += ctx->frame.blocksize; } else { ctx->frame_count++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |