[FFmpeg-devel] [PATCH] MLP/TrueHD Decoder - 2nd try
Michael Niedermayer
michaelni
Tue Jul 1 03:15:25 CEST 2008
On Tue, Jul 01, 2008 at 02:09:10AM +0100, Ramiro Polla wrote:
> Michael Niedermayer wrote:
>> On Sun, Jun 29, 2008 at 12:41:17PM +0100, Ramiro Polla wrote:
>>> Hello,
>>>
>>> 01_mlp_parser_gb.diff makes a function in mlp_parser receive a
>>> GetBitContext instead of uint8_t buffers. This helps out in the decoder
>>> to simplify the code.
>> ok, after fixing issue below
>
> [...]
>
>>> -int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, const uint8_t
>>> *buf,
>>> - unsigned int buf_size)
>>> +int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext
>>> *gb)
>>> {
>>> - GetBitContext gb;
>>> int ratebits;
>>> uint16_t checksum;
>>> - if (buf_size < 28) {
>>> + assert(get_bits_count(gb) == 0);
>>> +
>>> + if (gb->size_in_bits < 28 << 3) {
>>> av_log(log, AV_LOG_ERROR, "Packet too short, unable to read
>>> major sync\n");
>>> return -1;
>>> }
>>> - checksum = mlp_checksum16(buf, 26);
>>> - if (checksum != AV_RL16(buf+26)) {
>>> + checksum = mlp_checksum16(gb->buffer, 26);
>> You should document the "no stuff read yet" requirement in a doxy comment
>> (or add get_bits_count()>>3 iam not sure which is better ...)
>
> Is this what you meant? I just added this line to ff_mlp_read_major_sync's
> doxy comment:
> * gb must be a freshly initialized GetBitContext with no bits read.
patch ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080701/a6647d9c/attachment.pgp>
More information about the ffmpeg-devel
mailing list