[FFmpeg-devel] [PATCH] Indeo5 decoder
Michael Niedermayer
michaelni
Wed Apr 1 02:39:10 CEST 2009
On Wed, Apr 01, 2009 at 02:43:04AM +0200, Maxim wrote:
> Diego Biurrun schrieb:
> > Have you checked this works standalone, i.e. there are no other
> > dependencies?
> >
> > Try disabling all decoders and encoders and just enabling indeo5 please.
> >
>
> Yes, it does...
>
> Attached is an updated patch that fixes all things you pointed to.
> The following things were changed as well:
> - the inverse transform contains algebraic simplifications showed by
> Michael in his earlier post
> - a step was added to the inverse transform that tests for col/rows
> containing zero coeffs and sets the corresponding output to zero instead
> of performing the inverse transform on zeroes
> - simplifications of the motion compensation functions
>
> Please any further reviews (Michael?)
These functions may need av_cold, please review the whole patch for similar functions needing av_cold
indeo5patch.txt:1024:+int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
indeo5patch.txt:1112:+int ff_ivi_init_tiles(IVIPlaneDesc *planes, const int tile_width, const int tile_height)
x==0 / x!=0 can be simplified to !x / x
indeo5patch.txt:536:+ if (band->plane == 0 && band->band_num == 0 && (ctx->frame_flags & 8)) {
indeo5patch.txt:572:+ } else if (mb->cbp || (band->plane == 0 && band->band_num == 0 && (ctx->frame_flags & 8))) {
indeo5patch.txt:579:+ if (mb->type == 0)
indeo5patch.txt:939:+ last_row = (i - cb->num_rows + 1) != 0; /* = 0 for the last row */
indeo5patch.txt:951:+ if (bits[pos] == 0)
indeo5patch.txt:1587:+ is_intra = mb->type == 0;
indeo5patch.txt:1640:+ if (q != 1 && val != 0) {
indeo5patch.txt:1718:+ if (!band->qdelta_present && band->plane == 0 && band->band_num == 0) {
Missing context in av_log
indeo5patch.txt:727:+ av_log(NULL, AV_LOG_ERROR, "unsupported frame type: %d\n", ctx->frame_type);
indeo5patch.txt:1732:+ av_log(NULL, AV_LOG_ERROR, "Empty tile handling: unsupported MV scaling!\n");
divide by 2^x could use >> maybe
indeo5patch.txt:201:+ pic_conf.chroma_height = (pic_conf.pic_height + 3) / 4;
indeo5patch.txt:202:+ pic_conf.chroma_width = (pic_conf.pic_width + 3) / 4;
indeo5patch.txt:763:+ ctx->pic_conf.chroma_width = (avctx->width + 3) / 4;
indeo5patch.txt:764:+ ctx->pic_conf.chroma_height = (avctx->height + 3) / 4;
indeo5patch.txt:1044:+ planes[1].width = planes[2].width = (cfg->pic_width + 3) / 4;
indeo5patch.txt:1045:+ planes[1].height = planes[2].height = (cfg->pic_height + 3) / 4;
indeo5patch.txt:1119:+ t_width = !p ? tile_width : (tile_width + 3) / 4;
indeo5patch.txt:1120:+ t_height = !p ? tile_height : (tile_height + 3) / 4;
indeo5patch.txt:1200:+/* The following is a reflection using a,b = 1/2, 5/4 for the inverse slant transform */
indeo5patch.txt:1266:+ /* the (x + 1)/2 term is needed to compensate the normalization of the forward transform */
indeo5patch.txt:1331:+ * spreading (DC_coeff + 1)/2 over the whole block.
useless & [0]
indeo5patch.txt:676:+ band->dequant_intra = &deq4x4_intra[0][0];
indeo5patch.txt:677:+ band->dequant_inter = &deq4x4_inter[0][0];
indeo5patch.txt:959:+ return init_vlc(pOut, IVI_VLC_BITS, pos, &bits[0], 1, 1, &codewords[0], 2, 2,
indeo5patch.txt:1035:+ av_freep(&planes[0].buf1);
indeo5patch.txt:1036:+ av_freep(&planes[0].buf2);
missing const?
indeo5patch.txt:1248:+ int32_t *src, *dst, tmp[64];
indeo5patch.txt:1295:+ int32_t *src, *dst, tmp[16];
indeo5patch.txt:1698:+ int16_t *src, *dst;
indeo5patch.txt:1802:+ int16_t *src = (plane->buf_switch) ? plane->buf2 : plane->buf1;
Non static with no ff_/av_ prefix
indeo5patch.txt:856:+AVCodec indeo5_decoder = {
indeo5patch.txt:1844:+const RVMapDesc ivi_rvmap_tabs[9] = {
missing } prior to else
indeo5patch.txt:252:+ else
indeo5patch.txt:382:+ else {
indeo5patch.txt:459:+ else {
indeo5patch.txt:558:+ else if (ctx->frame_type == IVI5_FRAMETYPE_INTRA)
indeo5patch.txt:560:+ else
indeo5patch.txt:581:+ else {
indeo5patch.txt:812:+ else {
indeo5patch.txt:913:+ else
indeo5patch.txt:1272:+ else {
indeo5patch.txt:1317:+ else {
indeo5patch.txt:1599:+ else {
indeo5patch.txt:1610:+ else if (blk == 2) {
indeo5patch.txt:1643:+ else
indeo5patch.txt:1672:+ else
indeo5patch.txt:1760:+ else {
indeo5patch.txt:1770:+ else if (blk == 2) {
{ should be on the same line as the related previous statement
indeo5patch.txt:2480:+ {
indeo5patch.txt:2486:+ {
indeo5patch.txt:2492:+ {
indeo5patch.txt:2498:+ {
indeo5patch.txt:2504:+ {
indeo5patch.txt:2513:+ {
indeo5patch.txt:2519:+ {
indeo5patch.txt:2525:+ {
indeo5patch.txt:2531:+ {
indeo5patch.txt:2537:+ {
indeo5patch.txt:2555:+ {
indeo5patch.txt:2559:+ {
indeo5patch.txt:2563:+ {
indeo5patch.txt:2567:+ {
indeo5patch.txt:2571:+ {
indeo5patch.txt:2578:+ {
indeo5patch.txt:2582:+ {
indeo5patch.txt:2586:+ {
indeo5patch.txt:2590:+ {
indeo5patch.txt:2594:+ {
mismatching doxy params
+ * @param dec [out] ptr to descriptor to be filled with data
Non doxy comments
indeo5patch.txt-95-+/* static vlc tables (initialized at startup) */
indeo5patch.txt:96:+static VLC mb_vlc_tabs[8];
indeo5patch.txt:97:+static VLC blk_vlc_tabs[8];
--
indeo5patch.txt-99-+/* static dequant tables (initialized at startup) */
indeo5patch.txt:100:+static uint16_t deq8x8_intra[5][24][64]; ///< dequant tables for intra blocks 8x8
indeo5patch.txt:101:+static uint16_t deq8x8_inter[5][24][64]; ///< dequant tables for inter blocks 8x8
--
indeo5patch.txt-557-+ mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */
indeo5patch.txt:558:+ else if (ctx->frame_type == IVI5_FRAMETYPE_INTRA)
--
--
indeo5patch.txt-758-+ /* set the initial picture layout according with the basic profile:
indeo5patch.txt:759:+ there is only one band per plane (no scalability), only one tile (no local decoding)
indeo5patch.txt:760:+ and picture format = YVU9 */
--
indeo5patch.txt:932:+ uint16_t codewords[256]; /* FIXME: move this temporal storage out here? */
indeo5patch.txt:933:+ uint8_t bits[256];
--
--
indeo5patch.txt-958-+ /* number of codewords = pos */
indeo5patch.txt:959:+ return init_vlc(pOut, IVI_VLC_BITS, pos, &bits[0], 1, 1, &codewords[0], 2, 2,
--
--
indeo5patch.txt-1197-+/* butterfly operation for the inverse slant transform */
indeo5patch.txt:1198:+#define IVI_SLANT_BFLY(x, y) t1 = x-y; x += y; y = t1;
indeo5patch.txt-1199-+
indeo5patch.txt-1200-+/* The following is a reflection using a,b = 1/2, 5/4 for the inverse slant transform */
indeo5patch.txt:1201:+#define IVI_IREFLECT(s1, s2) {\
--
--
indeo5patch.txt-1211-+/* define the inverse slant8 transform */
indeo5patch.txt:1212:+#define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7, d1, d2, d3, d4, d5, d6, d7, d8) {\
--
--
indeo5patch.txt-1226-+/* define the inverse slant4 transform */
indeo5patch.txt:1227:+#define IVI_INV_SLANT4(s1, s4, s2, s3, d1, d2, d3, d4) {\
--
--
indeo5patch.txt-1250-+ /* apply the InvSlant8 to all columns */
indeo5patch.txt:1251:+#define COMPENSATE(x) (x)
--
indeo5patch.txt-1265-+ /* apply the InvSlant8 to all rows and output the resulting coeffs in the band buffer */
indeo5patch.txt-1266-+ /* the (x + 1)/2 term is needed to compensate the normalization of the forward transform */
indeo5patch.txt:1267:+#define COMPENSATE(x) ((x + 1)>>1)
--
--
indeo5patch.txt-1297-+ /* apply the InvSlant4 to all columns */
indeo5patch.txt:1298:+#define COMPENSATE(x) (x)
--
--
indeo5patch.txt-1311-+ /* apply the InvSlant4 to all columns */
indeo5patch.txt:1312:+#define COMPENSATE(x) ((x + 1)>>1)
--
--
indeo5patch.txt-2244-+/* see ivi_common.c for a definition */
indeo5patch.txt:2245:+extern const IVIHuffDesc mb_huff_desc[8]; ///< static macroblock huffman tables
indeo5patch.txt:2246:+extern const IVIHuffDesc blk_huff_desc[8]; ///< static block huffman tables
--
indeo5patch.txt:2259:+extern const RVMapDesc ivi_rvmap_tabs[9]; /* defined in ivi_common.c */
--
indeo5patch.txt-2263-+ * This structure describes an indeo macroblock (16x16, 8x8 or 4x4).
--
indeo5patch.txt-2367-+/* calculate number of tiles in a stride */
indeo5patch.txt:2368:+#define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_size))
indeo5patch.txt-2369-+
indeo5patch.txt-2370-+/* calculate number of macroblocks in a tile */
indeo5patch.txt:2371:+#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))
--
indeo5patch.txt-2373-+/* convert unsigned values into signed ones (the sign is in the LSB) */
indeo5patch.txt-2374-+/* TODO: find a way to calculate this without the conditional using bit magic */
indeo5patch.txt:2375:+#define IVI_TOSIGNED(val) (((val) & 1) ? ((val) + 1) >> 1 : -(((val) + 1) >> 1))
indeo5patch.txt-2376-+
indeo5patch.txt-2377-+/* divide the motion vector mv by 4 */
indeo5patch.txt:2378:+#define IVI_MV_DIV4(mv) (((mv) + 1 + ((mv) > 0))>>2)
indeo5patch.txt-2379-+
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20090401/94a5c474/attachment.pgp>
More information about the ffmpeg-devel
mailing list