[Ffmpeg-devel] THP decoder

Michael Niedermayer michaelni
Fri Apr 6 19:43:46 CEST 2007


Hi

On Fri, Apr 06, 2007 at 08:05:38PM +0400, Kislyakov Maxim wrote:
[...]
> +
> +/* THP format description */
> +typedef struct ThpDemuxerContext  {

still not doxygen compatible


> +    int version;  /* Version: v1.0 or v1.1 */

v1.1 stored in a int, this is no float and no string so what does the comment
tell the reader?


> +    int maxAudioSamples;  /* != 0 if sound is stored in file */
> +    int firstFrameSize;  /* size of first frame (header + video + audio) */
> +    uint32_t componentDataOffset;  /* ThpComponents stored here */
> +    uint32_t firstFrameOffset;  /* offset to first frame's data */
> +    uint32_t lastFrameOffset;  /* offset to last frame's data */
> +    uint32_t numComponents;  /* usually 1 or 2 (video or video + audio) */
> +    uint8_t componentTypes[16];  /* 00 - video; 01 - audio; ff - no component */
> +    uint32_t curFrame;  /* address of current frame */

the comments can be vertically aligned


> +    int frameSize;  /* size of frame */
> +    int indexComponent;  /* component index */

totally redundant comments


[...]

> +}
> + 

trailing whitespace


[...]
> +static inline short adpcm_thp_expand_nibble(ADPCMThpFrameHeader *fh, int8_t nibble,
> +                                            uint8_t index, uint8_t exponent, int st)
> +{
> +    short temp = 0;
> +    int factor1, factor2;
> +    if (nibble & 0x08)  {
> +        nibble = (nibble | 0xf0);
> +    }
> +    factor1 = ((fh->channelPrev[st][0]*fh->table[st][2*index]) >> 11);

superfluous ()


[...]
> @@ -822,6 +841,7 @@
>                              uint8_t *buf, int buf_size)
>  {
>      ADPCMContext *c = avctx->priv_data;
> +    ADPCMThpFrameHeader * frameHeader = av_malloc(sizeof(ADPCMThpFrameHeader)); /* Allocating memory for frameHeader */
[...]
> +        av_free(frameHeader); /* Freeing allocated memory */

frameHeader should be on the stack


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070406/24e4de9e/attachment.pgp>



More information about the ffmpeg-devel mailing list