[XviD-devel] how to make struct smaller

Radek Czyz syskin at ihug.com.au
Fri Oct 17 01:45:48 CEST 2003


Hi everyone,

I found away to make MACROBLOCK struct much smaller. How about this:

typedef struct
{
        VECTOR mvs[4];
        int mode;
        int quant;
        int dquant;
        int cbp;
        union {
                struct { /* p/i-frames specific */
                        short int pred_values[6][MBPRED_SIZE];
                        int acpred_directions[6];

                        VECTOR amv;
                        int32_t mcsel;
                };
                struct { /* b-frames specific */
                        VECTOR b_mvs[4];
                        VECTOR b_qmvs[4];
                };
        };
        int field_dct;
        int field_pred;
        int field_for_top;
        int field_for_bot;
        
        /* encoder specific */
        VECTOR qmvs[4];
        VECTOR pmvs[4];
        int32_t sad8[4];
        int32_t sad16;
}
MACROBLOCK;

Is there something bad about this solution? As far as I can see, it
saves us one cacheline for each macroblock - for free.
Any comments?

Radek



More information about the XviD-devel mailing list