Commit 1729a4f2 authored by Zhenyu Wang's avatar Zhenyu Wang

xvmc: move block size lookup helper to generic

parent 3cc8876d
......@@ -38,18 +38,6 @@
#define VOFFSET(surface) (surface->srf.offset + \
SIZE_Y420(surface->width, surface->height))
/* Lookup tables to speed common calculations */
static unsigned int mb_bytes[] = {
000, 128, 128, 256, 128, 256, 256, 384, // 0
128, 256, 256, 384, 256, 384, 384, 512, // 1
128, 256, 256, 384, 256, 384, 384, 512, // 10
256, 384, 384, 512, 384, 512, 512, 640, // 11
128, 256, 256, 384, 256, 384, 384, 512, // 100
256, 384, 384, 512, 384, 512, 512, 640, // 101
256, 384, 384, 512, 384, 512, 512, 640, // 110
384, 512, 512, 640, 512, 640, 640, 768 // 111
};
typedef union {
short s[4];
uint u[2];
......@@ -1931,7 +1919,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context,
XVMC_INFO("no coded blocks present!");
}
bspm = mb_bytes[mb->coded_block_pattern];
bspm = mb_bytes_420[mb->coded_block_pattern];
if (!bspm)
continue;
......
......@@ -26,7 +26,78 @@
*/
#include "intel_xvmc.h"
/* global */
struct _intel_xvmc_driver *xvmc_driver = NULL;
/* Lookup tables to speed common calculations for coded_block_pattern */
/* each block is ((8*8) * sizeof(short)) */
unsigned int mb_bytes_420[] = {
0, /* 0 */
128, /* 1 */
128, /* 10 */
256, /* 11 */
128, /* 100 */
256, /* 101 */
256, /* 110 */
384, /* 111 */
128, /* 1000 */
256, /* 1001 */
256, /* 1010 */
384, /* 1011 */
256, /* 1100 */
384, /* 1101 */
384, /* 1110 */
512, /* 1111 */
128, /* 10000 */
256, /* 10001 */
256, /* 10010 */
384, /* 10011 */
256, /* 10100 */
384, /* 10101 */
384, /* 10110 */
512, /* 10111 */
256, /* 11000 */
384, /* 11001 */
384, /* 11010 */
512, /* 11011 */
384, /* 11100 */
512, /* 11101 */
512, /* 11110 */
640, /* 11111 */
128, /* 100000 */
256, /* 100001 */
256, /* 100010 */
384, /* 100011 */
256, /* 100100 */
384, /* 100101 */
384, /* 100110 */
512, /* 100111 */
256, /* 101000 */
384, /* 101001 */
384, /* 101010 */
512, /* 101011 */
384, /* 101100 */
512, /* 101101 */
512, /* 101110 */
640, /* 101111 */
256, /* 110000 */
384, /* 110001 */
384, /* 110010 */
512, /* 110011 */
384, /* 110100 */
512, /* 110101 */
512, /* 110110 */
640, /* 110111 */
384, /* 111000 */
512, /* 111001 */
512, /* 111010 */
640, /* 111011 */
512, /* 111100 */
640, /* 111101 */
640, /* 111110 */
768 /* 111111 */
};
static int error_base;
static int event_base;
......
......@@ -249,4 +249,6 @@ static inline const char* intel_xvmc_decoder_string(int flag)
extern intel_xvmc_context_ptr intel_xvmc_find_context(XID id);
extern intel_xvmc_surface_ptr intel_xvmc_find_surface(XID id);
extern unsigned int mb_bytes_420[64];
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment