On 13/10/13 19:24, David Kment wrote: > Hi, > > I developed an HNM4/HNM4A demuxer & video decoder for libav a while > back, and now cleaned it up. > Samples can be found here: > http://samples.mplayerhq.hu/game-formats/hnm/losteden-hnm4/ > I have more samples, i can upload those if needed. > > First time contributor, so if the format of the patch is wrong, or > something in the code, just tell me.
Kostya already did regarding functionality, as the style goes https://www.libav.org/developer.html#Coding-Rules-1 Contains a good checklist in case I'm forgetting something > +#include "avcodec.h" > +#include "internal.h" > +#include "libavutil/internal.h" > +#include "libavutil/intreadwrite.h" > +#include "libavutil/mem.h" > +#include <string.h> You should go the other way round #include <string.h>> #include "libavutil/mem.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "internal.h" > + > +#define HNM4_CHUNK_ID_PL 19536 > +#define HNM4_CHUNK_ID_IZ 23113 > +#define HNM4_CHUNK_ID_IU 21833 > +#define HNM4_CHUNK_ID_SD 17491 > + > +typedef struct Hnm4VideoContext { > + This newline should be avoided. > + uint8_t version; > + uint16_t width; > + uint16_t height; > + > + uint8_t *current; > + uint8_t *previous; > + uint8_t *buffer1; > + uint8_t *buffer2; > + uint8_t *processed; > + uint8_t *palette; > +} Hnm4VideoContext; > + > +static int getbit(uint8_t *src, uint32_t *brBitsRemaining, uint32_t > *brOffset, uint32_t *brQueue) { the "{" should stay in a new line for functions, we do not use camelcase for variables. > + if (*brQueue & 0x80000000) { > + *brQueue <<= 1; > + return 1; > + } > + else { } else { > + *brQueue <<= 1; > + return 0; > + while(1) { space between keyword and () while (1) { > + if (getbit(src, &brBitsRemaining, &brOffset, &brQueue)) { as you did here. I also noticed the * 256 that might be easier to follow as the shift in the right direction (the compiler should do the right thing anyway but a >> 9 is glaring obvious while a * 255 might get overlooked) lu _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
