[FFmpeg-devel] [PATCH] FLAC parser
Tue Aug 3 02:04:40 CEST 2010
I've included everything from yours and Diego's review, but I'll
respond to the questions below. I feel more confident about it now,
thanks again to both of you.
On Sun, Aug 1, 2010 at 10:29 PM, Justin Ruggles
<justin.ruggles at gmail.com> wrote:
>> ?#endif /* AVCODEC_FLAC_H */
>> diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
>> new file mode 100644
>> index 0000000..70d2212
>> --- /dev/null
>> +++ libavcodec/flac_parser.c
>> @@ -0,0 +1,415 @@
>> + * FLAC parser
>> + * Copyright (c) 2010 Michael Chinen
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>> + */
>> +#include "libavutil/crc.h"
>> +#include "bytestream.h"
>> +#include "parser.h"
>> +#include "flac.h"
>> +/* the maximum number of adjacent headers that will compare crcs against each other */
>> +#define FLAC_MAX_SEQUENTIAL_HEADERS 4
>> +/* the minimum number of headers that need to be buffered and checked before returning frames */
>> +#define FLAC_MIN_HEADERS 20
> Just out of curiosity, have you done testing with fewer headers, both
> buffered and sequential?
I tried before with 3 and 10 respectively, and things still seemed to
work okay, but arbitrarily went with 4 and 20. Maybe it's overkill?
>> +/* scoring settings for score_header */
>> +#define FLAC_HEADER_BASE_SCORE ? ? ? ?10
>> +#define FLAC_HEADER_CHANGED_PENALTY ? 7
>> +#define FLAC_HEADER_NOT_SCORED_YET ? ?-100000
> Have you tested any files where the header change is valid to see if the
> penalty value works ok? ?You would probably have to craft your own file
> since I don't know of any encoders that will make such files.
Yes, it works.
I used to also check channel decorrelation and this changes quite often
within legal streams, and the scores reflected that.
I since removed that check since we don't want to penalize common changes.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 37793 bytes
Desc: not available
More information about the ffmpeg-devel