Restyle code
Approximate the Google style guide[1] so that that there's a written document to follow and tools to check compliance[2]. [1]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml [2]: http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py Change-Id: Idf40e3d8dddcc72150f6af127b13e5dab838685f
This commit is contained in:
parent
8697c6e454
commit
c6b9039fd9
371
args.c
371
args.c
@ -25,241 +25,214 @@ extern void die(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
|
||||
struct arg arg_init(char **argv)
|
||||
{
|
||||
struct arg a;
|
||||
struct arg arg_init(char **argv) {
|
||||
struct arg a;
|
||||
|
||||
a.argv = argv;
|
||||
a.argv_step = 1;
|
||||
a.name = NULL;
|
||||
a.val = NULL;
|
||||
a.def = NULL;
|
||||
return a;
|
||||
a.argv = argv;
|
||||
a.argv_step = 1;
|
||||
a.name = NULL;
|
||||
a.val = NULL;
|
||||
a.def = NULL;
|
||||
return a;
|
||||
}
|
||||
|
||||
int arg_match(struct arg *arg_, const struct arg_def *def, char **argv)
|
||||
{
|
||||
struct arg arg;
|
||||
int arg_match(struct arg *arg_, const struct arg_def *def, char **argv) {
|
||||
struct arg arg;
|
||||
|
||||
if (!argv[0] || argv[0][0] != '-')
|
||||
return 0;
|
||||
if (!argv[0] || argv[0][0] != '-')
|
||||
return 0;
|
||||
|
||||
arg = arg_init(argv);
|
||||
arg = arg_init(argv);
|
||||
|
||||
if (def->short_name
|
||||
&& strlen(arg.argv[0]) == strlen(def->short_name) + 1
|
||||
&& !strcmp(arg.argv[0] + 1, def->short_name))
|
||||
{
|
||||
if (def->short_name
|
||||
&& strlen(arg.argv[0]) == strlen(def->short_name) + 1
|
||||
&& !strcmp(arg.argv[0] + 1, def->short_name)) {
|
||||
|
||||
arg.name = arg.argv[0] + 1;
|
||||
arg.val = def->has_val ? arg.argv[1] : NULL;
|
||||
arg.argv_step = def->has_val ? 2 : 1;
|
||||
arg.name = arg.argv[0] + 1;
|
||||
arg.val = def->has_val ? arg.argv[1] : NULL;
|
||||
arg.argv_step = def->has_val ? 2 : 1;
|
||||
} else if (def->long_name) {
|
||||
int name_len = strlen(def->long_name);
|
||||
|
||||
if (strlen(arg.argv[0]) >= name_len + 2
|
||||
&& arg.argv[0][1] == '-'
|
||||
&& !strncmp(arg.argv[0] + 2, def->long_name, name_len)
|
||||
&& (arg.argv[0][name_len + 2] == '='
|
||||
|| arg.argv[0][name_len + 2] == '\0')) {
|
||||
|
||||
arg.name = arg.argv[0] + 2;
|
||||
arg.val = arg.name[name_len] == '=' ? arg.name + name_len + 1 : NULL;
|
||||
arg.argv_step = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg.name && !arg.val && def->has_val)
|
||||
die("Error: option %s requires argument.\n", arg.name);
|
||||
|
||||
if (arg.name && arg.val && !def->has_val)
|
||||
die("Error: option %s requires no argument.\n", arg.name);
|
||||
|
||||
if (arg.name
|
||||
&& (arg.val || !def->has_val)) {
|
||||
arg.def = def;
|
||||
*arg_ = arg;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const char *arg_next(struct arg *arg) {
|
||||
if (arg->argv[0])
|
||||
arg->argv += arg->argv_step;
|
||||
|
||||
return *arg->argv;
|
||||
}
|
||||
|
||||
|
||||
char **argv_dup(int argc, const char **argv) {
|
||||
char **new_argv = malloc((argc + 1) * sizeof(*argv));
|
||||
|
||||
memcpy(new_argv, argv, argc * sizeof(*argv));
|
||||
new_argv[argc] = NULL;
|
||||
return new_argv;
|
||||
}
|
||||
|
||||
|
||||
void arg_show_usage(FILE *fp, const struct arg_def *const *defs) {
|
||||
char option_text[40] = {0};
|
||||
|
||||
for (; *defs; defs++) {
|
||||
const struct arg_def *def = *defs;
|
||||
char *short_val = def->has_val ? " <arg>" : "";
|
||||
char *long_val = def->has_val ? "=<arg>" : "";
|
||||
|
||||
if (def->short_name && def->long_name) {
|
||||
char *comma = def->has_val ? "," : ", ";
|
||||
|
||||
snprintf(option_text, 37, "-%s%s%s --%s%6s",
|
||||
def->short_name, short_val, comma,
|
||||
def->long_name, long_val);
|
||||
} else if (def->short_name)
|
||||
snprintf(option_text, 37, "-%s%s",
|
||||
def->short_name, short_val);
|
||||
else if (def->long_name)
|
||||
{
|
||||
int name_len = strlen(def->long_name);
|
||||
snprintf(option_text, 37, " --%s%s",
|
||||
def->long_name, long_val);
|
||||
|
||||
if (strlen(arg.argv[0]) >= name_len + 2
|
||||
&& arg.argv[0][1] == '-'
|
||||
&& !strncmp(arg.argv[0] + 2, def->long_name, name_len)
|
||||
&& (arg.argv[0][name_len+2] == '='
|
||||
|| arg.argv[0][name_len+2] == '\0'))
|
||||
{
|
||||
fprintf(fp, " %-37s\t%s\n", option_text, def->desc);
|
||||
|
||||
arg.name = arg.argv[0] + 2;
|
||||
arg.val = arg.name[name_len] == '=' ? arg.name + name_len + 1 : NULL;
|
||||
arg.argv_step = 1;
|
||||
}
|
||||
if (def->enums) {
|
||||
const struct arg_enum_list *listptr;
|
||||
|
||||
fprintf(fp, " %-37s\t ", "");
|
||||
|
||||
for (listptr = def->enums; listptr->name; listptr++)
|
||||
fprintf(fp, "%s%s", listptr->name,
|
||||
listptr[1].name ? ", " : "\n");
|
||||
}
|
||||
|
||||
if (arg.name && !arg.val && def->has_val)
|
||||
die("Error: option %s requires argument.\n", arg.name);
|
||||
|
||||
if (arg.name && arg.val && !def->has_val)
|
||||
die("Error: option %s requires no argument.\n", arg.name);
|
||||
|
||||
if (arg.name
|
||||
&& (arg.val || !def->has_val))
|
||||
{
|
||||
arg.def = def;
|
||||
*arg_ = arg;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *arg_next(struct arg *arg)
|
||||
{
|
||||
if (arg->argv[0])
|
||||
arg->argv += arg->argv_step;
|
||||
unsigned int arg_parse_uint(const struct arg *arg) {
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
|
||||
return *arg->argv;
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0') {
|
||||
if (rawval >= 0 && rawval <= UINT_MAX)
|
||||
return rawval;
|
||||
|
||||
die("Option %s: Value %ld out of range for unsigned int\n",
|
||||
arg->name, rawval);
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char **argv_dup(int argc, const char **argv)
|
||||
{
|
||||
char **new_argv = malloc((argc + 1) * sizeof(*argv));
|
||||
int arg_parse_int(const struct arg *arg) {
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
|
||||
memcpy(new_argv, argv, argc * sizeof(*argv));
|
||||
new_argv[argc] = NULL;
|
||||
return new_argv;
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0') {
|
||||
if (rawval >= INT_MIN && rawval <= INT_MAX)
|
||||
return rawval;
|
||||
|
||||
die("Option %s: Value %ld out of range for signed int\n",
|
||||
arg->name, rawval);
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void arg_show_usage(FILE *fp, const struct arg_def *const *defs)
|
||||
{
|
||||
char option_text[40] = {0};
|
||||
|
||||
for (; *defs; defs++)
|
||||
{
|
||||
const struct arg_def *def = *defs;
|
||||
char *short_val = def->has_val ? " <arg>" : "";
|
||||
char *long_val = def->has_val ? "=<arg>" : "";
|
||||
|
||||
if (def->short_name && def->long_name)
|
||||
{
|
||||
char *comma = def->has_val ? "," : ", ";
|
||||
|
||||
snprintf(option_text, 37, "-%s%s%s --%s%6s",
|
||||
def->short_name, short_val, comma,
|
||||
def->long_name, long_val);
|
||||
}
|
||||
else if (def->short_name)
|
||||
snprintf(option_text, 37, "-%s%s",
|
||||
def->short_name, short_val);
|
||||
else if (def->long_name)
|
||||
snprintf(option_text, 37, " --%s%s",
|
||||
def->long_name, long_val);
|
||||
|
||||
fprintf(fp, " %-37s\t%s\n", option_text, def->desc);
|
||||
|
||||
if(def->enums)
|
||||
{
|
||||
const struct arg_enum_list *listptr;
|
||||
|
||||
fprintf(fp, " %-37s\t ", "");
|
||||
|
||||
for(listptr = def->enums; listptr->name; listptr++)
|
||||
fprintf(fp, "%s%s", listptr->name,
|
||||
listptr[1].name ? ", " : "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned int arg_parse_uint(const struct arg *arg)
|
||||
{
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0')
|
||||
{
|
||||
if (rawval >= 0 && rawval <= UINT_MAX)
|
||||
return rawval;
|
||||
|
||||
die("Option %s: Value %ld out of range for unsigned int\n",
|
||||
arg->name, rawval);
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int arg_parse_int(const struct arg *arg)
|
||||
{
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0')
|
||||
{
|
||||
if (rawval >= INT_MIN && rawval <= INT_MAX)
|
||||
return rawval;
|
||||
|
||||
die("Option %s: Value %ld out of range for signed int\n",
|
||||
arg->name, rawval);
|
||||
}
|
||||
|
||||
die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct vpx_rational
|
||||
{
|
||||
int num; /**< fraction numerator */
|
||||
int den; /**< fraction denominator */
|
||||
struct vpx_rational {
|
||||
int num; /**< fraction numerator */
|
||||
int den; /**< fraction denominator */
|
||||
};
|
||||
struct vpx_rational arg_parse_rational(const struct arg *arg)
|
||||
{
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
struct vpx_rational rat;
|
||||
struct vpx_rational arg_parse_rational(const struct arg *arg) {
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
struct vpx_rational rat;
|
||||
|
||||
/* parse numerator */
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
/* parse numerator */
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
|
||||
if (arg->val[0] != '\0' && endptr[0] == '/')
|
||||
{
|
||||
if (rawval >= INT_MIN && rawval <= INT_MAX)
|
||||
rat.num = rawval;
|
||||
else die("Option %s: Value %ld out of range for signed int\n",
|
||||
arg->name, rawval);
|
||||
}
|
||||
else die("Option %s: Expected / at '%c'\n", arg->name, *endptr);
|
||||
if (arg->val[0] != '\0' && endptr[0] == '/') {
|
||||
if (rawval >= INT_MIN && rawval <= INT_MAX)
|
||||
rat.num = rawval;
|
||||
else die("Option %s: Value %ld out of range for signed int\n",
|
||||
arg->name, rawval);
|
||||
} else die("Option %s: Expected / at '%c'\n", arg->name, *endptr);
|
||||
|
||||
/* parse denominator */
|
||||
rawval = strtol(endptr + 1, &endptr, 10);
|
||||
/* parse denominator */
|
||||
rawval = strtol(endptr + 1, &endptr, 10);
|
||||
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0')
|
||||
{
|
||||
if (rawval >= INT_MIN && rawval <= INT_MAX)
|
||||
rat.den = rawval;
|
||||
else die("Option %s: Value %ld out of range for signed int\n",
|
||||
arg->name, rawval);
|
||||
}
|
||||
else die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0') {
|
||||
if (rawval >= INT_MIN && rawval <= INT_MAX)
|
||||
rat.den = rawval;
|
||||
else die("Option %s: Value %ld out of range for signed int\n",
|
||||
arg->name, rawval);
|
||||
} else die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
|
||||
|
||||
return rat;
|
||||
return rat;
|
||||
}
|
||||
|
||||
|
||||
int arg_parse_enum(const struct arg *arg)
|
||||
{
|
||||
const struct arg_enum_list *listptr;
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
int arg_parse_enum(const struct arg *arg) {
|
||||
const struct arg_enum_list *listptr;
|
||||
long int rawval;
|
||||
char *endptr;
|
||||
|
||||
/* First see if the value can be parsed as a raw value */
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0')
|
||||
{
|
||||
/* Got a raw value, make sure it's valid */
|
||||
for(listptr = arg->def->enums; listptr->name; listptr++)
|
||||
if(listptr->val == rawval)
|
||||
return rawval;
|
||||
}
|
||||
/* First see if the value can be parsed as a raw value */
|
||||
rawval = strtol(arg->val, &endptr, 10);
|
||||
if (arg->val[0] != '\0' && endptr[0] == '\0') {
|
||||
/* Got a raw value, make sure it's valid */
|
||||
for (listptr = arg->def->enums; listptr->name; listptr++)
|
||||
if (listptr->val == rawval)
|
||||
return rawval;
|
||||
}
|
||||
|
||||
/* Next see if it can be parsed as a string */
|
||||
for(listptr = arg->def->enums; listptr->name; listptr++)
|
||||
if(!strcmp(arg->val, listptr->name))
|
||||
return listptr->val;
|
||||
/* Next see if it can be parsed as a string */
|
||||
for (listptr = arg->def->enums; listptr->name; listptr++)
|
||||
if (!strcmp(arg->val, listptr->name))
|
||||
return listptr->val;
|
||||
|
||||
die("Option %s: Invalid value '%s'\n", arg->name, arg->val);
|
||||
return 0;
|
||||
die("Option %s: Invalid value '%s'\n", arg->name, arg->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int arg_parse_enum_or_int(const struct arg *arg)
|
||||
{
|
||||
if(arg->def->enums)
|
||||
return arg_parse_enum(arg);
|
||||
return arg_parse_int(arg);
|
||||
int arg_parse_enum_or_int(const struct arg *arg) {
|
||||
if (arg->def->enums)
|
||||
return arg_parse_enum(arg);
|
||||
return arg_parse_int(arg);
|
||||
}
|
||||
|
33
args.h
33
args.h
@ -13,29 +13,26 @@
|
||||
#define ARGS_H
|
||||
#include <stdio.h>
|
||||
|
||||
struct arg
|
||||
{
|
||||
char **argv;
|
||||
const char *name;
|
||||
const char *val;
|
||||
unsigned int argv_step;
|
||||
const struct arg_def *def;
|
||||
struct arg {
|
||||
char **argv;
|
||||
const char *name;
|
||||
const char *val;
|
||||
unsigned int argv_step;
|
||||
const struct arg_def *def;
|
||||
};
|
||||
|
||||
struct arg_enum_list
|
||||
{
|
||||
const char *name;
|
||||
int val;
|
||||
struct arg_enum_list {
|
||||
const char *name;
|
||||
int val;
|
||||
};
|
||||
#define ARG_ENUM_LIST_END {0}
|
||||
|
||||
typedef struct arg_def
|
||||
{
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
int has_val;
|
||||
const char *desc;
|
||||
const struct arg_enum_list *enums;
|
||||
typedef struct arg_def {
|
||||
const char *short_name;
|
||||
const char *long_name;
|
||||
int has_val;
|
||||
const char *desc;
|
||||
const struct arg_enum_list *enums;
|
||||
} arg_def_t;
|
||||
#define ARG_DEF(s,l,v,d) {s,l,v,d, NULL}
|
||||
#define ARG_DEF_ENUM(s,l,v,d,e) {s,l,v,d,e}
|
||||
|
File diff suppressed because it is too large
Load Diff
297
example_xma.c
297
example_xma.c
@ -25,190 +25,167 @@
|
||||
static char *exec_name;
|
||||
static int verbose = 0;
|
||||
|
||||
static const struct
|
||||
{
|
||||
const char *name;
|
||||
const vpx_codec_iface_t *iface;
|
||||
} ifaces[] =
|
||||
{
|
||||
static const struct {
|
||||
const char *name;
|
||||
const vpx_codec_iface_t *iface;
|
||||
} ifaces[] = {
|
||||
#if CONFIG_VP8_DECODER
|
||||
{"vp8", &vpx_codec_vp8_dx_algo},
|
||||
{"vp8", &vpx_codec_vp8_dx_algo},
|
||||
#endif
|
||||
};
|
||||
|
||||
static void usage_exit(void)
|
||||
{
|
||||
int i;
|
||||
static void usage_exit(void) {
|
||||
int i;
|
||||
|
||||
printf("Usage: %s <options>\n\n"
|
||||
"Options:\n"
|
||||
"\t--codec <name>\tCodec to use (default=%s)\n"
|
||||
"\t-h <height>\tHeight of the simulated video frame, in pixels\n"
|
||||
"\t-w <width> \tWidth of the simulated video frame, in pixels\n"
|
||||
"\t-v \tVerbose mode (show individual segment sizes)\n"
|
||||
"\t--help \tShow this message\n"
|
||||
"\n"
|
||||
"Included decoders:\n"
|
||||
"\n",
|
||||
exec_name,
|
||||
ifaces[0].name);
|
||||
printf("Usage: %s <options>\n\n"
|
||||
"Options:\n"
|
||||
"\t--codec <name>\tCodec to use (default=%s)\n"
|
||||
"\t-h <height>\tHeight of the simulated video frame, in pixels\n"
|
||||
"\t-w <width> \tWidth of the simulated video frame, in pixels\n"
|
||||
"\t-v \tVerbose mode (show individual segment sizes)\n"
|
||||
"\t--help \tShow this message\n"
|
||||
"\n"
|
||||
"Included decoders:\n"
|
||||
"\n",
|
||||
exec_name,
|
||||
ifaces[0].name);
|
||||
|
||||
for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
|
||||
printf(" %-6s - %s\n",
|
||||
ifaces[i].name,
|
||||
vpx_codec_iface_name(ifaces[i].iface));
|
||||
for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
|
||||
printf(" %-6s - %s\n",
|
||||
ifaces[i].name,
|
||||
vpx_codec_iface_name(ifaces[i].iface));
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void usage_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
printf("\n");
|
||||
usage_exit();
|
||||
static void usage_error(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
printf("\n");
|
||||
usage_exit();
|
||||
}
|
||||
|
||||
void my_mem_dtor(vpx_codec_mmap_t *mmap)
|
||||
{
|
||||
if (verbose)
|
||||
printf("freeing segment %d\n", mmap->id);
|
||||
void my_mem_dtor(vpx_codec_mmap_t *mmap) {
|
||||
if (verbose)
|
||||
printf("freeing segment %d\n", mmap->id);
|
||||
|
||||
free(mmap->priv);
|
||||
free(mmap->priv);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
vpx_codec_ctx_t decoder;
|
||||
vpx_codec_iface_t *iface = ifaces[0].iface;
|
||||
vpx_codec_iter_t iter;
|
||||
vpx_codec_dec_cfg_t cfg;
|
||||
vpx_codec_err_t res = VPX_CODEC_OK;
|
||||
unsigned int alloc_sz = 0;
|
||||
unsigned int w = 352;
|
||||
unsigned int h = 288;
|
||||
int i;
|
||||
int main(int argc, char **argv) {
|
||||
vpx_codec_ctx_t decoder;
|
||||
vpx_codec_iface_t *iface = ifaces[0].iface;
|
||||
vpx_codec_iter_t iter;
|
||||
vpx_codec_dec_cfg_t cfg;
|
||||
vpx_codec_err_t res = VPX_CODEC_OK;
|
||||
unsigned int alloc_sz = 0;
|
||||
unsigned int w = 352;
|
||||
unsigned int h = 288;
|
||||
int i;
|
||||
|
||||
exec_name = argv[0];
|
||||
exec_name = argv[0];
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (!strcmp(argv[i], "--codec"))
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
int j, k = -1;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "--codec")) {
|
||||
if (i + 1 < argc) {
|
||||
int j, k = -1;
|
||||
|
||||
i++;
|
||||
i++;
|
||||
|
||||
for (j = 0; j < sizeof(ifaces) / sizeof(ifaces[0]); j++)
|
||||
if (!strcmp(ifaces[j].name, argv[i]))
|
||||
k = j;
|
||||
for (j = 0; j < sizeof(ifaces) / sizeof(ifaces[0]); j++)
|
||||
if (!strcmp(ifaces[j].name, argv[i]))
|
||||
k = j;
|
||||
|
||||
if (k >= 0)
|
||||
iface = ifaces[k].iface;
|
||||
else
|
||||
usage_error("Error: Unrecognized argument (%s) to --codec\n",
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
usage_error("Error: Option --codec requires argument.\n");
|
||||
}
|
||||
else if (!strcmp(argv[i], "-v"))
|
||||
verbose = 1;
|
||||
else if (!strcmp(argv[i], "-h"))
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
h = atoi(argv[++i]);
|
||||
}
|
||||
else
|
||||
usage_error("Error: Option -h requires argument.\n");
|
||||
else if (!strcmp(argv[i], "-w"))
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
w = atoi(argv[++i]);
|
||||
}
|
||||
else
|
||||
usage_error("Error: Option -w requires argument.\n");
|
||||
else if (!strcmp(argv[i], "--help"))
|
||||
usage_exit();
|
||||
if (k >= 0)
|
||||
iface = ifaces[k].iface;
|
||||
else
|
||||
usage_error("Error: Unrecognized option %s\n\n", argv[i]);
|
||||
}
|
||||
usage_error("Error: Unrecognized argument (%s) to --codec\n",
|
||||
argv[i]);
|
||||
} else
|
||||
usage_error("Error: Option --codec requires argument.\n");
|
||||
} else if (!strcmp(argv[i], "-v"))
|
||||
verbose = 1;
|
||||
else if (!strcmp(argv[i], "-h"))
|
||||
if (i + 1 < argc) {
|
||||
h = atoi(argv[++i]);
|
||||
} else
|
||||
usage_error("Error: Option -h requires argument.\n");
|
||||
else if (!strcmp(argv[i], "-w"))
|
||||
if (i + 1 < argc) {
|
||||
w = atoi(argv[++i]);
|
||||
} else
|
||||
usage_error("Error: Option -w requires argument.\n");
|
||||
else if (!strcmp(argv[i], "--help"))
|
||||
usage_exit();
|
||||
else
|
||||
usage_error("Error: Unrecognized option %s\n\n", argv[i]);
|
||||
}
|
||||
|
||||
if (argc == 1)
|
||||
printf("Using built-in defaults. For options, rerun with --help\n\n");
|
||||
if (argc == 1)
|
||||
printf("Using built-in defaults. For options, rerun with --help\n\n");
|
||||
|
||||
/* XMA mode is not supported on all decoders! */
|
||||
if (!(vpx_codec_get_caps(iface) & VPX_CODEC_CAP_XMA))
|
||||
{
|
||||
printf("%s does not support XMA mode!\n", vpx_codec_iface_name(iface));
|
||||
/* XMA mode is not supported on all decoders! */
|
||||
if (!(vpx_codec_get_caps(iface) & VPX_CODEC_CAP_XMA)) {
|
||||
printf("%s does not support XMA mode!\n", vpx_codec_iface_name(iface));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* The codec knows how much memory to allocate based on the size of the
|
||||
* encoded frames. This data can be parsed from the bitstream with
|
||||
* vpx_codec_peek_stream_info() if a bitstream is available. Otherwise,
|
||||
* a fixed size can be used that will be the upper limit on the frame
|
||||
* size the decoder can decode.
|
||||
*/
|
||||
cfg.w = w;
|
||||
cfg.h = h;
|
||||
|
||||
/* Initialize the decoder in XMA mode. */
|
||||
if (vpx_codec_dec_init(&decoder, iface, &cfg, VPX_CODEC_USE_XMA)) {
|
||||
printf("Failed to initialize decoder in XMA mode: %s\n", vpx_codec_error(&decoder));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Iterate through the list of memory maps, allocating them with the
|
||||
* requested alignment.
|
||||
*/
|
||||
iter = NULL;
|
||||
|
||||
do {
|
||||
vpx_codec_mmap_t mmap;
|
||||
unsigned int align;
|
||||
|
||||
res = vpx_codec_get_mem_map(&decoder, &mmap, &iter);
|
||||
align = mmap.align ? mmap.align - 1 : 0;
|
||||
|
||||
if (!res) {
|
||||
if (verbose)
|
||||
printf("Allocating segment %u, size %lu, align %u %s\n",
|
||||
mmap.id, mmap.sz, mmap.align,
|
||||
mmap.flags & VPX_CODEC_MEM_ZERO ? "(ZEROED)" : "");
|
||||
|
||||
if (mmap.flags & VPX_CODEC_MEM_ZERO)
|
||||
mmap.priv = calloc(1, mmap.sz + align);
|
||||
else
|
||||
mmap.priv = malloc(mmap.sz + align);
|
||||
|
||||
mmap.base = (void *)((((uintptr_t)mmap.priv) + align) & ~(uintptr_t)align);
|
||||
mmap.dtor = my_mem_dtor;
|
||||
alloc_sz += mmap.sz + align;
|
||||
|
||||
if (vpx_codec_set_mem_map(&decoder, &mmap, 1)) {
|
||||
printf("Failed to set mmap: %s\n", vpx_codec_error(&decoder));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} else if (res != VPX_CODEC_LIST_END) {
|
||||
printf("Failed to get mmap: %s\n", vpx_codec_error(&decoder));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} while (res != VPX_CODEC_LIST_END);
|
||||
|
||||
/* The codec knows how much memory to allocate based on the size of the
|
||||
* encoded frames. This data can be parsed from the bitstream with
|
||||
* vpx_codec_peek_stream_info() if a bitstream is available. Otherwise,
|
||||
* a fixed size can be used that will be the upper limit on the frame
|
||||
* size the decoder can decode.
|
||||
*/
|
||||
cfg.w = w;
|
||||
cfg.h = h;
|
||||
|
||||
/* Initialize the decoder in XMA mode. */
|
||||
if (vpx_codec_dec_init(&decoder, iface, &cfg, VPX_CODEC_USE_XMA))
|
||||
{
|
||||
printf("Failed to initialize decoder in XMA mode: %s\n", vpx_codec_error(&decoder));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Iterate through the list of memory maps, allocating them with the
|
||||
* requested alignment.
|
||||
*/
|
||||
iter = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
vpx_codec_mmap_t mmap;
|
||||
unsigned int align;
|
||||
|
||||
res = vpx_codec_get_mem_map(&decoder, &mmap, &iter);
|
||||
align = mmap.align ? mmap.align - 1 : 0;
|
||||
|
||||
if (!res)
|
||||
{
|
||||
if (verbose)
|
||||
printf("Allocating segment %u, size %lu, align %u %s\n",
|
||||
mmap.id, mmap.sz, mmap.align,
|
||||
mmap.flags & VPX_CODEC_MEM_ZERO ? "(ZEROED)" : "");
|
||||
|
||||
if (mmap.flags & VPX_CODEC_MEM_ZERO)
|
||||
mmap.priv = calloc(1, mmap.sz + align);
|
||||
else
|
||||
mmap.priv = malloc(mmap.sz + align);
|
||||
|
||||
mmap.base = (void *)((((uintptr_t)mmap.priv) + align) & ~(uintptr_t)align);
|
||||
mmap.dtor = my_mem_dtor;
|
||||
alloc_sz += mmap.sz + align;
|
||||
|
||||
if (vpx_codec_set_mem_map(&decoder, &mmap, 1))
|
||||
{
|
||||
printf("Failed to set mmap: %s\n", vpx_codec_error(&decoder));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
else if (res != VPX_CODEC_LIST_END)
|
||||
{
|
||||
printf("Failed to get mmap: %s\n", vpx_codec_error(&decoder));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
while (res != VPX_CODEC_LIST_END);
|
||||
|
||||
printf("%s\n %d bytes external memory required for %dx%d.\n",
|
||||
decoder.name, alloc_sz, cfg.w, cfg.h);
|
||||
vpx_codec_destroy(&decoder);
|
||||
return EXIT_SUCCESS;
|
||||
printf("%s\n %d bytes external memory required for %dx%d.\n",
|
||||
decoder.name, alloc_sz, cfg.w, cfg.h);
|
||||
vpx_codec_destroy(&decoder);
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
@ -1,60 +1,54 @@
|
||||
//#include <strmif.h>
|
||||
// #include <strmif.h>
|
||||
#include "EbmlBufferWriter.h"
|
||||
#include "EbmlWriter.h"
|
||||
//#include <cassert>
|
||||
//#include <limits>
|
||||
//#include <malloc.h> //_alloca
|
||||
// #include <cassert>
|
||||
// #include <limits>
|
||||
// #include <malloc.h> //_alloca
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
|
||||
void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len)
|
||||
{
|
||||
unsigned char *src = glob->buf;
|
||||
src += glob->offset;
|
||||
memcpy(src, buffer_in, len);
|
||||
glob->offset += len;
|
||||
void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len) {
|
||||
unsigned char *src = glob->buf;
|
||||
src += glob->offset;
|
||||
memcpy(src, buffer_in, len);
|
||||
glob->offset += len;
|
||||
}
|
||||
|
||||
static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned char *q)
|
||||
{
|
||||
while (q != p)
|
||||
{
|
||||
--q;
|
||||
static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned char *q) {
|
||||
while (q != p) {
|
||||
--q;
|
||||
|
||||
unsigned long cbWritten;
|
||||
memcpy(&(glob->buf[glob->offset]), q, 1);
|
||||
glob->offset ++;
|
||||
}
|
||||
unsigned long cbWritten;
|
||||
memcpy(&(glob->buf[glob->offset]), q, 1);
|
||||
glob->offset++;
|
||||
}
|
||||
}
|
||||
|
||||
void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len)
|
||||
{
|
||||
//assert(buf);
|
||||
void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) {
|
||||
// assert(buf);
|
||||
|
||||
const unsigned char *const p = (const unsigned char *)(buffer_in);
|
||||
const unsigned char *const q = p + len;
|
||||
const unsigned char *const p = (const unsigned char *)(buffer_in);
|
||||
const unsigned char *const q = p + len;
|
||||
|
||||
_Serialize(glob, p, q);
|
||||
_Serialize(glob, p, q);
|
||||
}
|
||||
|
||||
|
||||
void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id)
|
||||
{
|
||||
Ebml_WriteID(glob, class_id);
|
||||
ebmlLoc->offset = glob->offset;
|
||||
//todo this is always taking 8 bytes, this may need later optimization
|
||||
unsigned long long unknownLen = 0x01FFFFFFFFFFFFFFLLU;
|
||||
Ebml_Serialize(glob, (void *)&unknownLen, 8); //this is a key that says lenght unknown
|
||||
void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id) {
|
||||
Ebml_WriteID(glob, class_id);
|
||||
ebmlLoc->offset = glob->offset;
|
||||
// todo this is always taking 8 bytes, this may need later optimization
|
||||
unsigned long long unknownLen = 0x01FFFFFFFFFFFFFFLLU;
|
||||
Ebml_Serialize(glob, (void *)&unknownLen, 8); // this is a key that says lenght unknown
|
||||
}
|
||||
|
||||
void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc)
|
||||
{
|
||||
unsigned long long size = glob->offset - ebmlLoc->offset - 8;
|
||||
unsigned long long curOffset = glob->offset;
|
||||
glob->offset = ebmlLoc->offset;
|
||||
size |= 0x0100000000000000LLU;
|
||||
Ebml_Serialize(glob, &size, 8);
|
||||
glob->offset = curOffset;
|
||||
void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc) {
|
||||
unsigned long long size = glob->offset - ebmlLoc->offset - 8;
|
||||
unsigned long long curOffset = glob->offset;
|
||||
glob->offset = ebmlLoc->offset;
|
||||
size |= 0x0100000000000000LLU;
|
||||
Ebml_Serialize(glob, &size, 8);
|
||||
glob->offset = curOffset;
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,14 @@
|
||||
#ifndef EBMLBUFFERWRITER_HPP
|
||||
#define EBMLBUFFERWRITER_HPP
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long long offset;
|
||||
typedef struct {
|
||||
unsigned long long offset;
|
||||
} EbmlLoc;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char *buf;
|
||||
unsigned int length;
|
||||
unsigned int offset;
|
||||
typedef struct {
|
||||
unsigned char *buf;
|
||||
unsigned int length;
|
||||
unsigned int offset;
|
||||
} EbmlGlobal;
|
||||
|
||||
|
||||
|
191
libmkv/EbmlIDs.h
191
libmkv/EbmlIDs.h
@ -10,37 +10,36 @@
|
||||
#ifndef MKV_DEFS_HPP
|
||||
#define MKV_DEFS_HPP 1
|
||||
|
||||
//Commenting out values not available in webm, but available in matroska
|
||||
// Commenting out values not available in webm, but available in matroska
|
||||
|
||||
enum mkv
|
||||
{
|
||||
EBML = 0x1A45DFA3,
|
||||
EBMLVersion = 0x4286,
|
||||
EBMLReadVersion = 0x42F7,
|
||||
EBMLMaxIDLength = 0x42F2,
|
||||
EBMLMaxSizeLength = 0x42F3,
|
||||
DocType = 0x4282,
|
||||
DocTypeVersion = 0x4287,
|
||||
DocTypeReadVersion = 0x4285,
|
||||
enum mkv {
|
||||
EBML = 0x1A45DFA3,
|
||||
EBMLVersion = 0x4286,
|
||||
EBMLReadVersion = 0x42F7,
|
||||
EBMLMaxIDLength = 0x42F2,
|
||||
EBMLMaxSizeLength = 0x42F3,
|
||||
DocType = 0x4282,
|
||||
DocTypeVersion = 0x4287,
|
||||
DocTypeReadVersion = 0x4285,
|
||||
// CRC_32 = 0xBF,
|
||||
Void = 0xEC,
|
||||
SignatureSlot = 0x1B538667,
|
||||
SignatureAlgo = 0x7E8A,
|
||||
SignatureHash = 0x7E9A,
|
||||
SignaturePublicKey = 0x7EA5,
|
||||
Signature = 0x7EB5,
|
||||
SignatureElements = 0x7E5B,
|
||||
SignatureElementList = 0x7E7B,
|
||||
SignedElement = 0x6532,
|
||||
//segment
|
||||
Segment = 0x18538067,
|
||||
//Meta Seek Information
|
||||
SeekHead = 0x114D9B74,
|
||||
Seek = 0x4DBB,
|
||||
SeekID = 0x53AB,
|
||||
SeekPosition = 0x53AC,
|
||||
//Segment Information
|
||||
Info = 0x1549A966,
|
||||
Void = 0xEC,
|
||||
SignatureSlot = 0x1B538667,
|
||||
SignatureAlgo = 0x7E8A,
|
||||
SignatureHash = 0x7E9A,
|
||||
SignaturePublicKey = 0x7EA5,
|
||||
Signature = 0x7EB5,
|
||||
SignatureElements = 0x7E5B,
|
||||
SignatureElementList = 0x7E7B,
|
||||
SignedElement = 0x6532,
|
||||
// segment
|
||||
Segment = 0x18538067,
|
||||
// Meta Seek Information
|
||||
SeekHead = 0x114D9B74,
|
||||
Seek = 0x4DBB,
|
||||
SeekID = 0x53AB,
|
||||
SeekPosition = 0x53AC,
|
||||
// Segment Information
|
||||
Info = 0x1549A966,
|
||||
// SegmentUID = 0x73A4,
|
||||
// SegmentFilename = 0x7384,
|
||||
// PrevUID = 0x3CB923,
|
||||
@ -52,61 +51,61 @@ enum mkv
|
||||
// ChapterTranslateEditionUID = 0x69FC,
|
||||
// ChapterTranslateCodec = 0x69BF,
|
||||
// ChapterTranslateID = 0x69A5,
|
||||
TimecodeScale = 0x2AD7B1,
|
||||
Segment_Duration = 0x4489,
|
||||
DateUTC = 0x4461,
|
||||
TimecodeScale = 0x2AD7B1,
|
||||
Segment_Duration = 0x4489,
|
||||
DateUTC = 0x4461,
|
||||
// Title = 0x7BA9,
|
||||
MuxingApp = 0x4D80,
|
||||
WritingApp = 0x5741,
|
||||
//Cluster
|
||||
Cluster = 0x1F43B675,
|
||||
Timecode = 0xE7,
|
||||
MuxingApp = 0x4D80,
|
||||
WritingApp = 0x5741,
|
||||
// Cluster
|
||||
Cluster = 0x1F43B675,
|
||||
Timecode = 0xE7,
|
||||
// SilentTracks = 0x5854,
|
||||
// SilentTrackNumber = 0x58D7,
|
||||
// Position = 0xA7,
|
||||
PrevSize = 0xAB,
|
||||
BlockGroup = 0xA0,
|
||||
Block = 0xA1,
|
||||
PrevSize = 0xAB,
|
||||
BlockGroup = 0xA0,
|
||||
Block = 0xA1,
|
||||
// BlockVirtual = 0xA2,
|
||||
// BlockAdditions = 0x75A1,
|
||||
// BlockMore = 0xA6,
|
||||
// BlockAddID = 0xEE,
|
||||
// BlockAdditional = 0xA5,
|
||||
BlockDuration = 0x9B,
|
||||
BlockDuration = 0x9B,
|
||||
// ReferencePriority = 0xFA,
|
||||
ReferenceBlock = 0xFB,
|
||||
ReferenceBlock = 0xFB,
|
||||
// ReferenceVirtual = 0xFD,
|
||||
// CodecState = 0xA4,
|
||||
// Slices = 0x8E,
|
||||
// TimeSlice = 0xE8,
|
||||
LaceNumber = 0xCC,
|
||||
LaceNumber = 0xCC,
|
||||
// FrameNumber = 0xCD,
|
||||
// BlockAdditionID = 0xCB,
|
||||
// MkvDelay = 0xCE,
|
||||
// Cluster_Duration = 0xCF,
|
||||
SimpleBlock = 0xA3,
|
||||
SimpleBlock = 0xA3,
|
||||
// EncryptedBlock = 0xAF,
|
||||
//Track
|
||||
Tracks = 0x1654AE6B,
|
||||
TrackEntry = 0xAE,
|
||||
TrackNumber = 0xD7,
|
||||
TrackUID = 0x73C5,
|
||||
TrackType = 0x83,
|
||||
FlagEnabled = 0xB9,
|
||||
FlagDefault = 0x88,
|
||||
FlagForced = 0x55AA,
|
||||
FlagLacing = 0x9C,
|
||||
// Track
|
||||
Tracks = 0x1654AE6B,
|
||||
TrackEntry = 0xAE,
|
||||
TrackNumber = 0xD7,
|
||||
TrackUID = 0x73C5,
|
||||
TrackType = 0x83,
|
||||
FlagEnabled = 0xB9,
|
||||
FlagDefault = 0x88,
|
||||
FlagForced = 0x55AA,
|
||||
FlagLacing = 0x9C,
|
||||
// MinCache = 0x6DE7,
|
||||
// MaxCache = 0x6DF8,
|
||||
DefaultDuration = 0x23E383,
|
||||
DefaultDuration = 0x23E383,
|
||||
// TrackTimecodeScale = 0x23314F,
|
||||
// TrackOffset = 0x537F,
|
||||
// MaxBlockAdditionID = 0x55EE,
|
||||
Name = 0x536E,
|
||||
Language = 0x22B59C,
|
||||
CodecID = 0x86,
|
||||
CodecPrivate = 0x63A2,
|
||||
CodecName = 0x258688,
|
||||
Name = 0x536E,
|
||||
Language = 0x22B59C,
|
||||
CodecID = 0x86,
|
||||
CodecPrivate = 0x63A2,
|
||||
CodecName = 0x258688,
|
||||
// AttachmentLink = 0x7446,
|
||||
// CodecSettings = 0x3A9697,
|
||||
// CodecInfoURL = 0x3B4040,
|
||||
@ -117,33 +116,33 @@ enum mkv
|
||||
// TrackTranslateEditionUID = 0x66FC,
|
||||
// TrackTranslateCodec = 0x66BF,
|
||||
// TrackTranslateTrackID = 0x66A5,
|
||||
//video
|
||||
Video = 0xE0,
|
||||
FlagInterlaced = 0x9A,
|
||||
StereoMode = 0x53B8,
|
||||
PixelWidth = 0xB0,
|
||||
PixelHeight = 0xBA,
|
||||
PixelCropBottom = 0x54AA,
|
||||
PixelCropTop = 0x54BB,
|
||||
PixelCropLeft = 0x54CC,
|
||||
PixelCropRight = 0x54DD,
|
||||
DisplayWidth = 0x54B0,
|
||||
DisplayHeight = 0x54BA,
|
||||
DisplayUnit = 0x54B2,
|
||||
AspectRatioType = 0x54B3,
|
||||
// video
|
||||
Video = 0xE0,
|
||||
FlagInterlaced = 0x9A,
|
||||
StereoMode = 0x53B8,
|
||||
PixelWidth = 0xB0,
|
||||
PixelHeight = 0xBA,
|
||||
PixelCropBottom = 0x54AA,
|
||||
PixelCropTop = 0x54BB,
|
||||
PixelCropLeft = 0x54CC,
|
||||
PixelCropRight = 0x54DD,
|
||||
DisplayWidth = 0x54B0,
|
||||
DisplayHeight = 0x54BA,
|
||||
DisplayUnit = 0x54B2,
|
||||
AspectRatioType = 0x54B3,
|
||||
// ColourSpace = 0x2EB524,
|
||||
// GammaValue = 0x2FB523,
|
||||
FrameRate = 0x2383E3,
|
||||
//end video
|
||||
//audio
|
||||
Audio = 0xE1,
|
||||
SamplingFrequency = 0xB5,
|
||||
OutputSamplingFrequency = 0x78B5,
|
||||
Channels = 0x9F,
|
||||
FrameRate = 0x2383E3,
|
||||
// end video
|
||||
// audio
|
||||
Audio = 0xE1,
|
||||
SamplingFrequency = 0xB5,
|
||||
OutputSamplingFrequency = 0x78B5,
|
||||
Channels = 0x9F,
|
||||
// ChannelPositions = 0x7D7B,
|
||||
BitDepth = 0x6264,
|
||||
//end audio
|
||||
//content encoding
|
||||
BitDepth = 0x6264,
|
||||
// end audio
|
||||
// content encoding
|
||||
// ContentEncodings = 0x6d80,
|
||||
// ContentEncoding = 0x6240,
|
||||
// ContentEncodingOrder = 0x5031,
|
||||
@ -159,22 +158,22 @@ enum mkv
|
||||
// ContentSigKeyID = 0x47e4,
|
||||
// ContentSigAlgo = 0x47e5,
|
||||
// ContentSigHashAlgo = 0x47e6,
|
||||
//end content encoding
|
||||
//Cueing Data
|
||||
Cues = 0x1C53BB6B,
|
||||
CuePoint = 0xBB,
|
||||
CueTime = 0xB3,
|
||||
CueTrackPositions = 0xB7,
|
||||
CueTrack = 0xF7,
|
||||
CueClusterPosition = 0xF1,
|
||||
CueBlockNumber = 0x5378,
|
||||
// end content encoding
|
||||
// Cueing Data
|
||||
Cues = 0x1C53BB6B,
|
||||
CuePoint = 0xBB,
|
||||
CueTime = 0xB3,
|
||||
CueTrackPositions = 0xB7,
|
||||
CueTrack = 0xF7,
|
||||
CueClusterPosition = 0xF1,
|
||||
CueBlockNumber = 0x5378,
|
||||
// CueCodecState = 0xEA,
|
||||
// CueReference = 0xDB,
|
||||
// CueRefTime = 0x96,
|
||||
// CueRefCluster = 0x97,
|
||||
// CueRefNumber = 0x535F,
|
||||
// CueRefCodecState = 0xEB,
|
||||
//Attachment
|
||||
// Attachment
|
||||
// Attachments = 0x1941A469,
|
||||
// AttachedFile = 0x61A7,
|
||||
// FileDescription = 0x467E,
|
||||
@ -183,7 +182,7 @@ enum mkv
|
||||
// FileData = 0x465C,
|
||||
// FileUID = 0x46AE,
|
||||
// FileReferral = 0x4675,
|
||||
//Chapters
|
||||
// Chapters
|
||||
// Chapters = 0x1043A770,
|
||||
// EditionEntry = 0x45B9,
|
||||
// EditionUID = 0x45BC,
|
||||
@ -211,7 +210,7 @@ enum mkv
|
||||
// ChapProcessCommand = 0x6911,
|
||||
// ChapProcessTime = 0x6922,
|
||||
// ChapProcessData = 0x6933,
|
||||
//Tagging
|
||||
// Tagging
|
||||
// Tags = 0x1254C367,
|
||||
// Tag = 0x7373,
|
||||
// Targets = 0x63C0,
|
||||
|
@ -18,154 +18,136 @@
|
||||
#define LITERALU64(n) n##LLU
|
||||
#endif
|
||||
|
||||
void Ebml_WriteLen(EbmlGlobal *glob, long long val)
|
||||
{
|
||||
//TODO check and make sure we are not > than 0x0100000000000000LLU
|
||||
unsigned char size = 8; //size in bytes to output
|
||||
unsigned long long minVal = LITERALU64(0x00000000000000ff); //mask to compare for byte size
|
||||
void Ebml_WriteLen(EbmlGlobal *glob, long long val) {
|
||||
// TODO check and make sure we are not > than 0x0100000000000000LLU
|
||||
unsigned char size = 8; // size in bytes to output
|
||||
unsigned long long minVal = LITERALU64(0x00000000000000ff); // mask to compare for byte size
|
||||
|
||||
for (size = 1; size < 8; size ++)
|
||||
{
|
||||
if (val < minVal)
|
||||
break;
|
||||
for (size = 1; size < 8; size ++) {
|
||||
if (val < minVal)
|
||||
break;
|
||||
|
||||
minVal = (minVal << 7);
|
||||
minVal = (minVal << 7);
|
||||
}
|
||||
|
||||
val |= (LITERALU64(0x000000000000080) << ((size - 1) * 7));
|
||||
|
||||
Ebml_Serialize(glob, (void *) &val, sizeof(val), size);
|
||||
}
|
||||
|
||||
void Ebml_WriteString(EbmlGlobal *glob, const char *str) {
|
||||
const size_t size_ = strlen(str);
|
||||
const unsigned long long size = size_;
|
||||
Ebml_WriteLen(glob, size);
|
||||
// TODO: it's not clear from the spec whether the nul terminator
|
||||
// should be serialized too. For now we omit the null terminator.
|
||||
Ebml_Write(glob, str, size);
|
||||
}
|
||||
|
||||
void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr) {
|
||||
const size_t strlen = wcslen(wstr);
|
||||
|
||||
// TODO: it's not clear from the spec whether the nul terminator
|
||||
// should be serialized too. For now we include it.
|
||||
const unsigned long long size = strlen;
|
||||
|
||||
Ebml_WriteLen(glob, size);
|
||||
Ebml_Write(glob, wstr, size);
|
||||
}
|
||||
|
||||
void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id) {
|
||||
int len;
|
||||
|
||||
if (class_id >= 0x01000000)
|
||||
len = 4;
|
||||
else if (class_id >= 0x00010000)
|
||||
len = 3;
|
||||
else if (class_id >= 0x00000100)
|
||||
len = 2;
|
||||
else
|
||||
len = 1;
|
||||
|
||||
Ebml_Serialize(glob, (void *)&class_id, sizeof(class_id), len);
|
||||
}
|
||||
|
||||
void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui) {
|
||||
unsigned char sizeSerialized = 8 | 0x80;
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
|
||||
Ebml_Serialize(glob, &ui, sizeof(ui), 8);
|
||||
}
|
||||
|
||||
void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui) {
|
||||
unsigned char size = 8; // size in bytes to output
|
||||
unsigned char sizeSerialized = 0;
|
||||
unsigned long minVal;
|
||||
|
||||
Ebml_WriteID(glob, class_id);
|
||||
minVal = 0x7fLU; // mask to compare for byte size
|
||||
|
||||
for (size = 1; size < 4; size ++) {
|
||||
if (ui < minVal) {
|
||||
break;
|
||||
}
|
||||
|
||||
val |= (LITERALU64(0x000000000000080) << ((size - 1) * 7));
|
||||
minVal <<= 7;
|
||||
}
|
||||
|
||||
Ebml_Serialize(glob, (void *) &val, sizeof(val), size);
|
||||
sizeSerialized = 0x80 | size;
|
||||
Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
|
||||
Ebml_Serialize(glob, &ui, sizeof(ui), size);
|
||||
}
|
||||
// TODO: perhaps this is a poor name for this id serializer helper function
|
||||
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long bin) {
|
||||
int size;
|
||||
for (size = 4; size > 1; size--) {
|
||||
if (bin & 0x000000ff << ((size - 1) * 8))
|
||||
break;
|
||||
}
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteLen(glob, size);
|
||||
Ebml_WriteID(glob, bin);
|
||||
}
|
||||
|
||||
void Ebml_WriteString(EbmlGlobal *glob, const char *str)
|
||||
{
|
||||
const size_t size_ = strlen(str);
|
||||
const unsigned long long size = size_;
|
||||
Ebml_WriteLen(glob, size);
|
||||
//TODO: it's not clear from the spec whether the nul terminator
|
||||
//should be serialized too. For now we omit the null terminator.
|
||||
Ebml_Write(glob, str, size);
|
||||
void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d) {
|
||||
unsigned char len = 0x88;
|
||||
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_Serialize(glob, &len, sizeof(len), 1);
|
||||
Ebml_Serialize(glob, &d, sizeof(d), 8);
|
||||
}
|
||||
|
||||
void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr)
|
||||
{
|
||||
const size_t strlen = wcslen(wstr);
|
||||
|
||||
//TODO: it's not clear from the spec whether the nul terminator
|
||||
//should be serialized too. For now we include it.
|
||||
const unsigned long long size = strlen;
|
||||
|
||||
Ebml_WriteLen(glob, size);
|
||||
Ebml_Write(glob, wstr, size);
|
||||
void Ebml_WriteSigned16(EbmlGlobal *glob, short val) {
|
||||
signed long out = ((val & 0x003FFFFF) | 0x00200000) << 8;
|
||||
Ebml_Serialize(glob, &out, sizeof(out), 3);
|
||||
}
|
||||
|
||||
void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (class_id >= 0x01000000)
|
||||
len = 4;
|
||||
else if (class_id >= 0x00010000)
|
||||
len = 3;
|
||||
else if (class_id >= 0x00000100)
|
||||
len = 2;
|
||||
else
|
||||
len = 1;
|
||||
|
||||
Ebml_Serialize(glob, (void *)&class_id, sizeof(class_id), len);
|
||||
void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s) {
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteString(glob, s);
|
||||
}
|
||||
|
||||
void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui)
|
||||
{
|
||||
unsigned char sizeSerialized = 8 | 0x80;
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
|
||||
Ebml_Serialize(glob, &ui, sizeof(ui), 8);
|
||||
void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s) {
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteUTF8(glob, s);
|
||||
}
|
||||
|
||||
void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui)
|
||||
{
|
||||
unsigned char size = 8; //size in bytes to output
|
||||
unsigned char sizeSerialized = 0;
|
||||
unsigned long minVal;
|
||||
|
||||
Ebml_WriteID(glob, class_id);
|
||||
minVal = 0x7fLU; //mask to compare for byte size
|
||||
|
||||
for (size = 1; size < 4; size ++)
|
||||
{
|
||||
if (ui < minVal)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
minVal <<= 7;
|
||||
}
|
||||
|
||||
sizeSerialized = 0x80 | size;
|
||||
Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
|
||||
Ebml_Serialize(glob, &ui, sizeof(ui), size);
|
||||
}
|
||||
//TODO: perhaps this is a poor name for this id serializer helper function
|
||||
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long bin)
|
||||
{
|
||||
int size;
|
||||
for (size=4; size > 1; size--)
|
||||
{
|
||||
if (bin & 0x000000ff << ((size-1) * 8))
|
||||
break;
|
||||
}
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteLen(glob, size);
|
||||
Ebml_WriteID(glob, bin);
|
||||
void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length) {
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteLen(glob, data_length);
|
||||
Ebml_Write(glob, data, data_length);
|
||||
}
|
||||
|
||||
void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d)
|
||||
{
|
||||
unsigned char len = 0x88;
|
||||
void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize) {
|
||||
unsigned char tmp = 0;
|
||||
unsigned long i = 0;
|
||||
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_Serialize(glob, &len, sizeof(len), 1);
|
||||
Ebml_Serialize(glob, &d, sizeof(d), 8);
|
||||
Ebml_WriteID(glob, 0xEC);
|
||||
Ebml_WriteLen(glob, vSize);
|
||||
|
||||
for (i = 0; i < vSize; i++) {
|
||||
Ebml_Write(glob, &tmp, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Ebml_WriteSigned16(EbmlGlobal *glob, short val)
|
||||
{
|
||||
signed long out = ((val & 0x003FFFFF) | 0x00200000) << 8;
|
||||
Ebml_Serialize(glob, &out, sizeof(out), 3);
|
||||
}
|
||||
|
||||
void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s)
|
||||
{
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteString(glob, s);
|
||||
}
|
||||
|
||||
void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s)
|
||||
{
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteUTF8(glob, s);
|
||||
}
|
||||
|
||||
void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length)
|
||||
{
|
||||
Ebml_WriteID(glob, class_id);
|
||||
Ebml_WriteLen(glob, data_length);
|
||||
Ebml_Write(glob, data, data_length);
|
||||
}
|
||||
|
||||
void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize)
|
||||
{
|
||||
unsigned char tmp = 0;
|
||||
unsigned long i = 0;
|
||||
|
||||
Ebml_WriteID(glob, 0xEC);
|
||||
Ebml_WriteLen(glob, vSize);
|
||||
|
||||
for (i = 0; i < vSize; i++)
|
||||
{
|
||||
Ebml_Write(glob, &tmp, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Serialize Date
|
||||
// TODO Serialize Date
|
||||
|
@ -9,8 +9,8 @@
|
||||
// in the file PATENTS. All contributing project authors may
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
//note: you must define write and serialize functions as well as your own EBML_GLOBAL
|
||||
//These functions MUST be implemented
|
||||
// note: you must define write and serialize functions as well as your own EBML_GLOBAL
|
||||
// These functions MUST be implemented
|
||||
#include <stddef.h>
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
@ -28,11 +28,11 @@ void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t
|
||||
void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
|
||||
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
|
||||
void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d);
|
||||
//TODO make this more generic to signed
|
||||
// TODO make this more generic to signed
|
||||
void Ebml_WriteSigned16(EbmlGlobal *glob, short val);
|
||||
void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s);
|
||||
void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s);
|
||||
void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length);
|
||||
void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize);
|
||||
//TODO need date function
|
||||
// TODO need date function
|
||||
#endif
|
||||
|
@ -14,106 +14,100 @@
|
||||
|
||||
#define kVorbisPrivateMaxSize 4000
|
||||
|
||||
void writeHeader(EbmlGlobal *glob)
|
||||
{
|
||||
EbmlLoc start;
|
||||
Ebml_StartSubElement(glob, &start, EBML);
|
||||
Ebml_SerializeUnsigned(glob, EBMLVersion, 1);
|
||||
Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1); //EBML Read Version
|
||||
Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4); //EBML Max ID Length
|
||||
Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8); //EBML Max Size Length
|
||||
Ebml_SerializeString(glob, DocType, "webm"); //Doc Type
|
||||
Ebml_SerializeUnsigned(glob, DocTypeVersion, 2); //Doc Type Version
|
||||
Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2); //Doc Type Read Version
|
||||
Ebml_EndSubElement(glob, &start);
|
||||
void writeHeader(EbmlGlobal *glob) {
|
||||
EbmlLoc start;
|
||||
Ebml_StartSubElement(glob, &start, EBML);
|
||||
Ebml_SerializeUnsigned(glob, EBMLVersion, 1);
|
||||
Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1); // EBML Read Version
|
||||
Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4); // EBML Max ID Length
|
||||
Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8); // EBML Max Size Length
|
||||
Ebml_SerializeString(glob, DocType, "webm"); // Doc Type
|
||||
Ebml_SerializeUnsigned(glob, DocTypeVersion, 2); // Doc Type Version
|
||||
Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2); // Doc Type Read Version
|
||||
Ebml_EndSubElement(glob, &start);
|
||||
}
|
||||
|
||||
void writeSimpleBlock(EbmlGlobal *glob, unsigned char trackNumber, short timeCode,
|
||||
int isKeyframe, unsigned char lacingFlag, int discardable,
|
||||
unsigned char *data, unsigned long dataLength)
|
||||
{
|
||||
Ebml_WriteID(glob, SimpleBlock);
|
||||
unsigned long blockLength = 4 + dataLength;
|
||||
blockLength |= 0x10000000; //TODO check length < 0x0FFFFFFFF
|
||||
Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4);
|
||||
trackNumber |= 0x80; //TODO check track nubmer < 128
|
||||
Ebml_Write(glob, &trackNumber, 1);
|
||||
//Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes
|
||||
Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2);
|
||||
unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable;
|
||||
Ebml_Write(glob, &flags, 1);
|
||||
Ebml_Write(glob, data, dataLength);
|
||||
unsigned char *data, unsigned long dataLength) {
|
||||
Ebml_WriteID(glob, SimpleBlock);
|
||||
unsigned long blockLength = 4 + dataLength;
|
||||
blockLength |= 0x10000000; // TODO check length < 0x0FFFFFFFF
|
||||
Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4);
|
||||
trackNumber |= 0x80; // TODO check track nubmer < 128
|
||||
Ebml_Write(glob, &trackNumber, 1);
|
||||
// Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes
|
||||
Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2);
|
||||
unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable;
|
||||
Ebml_Write(glob, &flags, 1);
|
||||
Ebml_Write(glob, data, dataLength);
|
||||
}
|
||||
|
||||
static UInt64 generateTrackID(unsigned int trackNumber)
|
||||
{
|
||||
UInt64 t = time(NULL) * trackNumber;
|
||||
UInt64 r = rand();
|
||||
r = r << 32;
|
||||
r += rand();
|
||||
UInt64 rval = t ^ r;
|
||||
return rval;
|
||||
static UInt64 generateTrackID(unsigned int trackNumber) {
|
||||
UInt64 t = time(NULL) * trackNumber;
|
||||
UInt64 r = rand();
|
||||
r = r << 32;
|
||||
r += rand();
|
||||
UInt64 rval = t ^ r;
|
||||
return rval;
|
||||
}
|
||||
|
||||
void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing,
|
||||
char *codecId, unsigned int pixelWidth, unsigned int pixelHeight,
|
||||
double frameRate)
|
||||
{
|
||||
EbmlLoc start;
|
||||
Ebml_StartSubElement(glob, &start, TrackEntry);
|
||||
Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
|
||||
UInt64 trackID = generateTrackID(trackNumber);
|
||||
Ebml_SerializeUnsigned(glob, TrackUID, trackID);
|
||||
Ebml_SerializeString(glob, CodecName, "VP8"); //TODO shouldn't be fixed
|
||||
double frameRate) {
|
||||
EbmlLoc start;
|
||||
Ebml_StartSubElement(glob, &start, TrackEntry);
|
||||
Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
|
||||
UInt64 trackID = generateTrackID(trackNumber);
|
||||
Ebml_SerializeUnsigned(glob, TrackUID, trackID);
|
||||
Ebml_SerializeString(glob, CodecName, "VP8"); // TODO shouldn't be fixed
|
||||
|
||||
Ebml_SerializeUnsigned(glob, TrackType, 1); //video is always 1
|
||||
Ebml_SerializeString(glob, CodecID, codecId);
|
||||
{
|
||||
EbmlLoc videoStart;
|
||||
Ebml_StartSubElement(glob, &videoStart, Video);
|
||||
Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth);
|
||||
Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight);
|
||||
Ebml_SerializeFloat(glob, FrameRate, frameRate);
|
||||
Ebml_EndSubElement(glob, &videoStart); //Video
|
||||
}
|
||||
Ebml_EndSubElement(glob, &start); //Track Entry
|
||||
Ebml_SerializeUnsigned(glob, TrackType, 1); // video is always 1
|
||||
Ebml_SerializeString(glob, CodecID, codecId);
|
||||
{
|
||||
EbmlLoc videoStart;
|
||||
Ebml_StartSubElement(glob, &videoStart, Video);
|
||||
Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth);
|
||||
Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight);
|
||||
Ebml_SerializeFloat(glob, FrameRate, frameRate);
|
||||
Ebml_EndSubElement(glob, &videoStart); // Video
|
||||
}
|
||||
Ebml_EndSubElement(glob, &start); // Track Entry
|
||||
}
|
||||
void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing,
|
||||
char *codecId, double samplingFrequency, unsigned int channels,
|
||||
unsigned char *private, unsigned long privateSize)
|
||||
{
|
||||
EbmlLoc start;
|
||||
Ebml_StartSubElement(glob, &start, TrackEntry);
|
||||
Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
|
||||
UInt64 trackID = generateTrackID(trackNumber);
|
||||
Ebml_SerializeUnsigned(glob, TrackUID, trackID);
|
||||
Ebml_SerializeUnsigned(glob, TrackType, 2); //audio is always 2
|
||||
//I am using defaults for thesed required fields
|
||||
/* Ebml_SerializeUnsigned(glob, FlagEnabled, 1);
|
||||
Ebml_SerializeUnsigned(glob, FlagDefault, 1);
|
||||
Ebml_SerializeUnsigned(glob, FlagForced, 1);
|
||||
Ebml_SerializeUnsigned(glob, FlagLacing, flagLacing);*/
|
||||
Ebml_SerializeString(glob, CodecID, codecId);
|
||||
Ebml_SerializeData(glob, CodecPrivate, private, privateSize);
|
||||
unsigned char *private, unsigned long privateSize) {
|
||||
EbmlLoc start;
|
||||
Ebml_StartSubElement(glob, &start, TrackEntry);
|
||||
Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
|
||||
UInt64 trackID = generateTrackID(trackNumber);
|
||||
Ebml_SerializeUnsigned(glob, TrackUID, trackID);
|
||||
Ebml_SerializeUnsigned(glob, TrackType, 2); // audio is always 2
|
||||
// I am using defaults for thesed required fields
|
||||
/* Ebml_SerializeUnsigned(glob, FlagEnabled, 1);
|
||||
Ebml_SerializeUnsigned(glob, FlagDefault, 1);
|
||||
Ebml_SerializeUnsigned(glob, FlagForced, 1);
|
||||
Ebml_SerializeUnsigned(glob, FlagLacing, flagLacing);*/
|
||||
Ebml_SerializeString(glob, CodecID, codecId);
|
||||
Ebml_SerializeData(glob, CodecPrivate, private, privateSize);
|
||||
|
||||
Ebml_SerializeString(glob, CodecName, "VORBIS"); //fixed for now
|
||||
{
|
||||
EbmlLoc AudioStart;
|
||||
Ebml_StartSubElement(glob, &AudioStart, Audio);
|
||||
Ebml_SerializeFloat(glob, SamplingFrequency, samplingFrequency);
|
||||
Ebml_SerializeUnsigned(glob, Channels, channels);
|
||||
Ebml_EndSubElement(glob, &AudioStart);
|
||||
}
|
||||
Ebml_EndSubElement(glob, &start);
|
||||
Ebml_SerializeString(glob, CodecName, "VORBIS"); // fixed for now
|
||||
{
|
||||
EbmlLoc AudioStart;
|
||||
Ebml_StartSubElement(glob, &AudioStart, Audio);
|
||||
Ebml_SerializeFloat(glob, SamplingFrequency, samplingFrequency);
|
||||
Ebml_SerializeUnsigned(glob, Channels, channels);
|
||||
Ebml_EndSubElement(glob, &AudioStart);
|
||||
}
|
||||
Ebml_EndSubElement(glob, &start);
|
||||
}
|
||||
void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc* startInfo, unsigned long timeCodeScale, double duration)
|
||||
{
|
||||
Ebml_StartSubElement(ebml, startInfo, Info);
|
||||
Ebml_SerializeUnsigned(ebml, TimecodeScale, timeCodeScale);
|
||||
Ebml_SerializeFloat(ebml, Segment_Duration, duration * 1000.0); //Currently fixed to using milliseconds
|
||||
Ebml_SerializeString(ebml, 0x4D80, "QTmuxingAppLibWebM-0.0.1");
|
||||
Ebml_SerializeString(ebml, 0x5741, "QTwritingAppLibWebM-0.0.1");
|
||||
Ebml_EndSubElement(ebml, startInfo);
|
||||
void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long timeCodeScale, double duration) {
|
||||
Ebml_StartSubElement(ebml, startInfo, Info);
|
||||
Ebml_SerializeUnsigned(ebml, TimecodeScale, timeCodeScale);
|
||||
Ebml_SerializeFloat(ebml, Segment_Duration, duration * 1000.0); // Currently fixed to using milliseconds
|
||||
Ebml_SerializeString(ebml, 0x4D80, "QTmuxingAppLibWebM-0.0.1");
|
||||
Ebml_SerializeString(ebml, 0x5741, "QTwritingAppLibWebM-0.0.1");
|
||||
Ebml_EndSubElement(ebml, startInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -142,7 +136,7 @@ void Mkv_WriteSegmentInformation(Ebml& ebml_out, SegmentInformationStruct& segme
|
||||
Ebml_SerializeString(ebml_out, 0x7384, segmentInformation.filename);
|
||||
Ebml_SerializeUnsigned(ebml_out, 0x2AD7B1, segmentInformation.TimecodeScale);
|
||||
Ebml_SerializeUnsigned(ebml_out, 0x4489, segmentInformation.Duration);
|
||||
//TODO date
|
||||
// TODO date
|
||||
Ebml_SerializeWString(ebml_out, 0x4D80, L"MKVMUX");
|
||||
Ebml_SerializeWString(ebml_out, 0x5741, segmentInformation.WritingApp);
|
||||
}
|
||||
@ -173,9 +167,9 @@ static void Mkv_WriteGenericTrackData(Ebml& ebml_out, TrackStruct& track)
|
||||
void Mkv_WriteVideoTrack(Ebml& ebml_out, TrackStruct & track, VideoTrackStruct& video)
|
||||
{
|
||||
EbmlLoc trackHeadLoc, videoHeadLoc;
|
||||
Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); //start Track
|
||||
Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); // start Track
|
||||
Mkv_WriteGenericTrackData(ebml_out, track);
|
||||
Ebml_StartSubElement(ebml_out, videoHeadLoc, 0xE0); //start Video
|
||||
Ebml_StartSubElement(ebml_out, videoHeadLoc, 0xE0); // start Video
|
||||
Ebml_SerializeUnsigned(ebml_out, 0x9A, video.FlagInterlaced ? 1 :0);
|
||||
Ebml_SerializeUnsigned(ebml_out, 0xB0, video.PixelWidth);
|
||||
Ebml_SerializeUnsigned(ebml_out, 0xBA, video.PixelHeight);
|
||||
@ -193,7 +187,7 @@ void Mkv_WriteAudioTrack(Ebml& ebml_out, TrackStruct & track, AudioTrackStruct&
|
||||
EbmlLoc trackHeadLoc, audioHeadLoc;
|
||||
Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE);
|
||||
Mkv_WriteGenericTrackData(ebml_out, track);
|
||||
Ebml_StartSubElement(ebml_out, audioHeadLoc, 0xE0); //start Audio
|
||||
Ebml_StartSubElement(ebml_out, audioHeadLoc, 0xE0); // start Audio
|
||||
Ebml_SerializeFloat(ebml_out, 0xB5, video.SamplingFrequency);
|
||||
Ebml_SerializeUnsigned(ebml_out, 0x9F, video.Channels);
|
||||
Ebml_SerializeUnsigned(ebml_out, 0x6264, video.BitDepth);
|
||||
@ -213,7 +207,7 @@ void Mkv_WriteSimpleBlockHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, SimpleBlockStru
|
||||
Ebml_Write1UInt(ebml_out, block.TrackNumber);
|
||||
Ebml_WriteSigned16(ebml_out,block.TimeCode);
|
||||
unsigned char flags = 0x00 | (block.iskey ? 0x80:0x00) | (block.lacing << 1) | block.discardable;
|
||||
Ebml_Write1UInt(ebml_out, flags); //TODO this may be the wrong function
|
||||
Ebml_Write1UInt(ebml_out, flags); // TODO this may be the wrong function
|
||||
Ebml_Serialize(ebml_out, block.data, block.dataLength);
|
||||
Ebml_EndSubElement(ebml_out,ebmlLoc);
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ void writeSimpleBock(EbmlGlobal *ebml, unsigned char trackNumber, unsigned short
|
||||
|
||||
// these are helper functions
|
||||
void writeHeader(EbmlGlobal *ebml);
|
||||
void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc* startInfo , unsigned long timeCodeScale, double duration);
|
||||
//this function is a helper only, it assumes a lot of defaults
|
||||
void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long timeCodeScale, double duration);
|
||||
// this function is a helper only, it assumes a lot of defaults
|
||||
void writeVideoTrack(EbmlGlobal *ebml, unsigned int trackNumber, int flagLacing,
|
||||
char *codecId, unsigned int pixelWidth, unsigned int pixelHeight,
|
||||
double frameRate);
|
||||
|
@ -13,51 +13,50 @@
|
||||
#include "WebMElement.h"
|
||||
|
||||
#include <stdio.h>
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//init the datatype we're using for ebml output
|
||||
unsigned char data[8192];
|
||||
EbmlGlobal ebml;
|
||||
ebml.buf = data;
|
||||
ebml.offset = 0;
|
||||
ebml.length = 8192;
|
||||
int main(int argc, char *argv[]) {
|
||||
// init the datatype we're using for ebml output
|
||||
unsigned char data[8192];
|
||||
EbmlGlobal ebml;
|
||||
ebml.buf = data;
|
||||
ebml.offset = 0;
|
||||
ebml.length = 8192;
|
||||
|
||||
writeHeader(&ebml);
|
||||
writeHeader(&ebml);
|
||||
{
|
||||
EbmlLoc startSegment;
|
||||
Ebml_StartSubElement(&ebml, &startSegment, Segment); // segment
|
||||
{
|
||||
EbmlLoc startSegment;
|
||||
Ebml_StartSubElement(&ebml, &startSegment, Segment); //segment
|
||||
{
|
||||
//segment info
|
||||
EbmlLoc startInfo;
|
||||
Ebml_StartSubElement(&ebml, &startInfo, Info);
|
||||
Ebml_SerializeString(&ebml, 0x4D80, "muxingAppLibMkv");
|
||||
Ebml_SerializeString(&ebml, 0x5741, "writingAppLibMkv");
|
||||
Ebml_EndSubElement(&ebml, &startInfo);
|
||||
}
|
||||
|
||||
{
|
||||
EbmlLoc trackStart;
|
||||
Ebml_StartSubElement(&ebml, &trackStart, Tracks);
|
||||
writeVideoTrack(&ebml, 1, 1, "V_MS/VFW/FOURCC", 320, 240, 29.97);
|
||||
//writeAudioTrack(&ebml,2,1, "A_VORBIS", 32000, 1, NULL, 0);
|
||||
Ebml_EndSubElement(&ebml, &trackStart);
|
||||
}
|
||||
|
||||
{
|
||||
EbmlLoc clusterStart;
|
||||
Ebml_StartSubElement(&ebml, &clusterStart, Cluster); //cluster
|
||||
Ebml_SerializeUnsigned(&ebml, Timecode, 0);
|
||||
|
||||
unsigned char someData[4] = {1, 2, 3, 4};
|
||||
writeSimpleBlock(&ebml, 1, 0, 1, 0, 0, someData, 4);
|
||||
Ebml_EndSubElement(&ebml, &clusterStart);
|
||||
} //end cluster
|
||||
Ebml_EndSubElement(&ebml, &startSegment);
|
||||
// segment info
|
||||
EbmlLoc startInfo;
|
||||
Ebml_StartSubElement(&ebml, &startInfo, Info);
|
||||
Ebml_SerializeString(&ebml, 0x4D80, "muxingAppLibMkv");
|
||||
Ebml_SerializeString(&ebml, 0x5741, "writingAppLibMkv");
|
||||
Ebml_EndSubElement(&ebml, &startInfo);
|
||||
}
|
||||
|
||||
//dump ebml stuff to the file
|
||||
FILE *file_out = fopen("test.mkv", "wb");
|
||||
size_t bytesWritten = fwrite(data, 1, ebml.offset, file_out);
|
||||
fclose(file_out);
|
||||
return 0;
|
||||
{
|
||||
EbmlLoc trackStart;
|
||||
Ebml_StartSubElement(&ebml, &trackStart, Tracks);
|
||||
writeVideoTrack(&ebml, 1, 1, "V_MS/VFW/FOURCC", 320, 240, 29.97);
|
||||
// writeAudioTrack(&ebml,2,1, "A_VORBIS", 32000, 1, NULL, 0);
|
||||
Ebml_EndSubElement(&ebml, &trackStart);
|
||||
}
|
||||
|
||||
{
|
||||
EbmlLoc clusterStart;
|
||||
Ebml_StartSubElement(&ebml, &clusterStart, Cluster); // cluster
|
||||
Ebml_SerializeUnsigned(&ebml, Timecode, 0);
|
||||
|
||||
unsigned char someData[4] = {1, 2, 3, 4};
|
||||
writeSimpleBlock(&ebml, 1, 0, 1, 0, 0, someData, 4);
|
||||
Ebml_EndSubElement(&ebml, &clusterStart);
|
||||
} // end cluster
|
||||
Ebml_EndSubElement(&ebml, &startSegment);
|
||||
}
|
||||
|
||||
// dump ebml stuff to the file
|
||||
FILE *file_out = fopen("test.mkv", "wb");
|
||||
size_t bytesWritten = fwrite(data, 1, ebml.offset, file_out);
|
||||
fclose(file_out);
|
||||
return 0;
|
||||
}
|
298
md5_utils.c
298
md5_utils.c
@ -25,25 +25,22 @@
|
||||
#include "md5_utils.h"
|
||||
|
||||
void
|
||||
byteSwap(UWORD32 *buf, unsigned words)
|
||||
{
|
||||
md5byte *p;
|
||||
byteSwap(UWORD32 *buf, unsigned words) {
|
||||
md5byte *p;
|
||||
|
||||
/* Only swap bytes for big endian machines */
|
||||
int i = 1;
|
||||
/* Only swap bytes for big endian machines */
|
||||
int i = 1;
|
||||
|
||||
if (*(char *)&i == 1)
|
||||
return;
|
||||
if (*(char *)&i == 1)
|
||||
return;
|
||||
|
||||
p = (md5byte *)buf;
|
||||
p = (md5byte *)buf;
|
||||
|
||||
do
|
||||
{
|
||||
*buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
|
||||
((unsigned)p[1] << 8 | p[0]);
|
||||
p += 4;
|
||||
}
|
||||
while (--words);
|
||||
do {
|
||||
*buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
|
||||
((unsigned)p[1] << 8 | p[0]);
|
||||
p += 4;
|
||||
} while (--words);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -51,15 +48,14 @@ byteSwap(UWORD32 *buf, unsigned words)
|
||||
* initialization constants.
|
||||
*/
|
||||
void
|
||||
MD5Init(struct MD5Context *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
MD5Init(struct MD5Context *ctx) {
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bytes[0] = 0;
|
||||
ctx->bytes[1] = 0;
|
||||
ctx->bytes[0] = 0;
|
||||
ctx->bytes[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -67,44 +63,41 @@ MD5Init(struct MD5Context *ctx)
|
||||
* of bytes.
|
||||
*/
|
||||
void
|
||||
MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
{
|
||||
UWORD32 t;
|
||||
MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) {
|
||||
UWORD32 t;
|
||||
|
||||
/* Update byte count */
|
||||
/* Update byte count */
|
||||
|
||||
t = ctx->bytes[0];
|
||||
t = ctx->bytes[0];
|
||||
|
||||
if ((ctx->bytes[0] = t + len) < t)
|
||||
ctx->bytes[1]++; /* Carry from low to high */
|
||||
if ((ctx->bytes[0] = t + len) < t)
|
||||
ctx->bytes[1]++; /* Carry from low to high */
|
||||
|
||||
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
|
||||
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
|
||||
|
||||
if (t > len)
|
||||
{
|
||||
memcpy((md5byte *)ctx->in + 64 - t, buf, len);
|
||||
return;
|
||||
}
|
||||
if (t > len) {
|
||||
memcpy((md5byte *)ctx->in + 64 - t, buf, len);
|
||||
return;
|
||||
}
|
||||
|
||||
/* First chunk is an odd size */
|
||||
memcpy((md5byte *)ctx->in + 64 - t, buf, t);
|
||||
/* First chunk is an odd size */
|
||||
memcpy((md5byte *)ctx->in + 64 - t, buf, t);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
|
||||
/* Process data in 64-byte chunks */
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Process data in 64-byte chunks */
|
||||
while (len >= 64)
|
||||
{
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
memcpy(ctx->in, buf, len);
|
||||
/* Handle any remaining bytes of data. */
|
||||
memcpy(ctx->in, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -112,37 +105,35 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void
|
||||
MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
||||
{
|
||||
int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
|
||||
md5byte *p = (md5byte *)ctx->in + count;
|
||||
MD5Final(md5byte digest[16], struct MD5Context *ctx) {
|
||||
int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
|
||||
md5byte *p = (md5byte *)ctx->in + count;
|
||||
|
||||
/* Set the first char of padding to 0x80. There is always room. */
|
||||
*p++ = 0x80;
|
||||
/* Set the first char of padding to 0x80. There is always room. */
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 56 bytes (-8..55) */
|
||||
count = 56 - 1 - count;
|
||||
/* Bytes of padding needed to make 56 bytes (-8..55) */
|
||||
count = 56 - 1 - count;
|
||||
|
||||
if (count < 0) /* Padding forces an extra block */
|
||||
{
|
||||
memset(p, 0, count + 8);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
p = (md5byte *)ctx->in;
|
||||
count = 56;
|
||||
}
|
||||
|
||||
memset(p, 0, count);
|
||||
byteSwap(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
ctx->in[14] = ctx->bytes[0] << 3;
|
||||
ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
|
||||
if (count < 0) { /* Padding forces an extra block */
|
||||
memset(p, 0, count + 8);
|
||||
byteSwap(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
p = (md5byte *)ctx->in;
|
||||
count = 56;
|
||||
}
|
||||
|
||||
byteSwap(ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
|
||||
memset(p, 0, count);
|
||||
byteSwap(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
ctx->in[14] = ctx->bytes[0] << 3;
|
||||
ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
|
||||
MD5Transform(ctx->buf, ctx->in);
|
||||
|
||||
byteSwap(ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
#ifndef ASM_MD5
|
||||
@ -157,7 +148,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f,w,x,y,z,in,s) \
|
||||
(w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
|
||||
(w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
@ -165,87 +156,86 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void
|
||||
MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
|
||||
{
|
||||
register UWORD32 a, b, c, d;
|
||||
MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) {
|
||||
register UWORD32 a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -27,11 +27,10 @@
|
||||
#define UWORD32 unsigned int
|
||||
|
||||
typedef struct MD5Context MD5Context;
|
||||
struct MD5Context
|
||||
{
|
||||
UWORD32 buf[4];
|
||||
UWORD32 bytes[2];
|
||||
UWORD32 in[16];
|
||||
struct MD5Context {
|
||||
UWORD32 buf[4];
|
||||
UWORD32 bytes[2];
|
||||
UWORD32 in[16];
|
||||
};
|
||||
|
||||
void MD5Init(struct MD5Context *context);
|
||||
|
@ -19,17 +19,29 @@ namespace libvpx_test {
|
||||
|
||||
class ACMRandom {
|
||||
public:
|
||||
explicit ACMRandom(int seed) { Reset(seed); }
|
||||
explicit ACMRandom(int seed) {
|
||||
Reset(seed);
|
||||
}
|
||||
|
||||
void Reset(int seed) { srand(seed); }
|
||||
void Reset(int seed) {
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
uint8_t Rand8(void) { return (rand() >> 8) & 0xff; }
|
||||
uint8_t Rand8(void) {
|
||||
return (rand() >> 8) & 0xff;
|
||||
}
|
||||
|
||||
int PseudoUniform(int range) { return (rand() >> 8) % range; }
|
||||
int PseudoUniform(int range) {
|
||||
return (rand() >> 8) % range;
|
||||
}
|
||||
|
||||
int operator()(int n) { return PseudoUniform(n); }
|
||||
int operator()(int n) {
|
||||
return PseudoUniform(n);
|
||||
}
|
||||
|
||||
static int DeterministicSeed(void) { return 0xbaba; }
|
||||
static int DeterministicSeed(void) {
|
||||
return 0xbaba;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -38,15 +38,15 @@ TEST(VP8, TestBitIO) {
|
||||
for (int i = 0; i < bits_to_test; ++i) {
|
||||
const int parity = i & 1;
|
||||
probas[i] =
|
||||
(method == 0) ? 0 : (method == 1) ? 255 :
|
||||
(method == 2) ? 128 :
|
||||
(method == 3) ? rnd.Rand8() :
|
||||
(method == 4) ? (parity ? 0 : 255) :
|
||||
(method == 0) ? 0 : (method == 1) ? 255 :
|
||||
(method == 2) ? 128 :
|
||||
(method == 3) ? rnd.Rand8() :
|
||||
(method == 4) ? (parity ? 0 : 255) :
|
||||
// alternate between low and high proba:
|
||||
(method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
|
||||
(method == 6) ?
|
||||
(parity ? rnd(64) : 255 - rnd(64)) :
|
||||
(parity ? rnd(32) : 255 - rnd(32));
|
||||
(parity ? rnd(64) : 255 - rnd(64)) :
|
||||
(parity ? rnd(32) : 255 - rnd(32));
|
||||
}
|
||||
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
|
||||
const int random_seed = 6432;
|
||||
@ -78,7 +78,7 @@ TEST(VP8, TestBitIO) {
|
||||
bit = bit_rnd(2);
|
||||
}
|
||||
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
|
||||
<< "pos: "<< i << " / " << bits_to_test
|
||||
<< "pos: " << i << " / " << bits_to_test
|
||||
<< " bit_method: " << bit_method
|
||||
<< " method: " << method;
|
||||
}
|
||||
|
@ -16,8 +16,7 @@ extern "C" {
|
||||
#endif
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
static void append_gtest_filter(const char *str)
|
||||
{
|
||||
static void append_gtest_filter(const char *str) {
|
||||
std::string filter = ::testing::FLAGS_gtest_filter;
|
||||
filter += str;
|
||||
::testing::FLAGS_gtest_filter = filter;
|
||||
@ -28,17 +27,17 @@ int main(int argc, char **argv) {
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
int simd_caps = x86_simd_caps();
|
||||
if(!(simd_caps & HAS_MMX))
|
||||
if (!(simd_caps & HAS_MMX))
|
||||
append_gtest_filter(":-MMX/*");
|
||||
if(!(simd_caps & HAS_SSE))
|
||||
if (!(simd_caps & HAS_SSE))
|
||||
append_gtest_filter(":-SSE/*");
|
||||
if(!(simd_caps & HAS_SSE2))
|
||||
if (!(simd_caps & HAS_SSE2))
|
||||
append_gtest_filter(":-SSE2/*");
|
||||
if(!(simd_caps & HAS_SSE3))
|
||||
if (!(simd_caps & HAS_SSE3))
|
||||
append_gtest_filter(":-SSE3/*");
|
||||
if(!(simd_caps & HAS_SSSE3))
|
||||
if (!(simd_caps & HAS_SSSE3))
|
||||
append_gtest_filter(":-SSSE3/*");
|
||||
if(!(simd_caps & HAS_SSE4_1))
|
||||
if (!(simd_caps & HAS_SSE4_1))
|
||||
append_gtest_filter(":-SSE4_1/*");
|
||||
#endif
|
||||
|
||||
|
@ -14,11 +14,10 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
FILE* set_binary_mode(FILE *stream)
|
||||
{
|
||||
(void)stream;
|
||||
FILE *set_binary_mode(FILE *stream) {
|
||||
(void)stream;
|
||||
#ifdef _WIN32
|
||||
_setmode(_fileno(stream), _O_BINARY);
|
||||
_setmode(_fileno(stream), _O_BINARY);
|
||||
#endif
|
||||
return stream;
|
||||
return stream;
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
#define TOOLS_COMMON_H
|
||||
|
||||
/* Sets a stdio stream into binary mode */
|
||||
FILE* set_binary_mode(FILE *stream);
|
||||
FILE *set_binary_mode(FILE *stream);
|
||||
|
||||
#endif
|
||||
|
@ -21,224 +21,204 @@
|
||||
|
||||
extern void vp8_init_scan_order_mask();
|
||||
|
||||
static void update_mode_info_border( VP8_COMMON *cpi, MODE_INFO *mi_base )
|
||||
{
|
||||
int stride = cpi->mode_info_stride;
|
||||
int i;
|
||||
static void update_mode_info_border(VP8_COMMON *cpi, MODE_INFO *mi_base) {
|
||||
int stride = cpi->mode_info_stride;
|
||||
int i;
|
||||
|
||||
// Clear down top border row
|
||||
vpx_memset(mi_base, 0, sizeof(MODE_INFO) * cpi->mode_info_stride);
|
||||
// Clear down top border row
|
||||
vpx_memset(mi_base, 0, sizeof(MODE_INFO) * cpi->mode_info_stride);
|
||||
|
||||
// Clear left border column
|
||||
for (i = 1; i < cpi->mb_rows+1; i++)
|
||||
{
|
||||
vpx_memset(&mi_base[i*stride], 0, sizeof(MODE_INFO));
|
||||
// Clear left border column
|
||||
for (i = 1; i < cpi->mb_rows + 1; i++) {
|
||||
vpx_memset(&mi_base[i * stride], 0, sizeof(MODE_INFO));
|
||||
}
|
||||
}
|
||||
static void update_mode_info_in_image(VP8_COMMON *cpi, MODE_INFO *mi) {
|
||||
int i, j;
|
||||
|
||||
// For each in image mode_info element set the in image flag to 1
|
||||
for (i = 0; i < cpi->mb_rows; i++) {
|
||||
for (j = 0; j < cpi->mb_cols; j++) {
|
||||
mi->mbmi.mb_in_image = 1;
|
||||
mi++; // Next element in the row
|
||||
}
|
||||
|
||||
mi++; // Step over border element at start of next row
|
||||
}
|
||||
}
|
||||
static void update_mode_info_in_image( VP8_COMMON *cpi, MODE_INFO *mi )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
// For each in image mode_info element set the in image flag to 1
|
||||
for (i = 0; i < cpi->mb_rows; i++)
|
||||
{
|
||||
for (j = 0; j < cpi->mb_cols; j++)
|
||||
{
|
||||
mi->mbmi.mb_in_image = 1;
|
||||
mi++; // Next element in the row
|
||||
}
|
||||
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) {
|
||||
int i;
|
||||
|
||||
mi++; // Step over border element at start of next row
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
|
||||
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
|
||||
|
||||
vpx_free(oci->above_context);
|
||||
vpx_free(oci->mip);
|
||||
vpx_free(oci->prev_mip);
|
||||
|
||||
oci->above_context = 0;
|
||||
oci->mip = 0;
|
||||
oci->prev_mip = 0;
|
||||
|
||||
}
|
||||
|
||||
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) {
|
||||
int i;
|
||||
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
|
||||
/* our internal buffers are always multiples of 16 */
|
||||
if ((width & 0xf) != 0)
|
||||
width += 16 - (width & 0xf);
|
||||
|
||||
if ((height & 0xf) != 0)
|
||||
height += 16 - (height & 0xf);
|
||||
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++) {
|
||||
oci->fb_idx_ref_cnt[i] = 0;
|
||||
oci->yv12_fb[i].flags = 0;
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
|
||||
{
|
||||
int i;
|
||||
oci->new_fb_idx = 0;
|
||||
oci->lst_fb_idx = 1;
|
||||
oci->gld_fb_idx = 2;
|
||||
oci->alt_fb_idx = 3;
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
|
||||
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
|
||||
|
||||
vpx_free(oci->above_context);
|
||||
vpx_free(oci->mip);
|
||||
vpx_free(oci->prev_mip);
|
||||
|
||||
oci->above_context = 0;
|
||||
oci->mip = 0;
|
||||
oci->prev_mip = 0;
|
||||
|
||||
}
|
||||
|
||||
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
|
||||
{
|
||||
int i;
|
||||
oci->fb_idx_ref_cnt[0] = 1;
|
||||
oci->fb_idx_ref_cnt[1] = 1;
|
||||
oci->fb_idx_ref_cnt[2] = 1;
|
||||
oci->fb_idx_ref_cnt[3] = 1;
|
||||
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* our internal buffers are always multiples of 16 */
|
||||
if ((width & 0xf) != 0)
|
||||
width += 16 - (width & 0xf);
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((height & 0xf) != 0)
|
||||
height += 16 - (height & 0xf);
|
||||
oci->mb_rows = height >> 4;
|
||||
oci->mb_cols = width >> 4;
|
||||
oci->MBs = oci->mb_rows * oci->mb_cols;
|
||||
oci->mode_info_stride = oci->mb_cols + 1;
|
||||
oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
|
||||
|
||||
if (!oci->mip) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
{
|
||||
oci->fb_idx_ref_cnt[i] = 0;
|
||||
oci->yv12_fb[i].flags = 0;
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
oci->mi = oci->mip + oci->mode_info_stride + 1;
|
||||
|
||||
oci->new_fb_idx = 0;
|
||||
oci->lst_fb_idx = 1;
|
||||
oci->gld_fb_idx = 2;
|
||||
oci->alt_fb_idx = 3;
|
||||
/* allocate memory for last frame MODE_INFO array */
|
||||
|
||||
oci->fb_idx_ref_cnt[0] = 1;
|
||||
oci->fb_idx_ref_cnt[1] = 1;
|
||||
oci->fb_idx_ref_cnt[2] = 1;
|
||||
oci->fb_idx_ref_cnt[3] = 1;
|
||||
oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
|
||||
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
if (!oci->prev_mip) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
|
||||
|
||||
oci->mb_rows = height >> 4;
|
||||
oci->mb_cols = width >> 4;
|
||||
oci->MBs = oci->mb_rows * oci->mb_cols;
|
||||
oci->mode_info_stride = oci->mb_cols + 1;
|
||||
oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
|
||||
oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
|
||||
|
||||
if (!oci->mip)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
if (!oci->above_context) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
oci->mi = oci->mip + oci->mode_info_stride + 1;
|
||||
update_mode_info_border(oci, oci->mip);
|
||||
update_mode_info_in_image(oci, oci->mi);
|
||||
|
||||
/* allocate memory for last frame MODE_INFO array */
|
||||
|
||||
oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
|
||||
|
||||
if (!oci->prev_mip)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
|
||||
|
||||
oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
|
||||
|
||||
if (!oci->above_context)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
update_mode_info_border(oci, oci->mip);
|
||||
update_mode_info_in_image(oci, oci->mi);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
void vp8_setup_version(VP8_COMMON *cm)
|
||||
{
|
||||
if (cm->version & 0x4)
|
||||
{
|
||||
if (!CONFIG_EXPERIMENTAL)
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
|
||||
"Bitstream was created by an experimental "
|
||||
"encoder");
|
||||
cm->experimental = 1;
|
||||
}
|
||||
void vp8_setup_version(VP8_COMMON *cm) {
|
||||
if (cm->version & 0x4) {
|
||||
if (!CONFIG_EXPERIMENTAL)
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
|
||||
"Bitstream was created by an experimental "
|
||||
"encoder");
|
||||
cm->experimental = 1;
|
||||
}
|
||||
|
||||
switch (cm->version & 0x3)
|
||||
{
|
||||
switch (cm->version & 0x3) {
|
||||
case 0:
|
||||
cm->no_lpf = 0;
|
||||
cm->filter_type = NORMAL_LOOPFILTER;
|
||||
cm->use_bilinear_mc_filter = 0;
|
||||
cm->full_pixel = 0;
|
||||
break;
|
||||
cm->no_lpf = 0;
|
||||
cm->filter_type = NORMAL_LOOPFILTER;
|
||||
cm->use_bilinear_mc_filter = 0;
|
||||
cm->full_pixel = 0;
|
||||
break;
|
||||
case 1:
|
||||
cm->no_lpf = 0;
|
||||
cm->filter_type = SIMPLE_LOOPFILTER;
|
||||
cm->use_bilinear_mc_filter = 1;
|
||||
cm->full_pixel = 0;
|
||||
break;
|
||||
cm->no_lpf = 0;
|
||||
cm->filter_type = SIMPLE_LOOPFILTER;
|
||||
cm->use_bilinear_mc_filter = 1;
|
||||
cm->full_pixel = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
cm->no_lpf = 1;
|
||||
cm->filter_type = NORMAL_LOOPFILTER;
|
||||
cm->use_bilinear_mc_filter = 1;
|
||||
cm->full_pixel = 0;
|
||||
break;
|
||||
// Full pel only code deprecated in experimental code base
|
||||
//case 3:
|
||||
// cm->no_lpf = 1;
|
||||
// cm->filter_type = SIMPLE_LOOPFILTER;
|
||||
// cm->use_bilinear_mc_filter = 1;
|
||||
// cm->full_pixel = 1;
|
||||
// break;
|
||||
}
|
||||
cm->no_lpf = 1;
|
||||
cm->filter_type = NORMAL_LOOPFILTER;
|
||||
cm->use_bilinear_mc_filter = 1;
|
||||
cm->full_pixel = 0;
|
||||
break;
|
||||
// Full pel only code deprecated in experimental code base
|
||||
// case 3:
|
||||
// cm->no_lpf = 1;
|
||||
// cm->filter_type = SIMPLE_LOOPFILTER;
|
||||
// cm->use_bilinear_mc_filter = 1;
|
||||
// cm->full_pixel = 1;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
void vp8_create_common(VP8_COMMON *oci)
|
||||
{
|
||||
vp8_machine_specific_config(oci);
|
||||
void vp8_create_common(VP8_COMMON *oci) {
|
||||
vp8_machine_specific_config(oci);
|
||||
|
||||
vp8_init_mbmode_probs(oci);
|
||||
vp8_init_mbmode_probs(oci);
|
||||
|
||||
vp8_default_bmode_probs(oci->fc.bmode_prob);
|
||||
vp8_default_bmode_probs(oci->fc.bmode_prob);
|
||||
|
||||
oci->txfm_mode = ONLY_4X4;
|
||||
oci->mb_no_coeff_skip = 1;
|
||||
oci->comp_pred_mode = HYBRID_PREDICTION;
|
||||
oci->no_lpf = 0;
|
||||
oci->filter_type = NORMAL_LOOPFILTER;
|
||||
oci->use_bilinear_mc_filter = 0;
|
||||
oci->full_pixel = 0;
|
||||
oci->clr_type = REG_YUV;
|
||||
oci->clamp_type = RECON_CLAMP_REQUIRED;
|
||||
oci->txfm_mode = ONLY_4X4;
|
||||
oci->mb_no_coeff_skip = 1;
|
||||
oci->comp_pred_mode = HYBRID_PREDICTION;
|
||||
oci->no_lpf = 0;
|
||||
oci->filter_type = NORMAL_LOOPFILTER;
|
||||
oci->use_bilinear_mc_filter = 0;
|
||||
oci->full_pixel = 0;
|
||||
oci->clr_type = REG_YUV;
|
||||
oci->clamp_type = RECON_CLAMP_REQUIRED;
|
||||
|
||||
/* Initialise reference frame sign bias structure to defaults */
|
||||
vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
|
||||
/* Initialise reference frame sign bias structure to defaults */
|
||||
vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
|
||||
|
||||
/* Default disable buffer to buffer copying */
|
||||
oci->copy_buffer_to_gf = 0;
|
||||
oci->copy_buffer_to_arf = 0;
|
||||
oci->kf_ymode_probs_update = 0;
|
||||
/* Default disable buffer to buffer copying */
|
||||
oci->copy_buffer_to_gf = 0;
|
||||
oci->copy_buffer_to_arf = 0;
|
||||
oci->kf_ymode_probs_update = 0;
|
||||
}
|
||||
|
||||
void vp8_remove_common(VP8_COMMON *oci)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
void vp8_remove_common(VP8_COMMON *oci) {
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
}
|
||||
|
||||
void vp8_initialize_common()
|
||||
{
|
||||
vp8_coef_tree_initialize();
|
||||
void vp8_initialize_common() {
|
||||
vp8_coef_tree_initialize();
|
||||
|
||||
vp8_entropy_mode_init();
|
||||
vp8_entropy_mode_init();
|
||||
|
||||
vp8_entropy_mv_init();
|
||||
vp8_entropy_mv_init();
|
||||
|
||||
vp8_init_scan_order_mask();
|
||||
vp8_init_scan_order_mask();
|
||||
|
||||
}
|
||||
|
@ -19,98 +19,94 @@
|
||||
#include "vp8/common/idct.h"
|
||||
#include "vp8/common/onyxc_int.h"
|
||||
|
||||
void vp8_arch_arm_common_init(VP8_COMMON *ctx)
|
||||
{
|
||||
void vp8_arch_arm_common_init(VP8_COMMON *ctx) {
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
int flags = arm_cpu_caps();
|
||||
rtcd->flags = flags;
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
int flags = arm_cpu_caps();
|
||||
rtcd->flags = flags;
|
||||
|
||||
/* Override default functions with fastest ones for this CPU. */
|
||||
/* Override default functions with fastest ones for this CPU. */
|
||||
#if HAVE_ARMV5TE
|
||||
if (flags & HAS_EDSP)
|
||||
{
|
||||
}
|
||||
if (flags & HAS_EDSP) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// The commented functions need to be re-written for vpx.
|
||||
#if HAVE_ARMV6
|
||||
if (flags & HAS_MEDIA)
|
||||
{
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_armv6;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_armv6;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_armv6;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_armv6;
|
||||
if (flags & HAS_MEDIA) {
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_armv6;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_armv6;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_armv6;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_armv6;
|
||||
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_armv6;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_armv6;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6;
|
||||
|
||||
//rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6;
|
||||
//rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
|
||||
//rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6;
|
||||
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
|
||||
// rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6;
|
||||
// rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
|
||||
// rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6;
|
||||
// rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_armv6;
|
||||
rtcd->loopfilter.simple_mb_v =
|
||||
vp8_loop_filter_simple_vertical_edge_armv6;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_armv6;
|
||||
rtcd->loopfilter.simple_mb_h =
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_armv6;
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_armv6;
|
||||
rtcd->loopfilter.simple_mb_v =
|
||||
vp8_loop_filter_simple_vertical_edge_armv6;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_armv6;
|
||||
rtcd->loopfilter.simple_mb_h =
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_armv6;
|
||||
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_v6;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_v6;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_v6;
|
||||
rtcd->recon.recon = vp8_recon_b_armv6;
|
||||
rtcd->recon.recon2 = vp8_recon2b_armv6;
|
||||
rtcd->recon.recon4 = vp8_recon4b_armv6;
|
||||
}
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_v6;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_v6;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_v6;
|
||||
rtcd->recon.recon = vp8_recon_b_armv6;
|
||||
rtcd->recon.recon2 = vp8_recon2b_armv6;
|
||||
rtcd->recon.recon4 = vp8_recon4b_armv6;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
if (flags & HAS_NEON)
|
||||
{
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_neon;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_neon;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_neon;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_neon;
|
||||
if (flags & HAS_NEON) {
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_neon;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_neon;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_neon;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_neon;
|
||||
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_neon;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_neon;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon;
|
||||
|
||||
//rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon;
|
||||
//rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
|
||||
//rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon;
|
||||
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
|
||||
// rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon;
|
||||
// rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
|
||||
// rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon;
|
||||
// rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_neon;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_neon;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_neon;
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_neon;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_neon;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_neon;
|
||||
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_neon;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_neon;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_neon;
|
||||
rtcd->recon.recon = vp8_recon_b_neon;
|
||||
rtcd->recon.recon2 = vp8_recon2b_neon;
|
||||
rtcd->recon.recon4 = vp8_recon4b_neon;
|
||||
rtcd->recon.recon_mb = vp8_recon_mb_neon;
|
||||
rtcd->recon.build_intra_predictors_mby =
|
||||
vp8_build_intra_predictors_mby_neon;
|
||||
rtcd->recon.build_intra_predictors_mby_s =
|
||||
vp8_build_intra_predictors_mby_s_neon;
|
||||
}
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_neon;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_neon;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_neon;
|
||||
rtcd->recon.recon = vp8_recon_b_neon;
|
||||
rtcd->recon.recon2 = vp8_recon2b_neon;
|
||||
rtcd->recon.recon4 = vp8_recon4b_neon;
|
||||
rtcd->recon.recon_mb = vp8_recon_mb_neon;
|
||||
rtcd->recon.build_intra_predictors_mby =
|
||||
vp8_build_intra_predictors_mby_neon;
|
||||
rtcd->recon.build_intra_predictors_mby_s =
|
||||
vp8_build_intra_predictors_mby_s_neon;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -16,98 +16,93 @@
|
||||
|
||||
void vp8_filter_block2d_bil_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned int dst_pitch,
|
||||
const short *HFilter,
|
||||
const short *VFilter,
|
||||
int Width,
|
||||
int Height
|
||||
)
|
||||
{
|
||||
unsigned short FData[36*16]; /* Temp data buffer used in filtering */
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned int dst_pitch,
|
||||
const short *HFilter,
|
||||
const short *VFilter,
|
||||
int Width,
|
||||
int Height
|
||||
) {
|
||||
unsigned short FData[36 * 16]; /* Temp data buffer used in filtering */
|
||||
|
||||
/* First filter 1-D horizontally... */
|
||||
vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
|
||||
/* First filter 1-D horizontally... */
|
||||
vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
|
||||
|
||||
/* then 1-D vertically... */
|
||||
vp8_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
|
||||
/* then 1-D vertically... */
|
||||
vp8_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
|
||||
}
|
||||
|
||||
|
||||
void vp8_bilinear_predict4x4_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
|
||||
}
|
||||
|
||||
void vp8_bilinear_predict8x8_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
|
||||
}
|
||||
|
||||
void vp8_bilinear_predict8x4_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
|
||||
}
|
||||
|
||||
void vp8_bilinear_predict16x16_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
HFilter = vp8_bilinear_filters[xoffset];
|
||||
VFilter = vp8_bilinear_filters[yoffset];
|
||||
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
|
||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
|
||||
}
|
||||
|
@ -14,22 +14,22 @@
|
||||
|
||||
extern void vp8_filter_block2d_bil_first_pass_armv6
|
||||
(
|
||||
const unsigned char *src_ptr,
|
||||
unsigned short *dst_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned int height,
|
||||
unsigned int width,
|
||||
const short *vp8_filter
|
||||
const unsigned char *src_ptr,
|
||||
unsigned short *dst_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned int height,
|
||||
unsigned int width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
extern void vp8_filter_block2d_bil_second_pass_armv6
|
||||
(
|
||||
const unsigned short *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch,
|
||||
unsigned int height,
|
||||
unsigned int width,
|
||||
const short *vp8_filter
|
||||
const unsigned short *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch,
|
||||
unsigned int height,
|
||||
unsigned int width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
#endif /* BILINEARFILTER_ARM_H */
|
||||
|
@ -17,205 +17,182 @@
|
||||
|
||||
extern void vp8_filter_block2d_first_pass_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
// 8x8
|
||||
extern void vp8_filter_block2d_first_pass_8x8_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
// 16x16
|
||||
extern void vp8_filter_block2d_first_pass_16x16_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
extern void vp8_filter_block2d_second_pass_armv6
|
||||
(
|
||||
short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int cnt,
|
||||
const short *vp8_filter
|
||||
short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int cnt,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
extern void vp8_filter4_block2d_second_pass_armv6
|
||||
(
|
||||
short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int cnt,
|
||||
const short *vp8_filter
|
||||
short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int cnt,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
extern void vp8_filter_block2d_first_pass_only_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int cnt,
|
||||
unsigned int output_pitch,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int cnt,
|
||||
unsigned int output_pitch,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
|
||||
extern void vp8_filter_block2d_second_pass_only_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int cnt,
|
||||
unsigned int output_pitch,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int cnt,
|
||||
unsigned int output_pitch,
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
#if HAVE_ARMV6
|
||||
void vp8_sixtap_predict_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data buffer used in filtering */
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 12 * 4); /* Temp data buffer used in filtering */
|
||||
|
||||
|
||||
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||
|
||||
/* Vfilter is null. First pass only */
|
||||
if (xoffset && !yoffset)
|
||||
{
|
||||
/*vp8_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
|
||||
vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
|
||||
/* Vfilter is null. First pass only */
|
||||
if (xoffset && !yoffset) {
|
||||
/*vp8_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
|
||||
vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
|
||||
|
||||
vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
|
||||
vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
|
||||
}
|
||||
/* Hfilter is null. Second pass only */
|
||||
else if (!xoffset && yoffset) {
|
||||
vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, VFilter);
|
||||
} else {
|
||||
/* Vfilter is a 4 tap filter */
|
||||
if (yoffset & 0x1) {
|
||||
vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 4, 7, HFilter);
|
||||
vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
|
||||
}
|
||||
/* Hfilter is null. Second pass only */
|
||||
else if (!xoffset && yoffset)
|
||||
{
|
||||
vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Vfilter is a 4 tap filter */
|
||||
if (yoffset & 0x1)
|
||||
{
|
||||
vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 4, 7, HFilter);
|
||||
vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
|
||||
}
|
||||
/* Vfilter is 6 tap filter */
|
||||
else
|
||||
{
|
||||
vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
|
||||
vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
|
||||
}
|
||||
/* Vfilter is 6 tap filter */
|
||||
else {
|
||||
vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
|
||||
vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_sixtap_predict8x8_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data buffer used in filtering */
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 16 * 8); /* Temp data buffer used in filtering */
|
||||
|
||||
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||
|
||||
if (xoffset && !yoffset)
|
||||
{
|
||||
vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
|
||||
}
|
||||
/* Hfilter is null. Second pass only */
|
||||
else if (!xoffset && yoffset)
|
||||
{
|
||||
vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yoffset & 0x1)
|
||||
{
|
||||
vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
|
||||
vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
|
||||
vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
|
||||
}
|
||||
if (xoffset && !yoffset) {
|
||||
vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
|
||||
}
|
||||
/* Hfilter is null. Second pass only */
|
||||
else if (!xoffset && yoffset) {
|
||||
vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
|
||||
} else {
|
||||
if (yoffset & 0x1) {
|
||||
vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
|
||||
vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
|
||||
} else {
|
||||
vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
|
||||
vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict16x16_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16); /* Temp data buffer used in filtering */
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
const short *HFilter;
|
||||
const short *VFilter;
|
||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 24 * 16); /* Temp data buffer used in filtering */
|
||||
|
||||
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||
|
||||
if (xoffset && !yoffset)
|
||||
{
|
||||
vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
|
||||
}
|
||||
/* Hfilter is null. Second pass only */
|
||||
else if (!xoffset && yoffset)
|
||||
{
|
||||
vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yoffset & 0x1)
|
||||
{
|
||||
vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
|
||||
vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
|
||||
vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
|
||||
}
|
||||
if (xoffset && !yoffset) {
|
||||
vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
|
||||
}
|
||||
/* Hfilter is null. Second pass only */
|
||||
else if (!xoffset && yoffset) {
|
||||
vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
|
||||
} else {
|
||||
if (yoffset & 0x1) {
|
||||
vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
|
||||
vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
|
||||
} else {
|
||||
vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
|
||||
vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -22,10 +22,10 @@ extern prototype_loopfilter(vp8_mbloop_filter_vertical_edge_armv6);
|
||||
|
||||
#if HAVE_ARMV7
|
||||
typedef void loopfilter_y_neon(unsigned char *src, int pitch,
|
||||
unsigned char blimit, unsigned char limit, unsigned char thresh);
|
||||
unsigned char blimit, unsigned char limit, unsigned char thresh);
|
||||
typedef void loopfilter_uv_neon(unsigned char *u, int pitch,
|
||||
unsigned char blimit, unsigned char limit, unsigned char thresh,
|
||||
unsigned char *v);
|
||||
unsigned char blimit, unsigned char limit, unsigned char thresh,
|
||||
unsigned char *v);
|
||||
|
||||
extern loopfilter_y_neon vp8_loop_filter_horizontal_edge_y_neon;
|
||||
extern loopfilter_y_neon vp8_loop_filter_vertical_edge_y_neon;
|
||||
@ -42,74 +42,68 @@ extern loopfilter_uv_neon vp8_mbloop_filter_vertical_edge_uv_neon;
|
||||
/*ARMV6 loopfilter functions*/
|
||||
/* Horizontal MB filtering */
|
||||
void vp8_loop_filter_mbh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_mbloop_filter_horizontal_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_mbloop_filter_horizontal_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
/* Vertical MB Filtering */
|
||||
void vp8_loop_filter_mbv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_mbloop_filter_vertical_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_mbloop_filter_vertical_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
/* Horizontal B Filtering */
|
||||
void vp8_loop_filter_bh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_loop_filter_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_loop_filter_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_armv6(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_armv6(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_horizontal_edge_armv6(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_horizontal_edge_armv6(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
void vp8_loop_filter_bhs_armv6(unsigned char *y_ptr, int y_stride,
|
||||
const unsigned char *blimit)
|
||||
{
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, blimit);
|
||||
const unsigned char *blimit) {
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, blimit);
|
||||
}
|
||||
|
||||
/* Vertical B Filtering */
|
||||
void vp8_loop_filter_bv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_loop_filter_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_loop_filter_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_armv6(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_armv6(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_vertical_edge_armv6(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_vertical_edge_armv6(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
void vp8_loop_filter_bvs_armv6(unsigned char *y_ptr, int y_stride,
|
||||
const unsigned char *blimit)
|
||||
{
|
||||
vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 4, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 8, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 12, y_stride, blimit);
|
||||
const unsigned char *blimit) {
|
||||
vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 4, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 8, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 12, y_stride, blimit);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -117,60 +111,56 @@ void vp8_loop_filter_bvs_armv6(unsigned char *y_ptr, int y_stride,
|
||||
/* NEON loopfilter functions */
|
||||
/* Horizontal MB filtering */
|
||||
void vp8_loop_filter_mbh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
unsigned char mblim = *lfi->mblim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
vp8_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
unsigned char mblim = *lfi->mblim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
vp8_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
|
||||
}
|
||||
|
||||
/* Vertical MB Filtering */
|
||||
void vp8_loop_filter_mbv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
unsigned char mblim = *lfi->mblim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
unsigned char mblim = *lfi->mblim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
|
||||
vp8_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
|
||||
vp8_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
|
||||
}
|
||||
|
||||
/* Horizontal B Filtering */
|
||||
void vp8_loop_filter_bh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
unsigned char blim = *lfi->blim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
unsigned char blim = *lfi->blim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
|
||||
vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, blim, lim, hev_thr);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride, blim, lim, hev_thr, v_ptr + 4 * uv_stride);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride, blim, lim, hev_thr, v_ptr + 4 * uv_stride);
|
||||
}
|
||||
|
||||
/* Vertical B Filtering */
|
||||
void vp8_loop_filter_bv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
unsigned char blim = *lfi->blim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
unsigned char blim = *lfi->blim;
|
||||
unsigned char lim = *lfi->lim;
|
||||
unsigned char hev_thr = *lfi->hev_thr;
|
||||
|
||||
vp8_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, blim, lim, hev_thr);
|
||||
vp8_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, blim, lim, hev_thr);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, blim, lim, hev_thr, v_ptr + 4);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, blim, lim, hev_thr, v_ptr + 4);
|
||||
}
|
||||
#endif
|
||||
|
@ -15,15 +15,14 @@
|
||||
|
||||
extern void vp8_recon16x16mb_neon(unsigned char *pred_ptr, short *diff_ptr, unsigned char *dst_ptr, int ystride, unsigned char *udst_ptr, unsigned char *vdst_ptr);
|
||||
|
||||
void vp8_recon_mb_neon(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
unsigned char *pred_ptr = &x->predictor[0];
|
||||
short *diff_ptr = &x->diff[0];
|
||||
unsigned char *dst_ptr = x->dst.y_buffer;
|
||||
unsigned char *udst_ptr = x->dst.u_buffer;
|
||||
unsigned char *vdst_ptr = x->dst.v_buffer;
|
||||
int ystride = x->dst.y_stride;
|
||||
/*int uv_stride = x->dst.uv_stride;*/
|
||||
void vp8_recon_mb_neon(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
unsigned char *pred_ptr = &x->predictor[0];
|
||||
short *diff_ptr = &x->diff[0];
|
||||
unsigned char *dst_ptr = x->dst.y_buffer;
|
||||
unsigned char *udst_ptr = x->dst.u_buffer;
|
||||
unsigned char *vdst_ptr = x->dst.v_buffer;
|
||||
int ystride = x->dst.y_stride;
|
||||
/*int uv_stride = x->dst.uv_stride;*/
|
||||
|
||||
vp8_recon16x16mb_neon(pred_ptr, diff_ptr, dst_ptr, ystride, udst_ptr, vdst_ptr);
|
||||
vp8_recon16x16mb_neon(pred_ptr, diff_ptr, dst_ptr, ystride, udst_ptr, vdst_ptr);
|
||||
}
|
||||
|
@ -17,46 +17,44 @@
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern void vp8_build_intra_predictors_mby_neon_func(
|
||||
unsigned char *y_buffer,
|
||||
unsigned char *ypred_ptr,
|
||||
int y_stride,
|
||||
int mode,
|
||||
int Up,
|
||||
int Left);
|
||||
unsigned char *y_buffer,
|
||||
unsigned char *ypred_ptr,
|
||||
int y_stride,
|
||||
int mode,
|
||||
int Up,
|
||||
int Left);
|
||||
|
||||
void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x)
|
||||
{
|
||||
unsigned char *y_buffer = x->dst.y_buffer;
|
||||
unsigned char *ypred_ptr = x->predictor;
|
||||
int y_stride = x->dst.y_stride;
|
||||
int mode = x->mode_info_context->mbmi.mode;
|
||||
int Up = x->up_available;
|
||||
int Left = x->left_available;
|
||||
void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x) {
|
||||
unsigned char *y_buffer = x->dst.y_buffer;
|
||||
unsigned char *ypred_ptr = x->predictor;
|
||||
int y_stride = x->dst.y_stride;
|
||||
int mode = x->mode_info_context->mbmi.mode;
|
||||
int Up = x->up_available;
|
||||
int Left = x->left_available;
|
||||
|
||||
vp8_build_intra_predictors_mby_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
|
||||
vp8_build_intra_predictors_mby_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern void vp8_build_intra_predictors_mby_s_neon_func(
|
||||
unsigned char *y_buffer,
|
||||
unsigned char *ypred_ptr,
|
||||
int y_stride,
|
||||
int mode,
|
||||
int Up,
|
||||
int Left);
|
||||
unsigned char *y_buffer,
|
||||
unsigned char *ypred_ptr,
|
||||
int y_stride,
|
||||
int mode,
|
||||
int Up,
|
||||
int Left);
|
||||
|
||||
void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x)
|
||||
{
|
||||
unsigned char *y_buffer = x->dst.y_buffer;
|
||||
unsigned char *ypred_ptr = x->predictor;
|
||||
int y_stride = x->dst.y_stride;
|
||||
int mode = x->mode_info_context->mbmi.mode;
|
||||
int Up = x->up_available;
|
||||
int Left = x->left_available;
|
||||
void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x) {
|
||||
unsigned char *y_buffer = x->dst.y_buffer;
|
||||
unsigned char *ypred_ptr = x->predictor;
|
||||
int y_stride = x->dst.y_stride;
|
||||
int mode = x->mode_info_context->mbmi.mode;
|
||||
int Up = x->up_available;
|
||||
int Left = x->left_available;
|
||||
|
||||
vp8_build_intra_predictors_mby_s_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
|
||||
vp8_build_intra_predictors_mby_s_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -13,21 +13,17 @@
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
|
||||
const unsigned char vp8_block2left[25] =
|
||||
{
|
||||
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
|
||||
const unsigned char vp8_block2left[25] = {
|
||||
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
|
||||
};
|
||||
const unsigned char vp8_block2above[25] =
|
||||
{
|
||||
0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8
|
||||
const unsigned char vp8_block2above[25] = {
|
||||
0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8
|
||||
};
|
||||
|
||||
const unsigned char vp8_block2left_8x8[25] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8
|
||||
const unsigned char vp8_block2left_8x8[25] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8
|
||||
};
|
||||
const unsigned char vp8_block2above_8x8[25] =
|
||||
{
|
||||
0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8
|
||||
const unsigned char vp8_block2above_8x8[25] = {
|
||||
0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ void vpx_log(const char *format, ...);
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
//#define MODE_STATS
|
||||
// #define MODE_STATS
|
||||
|
||||
/*#define DCPRED 1*/
|
||||
#define DCPREDSIMTHRESH 0
|
||||
@ -47,9 +47,8 @@ void vpx_log(const char *format, ...);
|
||||
#define SEGMENT_DELTADATA 0
|
||||
#define SEGMENT_ABSDATA 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int r, c;
|
||||
typedef struct {
|
||||
int r, c;
|
||||
} POS;
|
||||
|
||||
#define PLANE_TYPE_Y_NO_DC 0
|
||||
@ -59,12 +58,11 @@ typedef struct
|
||||
|
||||
|
||||
typedef char ENTROPY_CONTEXT;
|
||||
typedef struct
|
||||
{
|
||||
ENTROPY_CONTEXT y1[4];
|
||||
ENTROPY_CONTEXT u[2];
|
||||
ENTROPY_CONTEXT v[2];
|
||||
ENTROPY_CONTEXT y2;
|
||||
typedef struct {
|
||||
ENTROPY_CONTEXT y1[4];
|
||||
ENTROPY_CONTEXT u[2];
|
||||
ENTROPY_CONTEXT v[2];
|
||||
ENTROPY_CONTEXT y2;
|
||||
} ENTROPY_CONTEXT_PLANES;
|
||||
|
||||
extern const unsigned char vp8_block2left[25];
|
||||
@ -73,60 +71,56 @@ extern const unsigned char vp8_block2left_8x8[25];
|
||||
extern const unsigned char vp8_block2above_8x8[25];
|
||||
|
||||
#define VP8_COMBINEENTROPYCONTEXTS( Dest, A, B) \
|
||||
Dest = ((A)!=0) + ((B)!=0);
|
||||
Dest = ((A)!=0) + ((B)!=0);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
KEY_FRAME = 0,
|
||||
INTER_FRAME = 1
|
||||
typedef enum {
|
||||
KEY_FRAME = 0,
|
||||
INTER_FRAME = 1
|
||||
} FRAME_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DC_PRED, /* average of above and left pixels */
|
||||
V_PRED, /* vertical prediction */
|
||||
H_PRED, /* horizontal prediction */
|
||||
typedef enum {
|
||||
DC_PRED, /* average of above and left pixels */
|
||||
V_PRED, /* vertical prediction */
|
||||
H_PRED, /* horizontal prediction */
|
||||
#if CONFIG_NEWINTRAMODES
|
||||
D45_PRED, /* Directional 45 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D135_PRED, /* Directional 135 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D117_PRED, /* Directional 112 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D153_PRED, /* Directional 157 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D27_PRED, /* Directional 22 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D63_PRED, /* Directional 67 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D45_PRED, /* Directional 45 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D135_PRED, /* Directional 135 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D117_PRED, /* Directional 112 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D153_PRED, /* Directional 157 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D27_PRED, /* Directional 22 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
D63_PRED, /* Directional 67 deg prediction [anti-clockwise from 0 deg hor] */
|
||||
#endif
|
||||
TM_PRED, /* Truemotion prediction */
|
||||
I8X8_PRED, /* 8x8 based prediction, each 8x8 has its own prediction mode */
|
||||
B_PRED, /* block based prediction, each block has its own prediction mode */
|
||||
TM_PRED, /* Truemotion prediction */
|
||||
I8X8_PRED, /* 8x8 based prediction, each 8x8 has its own prediction mode */
|
||||
B_PRED, /* block based prediction, each block has its own prediction mode */
|
||||
|
||||
NEARESTMV,
|
||||
NEARMV,
|
||||
ZEROMV,
|
||||
NEWMV,
|
||||
SPLITMV,
|
||||
NEARESTMV,
|
||||
NEARMV,
|
||||
ZEROMV,
|
||||
NEWMV,
|
||||
SPLITMV,
|
||||
|
||||
MB_MODE_COUNT
|
||||
MB_MODE_COUNT
|
||||
} MB_PREDICTION_MODE;
|
||||
|
||||
// Segment level features.
|
||||
typedef enum
|
||||
{
|
||||
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
|
||||
SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
|
||||
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
|
||||
SEG_LVL_MODE = 3, // Optional Segment mode
|
||||
SEG_LVL_EOB = 4, // EOB end stop marker.
|
||||
SEG_LVL_TRANSFORM = 5, // Block transform size.
|
||||
SEG_LVL_MAX = 6 // Number of MB level features supported
|
||||
typedef enum {
|
||||
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
|
||||
SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
|
||||
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
|
||||
SEG_LVL_MODE = 3, // Optional Segment mode
|
||||
SEG_LVL_EOB = 4, // EOB end stop marker.
|
||||
SEG_LVL_TRANSFORM = 5, // Block transform size.
|
||||
SEG_LVL_MAX = 6 // Number of MB level features supported
|
||||
|
||||
} SEG_LVL_FEATURES;
|
||||
|
||||
// Segment level features.
|
||||
typedef enum
|
||||
{
|
||||
TX_4X4 = 0, // 4x4 dct transform
|
||||
TX_8X8 = 1, // 8x8 dct transform
|
||||
typedef enum {
|
||||
TX_4X4 = 0, // 4x4 dct transform
|
||||
TX_8X8 = 1, // 8x8 dct transform
|
||||
|
||||
TX_SIZE_MAX = 2 // Number of differnt transforms avaialble
|
||||
TX_SIZE_MAX = 2 // Number of differnt transforms avaialble
|
||||
|
||||
} TX_SIZE;
|
||||
|
||||
@ -136,28 +130,27 @@ typedef enum
|
||||
|
||||
#define VP8_MVREFS (1 + SPLITMV - NEARESTMV)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
B_DC_PRED, /* average of above and left pixels */
|
||||
B_TM_PRED,
|
||||
typedef enum {
|
||||
B_DC_PRED, /* average of above and left pixels */
|
||||
B_TM_PRED,
|
||||
|
||||
B_VE_PRED, /* vertical prediction */
|
||||
B_HE_PRED, /* horizontal prediction */
|
||||
B_VE_PRED, /* vertical prediction */
|
||||
B_HE_PRED, /* horizontal prediction */
|
||||
|
||||
B_LD_PRED,
|
||||
B_RD_PRED,
|
||||
B_LD_PRED,
|
||||
B_RD_PRED,
|
||||
|
||||
B_VR_PRED,
|
||||
B_VL_PRED,
|
||||
B_HD_PRED,
|
||||
B_HU_PRED,
|
||||
B_VR_PRED,
|
||||
B_VL_PRED,
|
||||
B_HD_PRED,
|
||||
B_HU_PRED,
|
||||
|
||||
LEFT4X4,
|
||||
ABOVE4X4,
|
||||
ZERO4X4,
|
||||
NEW4X4,
|
||||
LEFT4X4,
|
||||
ABOVE4X4,
|
||||
ZERO4X4,
|
||||
NEW4X4,
|
||||
|
||||
B_MODE_COUNT
|
||||
B_MODE_COUNT
|
||||
} B_PREDICTION_MODE;
|
||||
|
||||
#define VP8_BINTRAMODES (B_HU_PRED + 1) /* 10 */
|
||||
@ -167,196 +160,190 @@ typedef enum
|
||||
modes for the Y blocks to the left and above us; for interframes, there
|
||||
is a single probability table. */
|
||||
|
||||
union b_mode_info
|
||||
{
|
||||
struct {
|
||||
B_PREDICTION_MODE first;
|
||||
union b_mode_info {
|
||||
struct {
|
||||
B_PREDICTION_MODE first;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
B_PREDICTION_MODE second;
|
||||
B_PREDICTION_MODE second;
|
||||
#endif
|
||||
} as_mode;
|
||||
struct {
|
||||
int_mv first;
|
||||
int_mv second;
|
||||
} as_mv;
|
||||
} as_mode;
|
||||
struct {
|
||||
int_mv first;
|
||||
int_mv second;
|
||||
} as_mv;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
INTRA_FRAME = 0,
|
||||
LAST_FRAME = 1,
|
||||
GOLDEN_FRAME = 2,
|
||||
ALTREF_FRAME = 3,
|
||||
MAX_REF_FRAMES = 4
|
||||
typedef enum {
|
||||
INTRA_FRAME = 0,
|
||||
LAST_FRAME = 1,
|
||||
GOLDEN_FRAME = 2,
|
||||
ALTREF_FRAME = 3,
|
||||
MAX_REF_FRAMES = 4
|
||||
} MV_REFERENCE_FRAME;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MB_PREDICTION_MODE mode, uv_mode;
|
||||
typedef struct {
|
||||
MB_PREDICTION_MODE mode, uv_mode;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
MB_PREDICTION_MODE second_mode, second_uv_mode;
|
||||
MB_PREDICTION_MODE second_mode, second_uv_mode;
|
||||
#endif
|
||||
MV_REFERENCE_FRAME ref_frame, second_ref_frame;
|
||||
TX_SIZE txfm_size;
|
||||
int_mv mv, second_mv;
|
||||
unsigned char partitioning;
|
||||
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
|
||||
unsigned char need_to_clamp_mvs;
|
||||
unsigned char need_to_clamp_secondmv;
|
||||
unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */
|
||||
MV_REFERENCE_FRAME ref_frame, second_ref_frame;
|
||||
TX_SIZE txfm_size;
|
||||
int_mv mv, second_mv;
|
||||
unsigned char partitioning;
|
||||
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
|
||||
unsigned char need_to_clamp_mvs;
|
||||
unsigned char need_to_clamp_secondmv;
|
||||
unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */
|
||||
|
||||
// Flags used for prediction status of various bistream signals
|
||||
unsigned char seg_id_predicted;
|
||||
unsigned char ref_predicted;
|
||||
// Flags used for prediction status of various bistream signals
|
||||
unsigned char seg_id_predicted;
|
||||
unsigned char ref_predicted;
|
||||
|
||||
// Indicates if the mb is part of the image (1) vs border (0)
|
||||
// This can be useful in determining whether the MB provides
|
||||
// a valid predictor
|
||||
unsigned char mb_in_image;
|
||||
// Indicates if the mb is part of the image (1) vs border (0)
|
||||
// This can be useful in determining whether the MB provides
|
||||
// a valid predictor
|
||||
unsigned char mb_in_image;
|
||||
|
||||
#if CONFIG_PRED_FILTER
|
||||
// Flag to turn prediction signal filter on(1)/off(0 ) at the MB level
|
||||
unsigned int pred_filter_enabled;
|
||||
// Flag to turn prediction signal filter on(1)/off(0 ) at the MB level
|
||||
unsigned int pred_filter_enabled;
|
||||
#endif
|
||||
|
||||
} MB_MODE_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MB_MODE_INFO mbmi;
|
||||
union b_mode_info bmi[16];
|
||||
typedef struct {
|
||||
MB_MODE_INFO mbmi;
|
||||
union b_mode_info bmi[16];
|
||||
} MODE_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short *qcoeff;
|
||||
short *dqcoeff;
|
||||
unsigned char *predictor;
|
||||
short *diff;
|
||||
short *dequant;
|
||||
typedef struct {
|
||||
short *qcoeff;
|
||||
short *dqcoeff;
|
||||
unsigned char *predictor;
|
||||
short *diff;
|
||||
short *dequant;
|
||||
|
||||
/* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
|
||||
unsigned char **base_pre;
|
||||
unsigned char **base_second_pre;
|
||||
int pre;
|
||||
int pre_stride;
|
||||
/* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
|
||||
unsigned char **base_pre;
|
||||
unsigned char **base_second_pre;
|
||||
int pre;
|
||||
int pre_stride;
|
||||
|
||||
unsigned char **base_dst;
|
||||
int dst;
|
||||
int dst_stride;
|
||||
unsigned char **base_dst;
|
||||
int dst;
|
||||
int dst_stride;
|
||||
|
||||
int eob;
|
||||
int eob;
|
||||
|
||||
union b_mode_info bmi;
|
||||
union b_mode_info bmi;
|
||||
} BLOCKD;
|
||||
|
||||
typedef struct MacroBlockD
|
||||
{
|
||||
DECLARE_ALIGNED(16, short, diff[400]); /* from idct diff */
|
||||
DECLARE_ALIGNED(16, unsigned char, predictor[384]);
|
||||
DECLARE_ALIGNED(16, short, qcoeff[400]);
|
||||
DECLARE_ALIGNED(16, short, dqcoeff[400]);
|
||||
DECLARE_ALIGNED(16, char, eobs[25]);
|
||||
typedef struct MacroBlockD {
|
||||
DECLARE_ALIGNED(16, short, diff[400]); /* from idct diff */
|
||||
DECLARE_ALIGNED(16, unsigned char, predictor[384]);
|
||||
DECLARE_ALIGNED(16, short, qcoeff[400]);
|
||||
DECLARE_ALIGNED(16, short, dqcoeff[400]);
|
||||
DECLARE_ALIGNED(16, char, eobs[25]);
|
||||
|
||||
/* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */
|
||||
BLOCKD block[25];
|
||||
int fullpixel_mask;
|
||||
/* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */
|
||||
BLOCKD block[25];
|
||||
int fullpixel_mask;
|
||||
|
||||
YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
|
||||
struct {
|
||||
uint8_t *y_buffer, *u_buffer, *v_buffer;
|
||||
} second_pre;
|
||||
YV12_BUFFER_CONFIG dst;
|
||||
YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
|
||||
struct {
|
||||
uint8_t *y_buffer, *u_buffer, *v_buffer;
|
||||
} second_pre;
|
||||
YV12_BUFFER_CONFIG dst;
|
||||
|
||||
MODE_INFO *prev_mode_info_context;
|
||||
MODE_INFO *mode_info_context;
|
||||
int mode_info_stride;
|
||||
MODE_INFO *prev_mode_info_context;
|
||||
MODE_INFO *mode_info_context;
|
||||
int mode_info_stride;
|
||||
|
||||
FRAME_TYPE frame_type;
|
||||
FRAME_TYPE frame_type;
|
||||
|
||||
int up_available;
|
||||
int left_available;
|
||||
int up_available;
|
||||
int left_available;
|
||||
|
||||
/* Y,U,V,Y2 */
|
||||
ENTROPY_CONTEXT_PLANES *above_context;
|
||||
ENTROPY_CONTEXT_PLANES *left_context;
|
||||
/* Y,U,V,Y2 */
|
||||
ENTROPY_CONTEXT_PLANES *above_context;
|
||||
ENTROPY_CONTEXT_PLANES *left_context;
|
||||
|
||||
/* 0 indicates segmentation at MB level is not enabled. Otherwise the individual bits indicate which features are active. */
|
||||
unsigned char segmentation_enabled;
|
||||
/* 0 indicates segmentation at MB level is not enabled. Otherwise the individual bits indicate which features are active. */
|
||||
unsigned char segmentation_enabled;
|
||||
|
||||
/* 0 (do not update) 1 (update) the macroblock segmentation map. */
|
||||
unsigned char update_mb_segmentation_map;
|
||||
/* 0 (do not update) 1 (update) the macroblock segmentation map. */
|
||||
unsigned char update_mb_segmentation_map;
|
||||
|
||||
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
|
||||
unsigned char update_mb_segmentation_data;
|
||||
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
|
||||
unsigned char update_mb_segmentation_data;
|
||||
|
||||
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
|
||||
unsigned char mb_segment_abs_delta;
|
||||
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
|
||||
unsigned char mb_segment_abs_delta;
|
||||
|
||||
/* Per frame flags that define which MB level features (such as quantizer or loop filter level) */
|
||||
/* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
|
||||
/* Per frame flags that define which MB level features (such as quantizer or loop filter level) */
|
||||
/* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
|
||||
|
||||
// Probability Tree used to code Segment number
|
||||
vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
|
||||
// Probability Tree used to code Segment number
|
||||
vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
|
||||
|
||||
|
||||
// Segment features
|
||||
signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
|
||||
unsigned int segment_feature_mask[MAX_MB_SEGMENTS];
|
||||
// Segment features
|
||||
signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
|
||||
unsigned int segment_feature_mask[MAX_MB_SEGMENTS];
|
||||
|
||||
#if CONFIG_FEATUREUPDATES
|
||||
// keep around the last set so we can figure out what updates...
|
||||
unsigned int old_segment_feature_mask[MAX_MB_SEGMENTS];
|
||||
signed char old_segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
|
||||
// keep around the last set so we can figure out what updates...
|
||||
unsigned int old_segment_feature_mask[MAX_MB_SEGMENTS];
|
||||
signed char old_segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
|
||||
#endif
|
||||
|
||||
/* mode_based Loop filter adjustment */
|
||||
unsigned char mode_ref_lf_delta_enabled;
|
||||
unsigned char mode_ref_lf_delta_update;
|
||||
/* mode_based Loop filter adjustment */
|
||||
unsigned char mode_ref_lf_delta_enabled;
|
||||
unsigned char mode_ref_lf_delta_update;
|
||||
|
||||
/* Delta values have the range +/- MAX_LOOP_FILTER */
|
||||
signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
|
||||
signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
|
||||
signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
|
||||
signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
|
||||
/* Delta values have the range +/- MAX_LOOP_FILTER */
|
||||
signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
|
||||
signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
|
||||
signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
|
||||
signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
|
||||
|
||||
/* Distance of MB away from frame edges */
|
||||
int mb_to_left_edge;
|
||||
int mb_to_right_edge;
|
||||
int mb_to_top_edge;
|
||||
int mb_to_bottom_edge;
|
||||
/* Distance of MB away from frame edges */
|
||||
int mb_to_left_edge;
|
||||
int mb_to_right_edge;
|
||||
int mb_to_top_edge;
|
||||
int mb_to_bottom_edge;
|
||||
|
||||
unsigned int frames_since_golden;
|
||||
unsigned int frames_till_alt_ref_frame;
|
||||
vp8_subpix_fn_t subpixel_predict;
|
||||
vp8_subpix_fn_t subpixel_predict8x4;
|
||||
vp8_subpix_fn_t subpixel_predict8x8;
|
||||
vp8_subpix_fn_t subpixel_predict16x16;
|
||||
vp8_subpix_fn_t subpixel_predict_avg;
|
||||
vp8_subpix_fn_t subpixel_predict_avg8x4;
|
||||
vp8_subpix_fn_t subpixel_predict_avg8x8;
|
||||
vp8_subpix_fn_t subpixel_predict_avg16x16;
|
||||
unsigned int frames_since_golden;
|
||||
unsigned int frames_till_alt_ref_frame;
|
||||
vp8_subpix_fn_t subpixel_predict;
|
||||
vp8_subpix_fn_t subpixel_predict8x4;
|
||||
vp8_subpix_fn_t subpixel_predict8x8;
|
||||
vp8_subpix_fn_t subpixel_predict16x16;
|
||||
vp8_subpix_fn_t subpixel_predict_avg;
|
||||
vp8_subpix_fn_t subpixel_predict_avg8x4;
|
||||
vp8_subpix_fn_t subpixel_predict_avg8x8;
|
||||
vp8_subpix_fn_t subpixel_predict_avg16x16;
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
int allow_high_precision_mv;
|
||||
int allow_high_precision_mv;
|
||||
#endif /* CONFIG_HIGH_PRECISION_MV */
|
||||
|
||||
void *current_bc;
|
||||
void *current_bc;
|
||||
|
||||
int corrupted;
|
||||
int corrupted;
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
/* This is an intermediate buffer currently used in sub-pixel motion search
|
||||
* to keep a copy of the reference area. This buffer can be used for other
|
||||
* purpose.
|
||||
*/
|
||||
DECLARE_ALIGNED(32, unsigned char, y_buf[22*32]);
|
||||
/* This is an intermediate buffer currently used in sub-pixel motion search
|
||||
* to keep a copy of the reference area. This buffer can be used for other
|
||||
* purpose.
|
||||
*/
|
||||
DECLARE_ALIGNED(32, unsigned char, y_buf[22 * 32]);
|
||||
#endif
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
struct VP8_COMMON_RTCD *rtcd;
|
||||
struct VP8_COMMON_RTCD *rtcd;
|
||||
#endif
|
||||
|
||||
int mb_index; // Index of the MB in the SB (0..3)
|
||||
int mb_index; // Index of the MB in the SB (0..3)
|
||||
|
||||
} MACROBLOCKD;
|
||||
|
||||
@ -364,20 +351,17 @@ typedef struct MacroBlockD
|
||||
extern void vp8_build_block_doffsets(MACROBLOCKD *x);
|
||||
extern void vp8_setup_block_dptrs(MACROBLOCKD *x);
|
||||
|
||||
static void update_blockd_bmi(MACROBLOCKD *xd)
|
||||
{
|
||||
int i;
|
||||
int is_4x4;
|
||||
is_4x4 = (xd->mode_info_context->mbmi.mode == SPLITMV) ||
|
||||
(xd->mode_info_context->mbmi.mode == I8X8_PRED) ||
|
||||
(xd->mode_info_context->mbmi.mode == B_PRED);
|
||||
static void update_blockd_bmi(MACROBLOCKD *xd) {
|
||||
int i;
|
||||
int is_4x4;
|
||||
is_4x4 = (xd->mode_info_context->mbmi.mode == SPLITMV) ||
|
||||
(xd->mode_info_context->mbmi.mode == I8X8_PRED) ||
|
||||
(xd->mode_info_context->mbmi.mode == B_PRED);
|
||||
|
||||
if (is_4x4)
|
||||
{
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
xd->block[i].bmi = xd->mode_info_context->bmi[i];
|
||||
}
|
||||
if (is_4x4) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
xd->block[i].bmi = xd->mode_info_context->bmi[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* __INC_BLOCKD_H */
|
||||
|
@ -23,16 +23,16 @@
|
||||
/* Only need this for fixed-size arrays, for structs just assign. */
|
||||
|
||||
#define vp8_copy( Dest, Src) { \
|
||||
assert( sizeof( Dest) == sizeof( Src)); \
|
||||
vpx_memcpy( Dest, Src, sizeof( Src)); \
|
||||
}
|
||||
assert( sizeof( Dest) == sizeof( Src)); \
|
||||
vpx_memcpy( Dest, Src, sizeof( Src)); \
|
||||
}
|
||||
|
||||
/* Use this for variably-sized arrays. */
|
||||
|
||||
#define vp8_copy_array( Dest, Src, N) { \
|
||||
assert( sizeof( *Dest) == sizeof( *Src)); \
|
||||
vpx_memcpy( Dest, Src, N * sizeof( *Src)); \
|
||||
}
|
||||
assert( sizeof( *Dest) == sizeof( *Src)); \
|
||||
vpx_memcpy( Dest, Src, N * sizeof( *Src)); \
|
||||
}
|
||||
|
||||
#define vp8_zero( Dest) vpx_memset( &Dest, 0, sizeof( Dest));
|
||||
|
||||
|
@ -16,384 +16,382 @@
|
||||
#if 0
|
||||
int Contexts[vp8_coef_counter_dimen];
|
||||
|
||||
const int default_contexts[vp8_coef_counter_dimen] =
|
||||
{
|
||||
const int default_contexts[vp8_coef_counter_dimen] = {
|
||||
{
|
||||
// Block Type ( 0 )
|
||||
{
|
||||
// Block Type ( 0 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{30190, 26544, 225, 24, 4, 0, 0, 0, 0, 0, 0, 4171593,},
|
||||
{26846, 25157, 1241, 130, 26, 6, 1, 0, 0, 0, 0, 149987,},
|
||||
{10484, 9538, 1006, 160, 36, 18, 0, 0, 0, 0, 0, 15104,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{25842, 40456, 1126, 83, 11, 2, 0, 0, 0, 0, 0, 0,},
|
||||
{9338, 8010, 512, 73, 7, 3, 2, 0, 0, 0, 0, 43294,},
|
||||
{1047, 751, 149, 31, 13, 6, 1, 0, 0, 0, 0, 879,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{26136, 9826, 252, 13, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{8134, 5574, 191, 14, 2, 0, 0, 0, 0, 0, 0, 35302,},
|
||||
{ 605, 677, 116, 9, 1, 0, 0, 0, 0, 0, 0, 611,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{10263, 15463, 283, 17, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{2773, 2191, 128, 9, 2, 2, 0, 0, 0, 0, 0, 10073,},
|
||||
{ 134, 125, 32, 4, 0, 2, 0, 0, 0, 0, 0, 50,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{10483, 2663, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{2137, 1251, 27, 1, 1, 0, 0, 0, 0, 0, 0, 14362,},
|
||||
{ 116, 156, 14, 2, 1, 0, 0, 0, 0, 0, 0, 190,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{40977, 27614, 412, 28, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{6113, 5213, 261, 22, 3, 0, 0, 0, 0, 0, 0, 26164,},
|
||||
{ 382, 312, 50, 14, 2, 0, 0, 0, 0, 0, 0, 345,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,},
|
||||
},
|
||||
// Coeff Band ( 0 )
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
},
|
||||
{
|
||||
// Block Type ( 1 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{3268, 19382, 1043, 250, 93, 82, 49, 26, 17, 8, 25, 82289,},
|
||||
{8758, 32110, 5436, 1832, 827, 668, 420, 153, 24, 0, 3, 52914,},
|
||||
{9337, 23725, 8487, 3954, 2107, 1836, 1069, 399, 59, 0, 0, 18620,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{12419, 8420, 452, 62, 9, 1, 0, 0, 0, 0, 0, 0,},
|
||||
{11715, 8705, 693, 92, 15, 7, 2, 0, 0, 0, 0, 53988,},
|
||||
{7603, 8585, 2306, 778, 270, 145, 39, 5, 0, 0, 0, 9136,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{15938, 14335, 1207, 184, 55, 13, 4, 1, 0, 0, 0, 0,},
|
||||
{7415, 6829, 1138, 244, 71, 26, 7, 0, 0, 0, 0, 9980,},
|
||||
{1580, 1824, 655, 241, 89, 46, 10, 2, 0, 0, 0, 429,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{19453, 5260, 201, 19, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{9173, 3758, 213, 22, 1, 1, 0, 0, 0, 0, 0, 9820,},
|
||||
{1689, 1277, 276, 51, 17, 4, 0, 0, 0, 0, 0, 679,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{12076, 10667, 620, 85, 19, 9, 5, 0, 0, 0, 0, 0,},
|
||||
{4665, 3625, 423, 55, 19, 9, 0, 0, 0, 0, 0, 5127,},
|
||||
{ 415, 440, 143, 34, 20, 7, 2, 0, 0, 0, 0, 101,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{12183, 4846, 115, 11, 1, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{4226, 3149, 177, 21, 2, 0, 0, 0, 0, 0, 0, 7157,},
|
||||
{ 375, 621, 189, 51, 11, 4, 1, 0, 0, 0, 0, 198,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{61658, 37743, 1203, 94, 10, 3, 0, 0, 0, 0, 0, 0,},
|
||||
{15514, 11563, 903, 111, 14, 5, 0, 0, 0, 0, 0, 25195,},
|
||||
{ 929, 1077, 291, 78, 14, 7, 1, 0, 0, 0, 0, 507,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 990, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 412, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1641,},
|
||||
{ 0, 18, 7, 1, 0, 0, 0, 0, 0, 0, 0, 30,},
|
||||
},
|
||||
// Coeff Band ( 1 )
|
||||
{30190, 26544, 225, 24, 4, 0, 0, 0, 0, 0, 0, 4171593},
|
||||
{26846, 25157, 1241, 130, 26, 6, 1, 0, 0, 0, 0, 149987},
|
||||
{10484, 9538, 1006, 160, 36, 18, 0, 0, 0, 0, 0, 15104},
|
||||
},
|
||||
{
|
||||
// Block Type ( 2 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{ 953, 24519, 628, 120, 28, 12, 4, 0, 0, 0, 0, 2248798,},
|
||||
{1525, 25654, 2647, 617, 239, 143, 42, 5, 0, 0, 0, 66837,},
|
||||
{1180, 11011, 3001, 1237, 532, 448, 239, 54, 5, 0, 0, 7122,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{1356, 2220, 67, 10, 4, 1, 0, 0, 0, 0, 0, 0,},
|
||||
{1450, 2544, 102, 18, 4, 3, 0, 0, 0, 0, 0, 57063,},
|
||||
{1182, 2110, 470, 130, 41, 21, 0, 0, 0, 0, 0, 6047,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{ 370, 3378, 200, 30, 5, 4, 1, 0, 0, 0, 0, 0,},
|
||||
{ 293, 1006, 131, 29, 11, 0, 0, 0, 0, 0, 0, 5404,},
|
||||
{ 114, 387, 98, 23, 4, 8, 1, 0, 0, 0, 0, 236,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{ 579, 194, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 395, 213, 5, 1, 0, 0, 0, 0, 0, 0, 0, 4157,},
|
||||
{ 119, 122, 4, 0, 0, 0, 0, 0, 0, 0, 0, 300,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{ 38, 557, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 21, 114, 12, 1, 0, 0, 0, 0, 0, 0, 0, 427,},
|
||||
{ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{ 52, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 18, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652,},
|
||||
{ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{ 640, 569, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 25, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 517,},
|
||||
{ 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
},
|
||||
// Coeff Band ( 2 )
|
||||
{25842, 40456, 1126, 83, 11, 2, 0, 0, 0, 0, 0, 0},
|
||||
{9338, 8010, 512, 73, 7, 3, 2, 0, 0, 0, 0, 43294},
|
||||
{1047, 751, 149, 31, 13, 6, 1, 0, 0, 0, 0, 879},
|
||||
},
|
||||
{
|
||||
// Block Type ( 3 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{2506, 20161, 2707, 767, 261, 178, 107, 30, 14, 3, 0, 100694,},
|
||||
{8806, 36478, 8817, 3268, 1280, 850, 401, 114, 42, 0, 0, 58572,},
|
||||
{11003, 27214, 11798, 5716, 2482, 2072, 1048, 175, 32, 0, 0, 19284,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{9738, 11313, 959, 205, 70, 18, 11, 1, 0, 0, 0, 0,},
|
||||
{12628, 15085, 1507, 273, 52, 19, 9, 0, 0, 0, 0, 54280,},
|
||||
{10701, 15846, 5561, 1926, 813, 570, 249, 36, 0, 0, 0, 6460,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{6781, 22539, 2784, 634, 182, 123, 20, 4, 0, 0, 0, 0,},
|
||||
{6263, 11544, 2649, 790, 259, 168, 27, 5, 0, 0, 0, 20539,},
|
||||
{3109, 4075, 2031, 896, 457, 386, 158, 29, 0, 0, 0, 1138,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{11515, 4079, 465, 73, 5, 14, 2, 0, 0, 0, 0, 0,},
|
||||
{9361, 5834, 650, 96, 24, 8, 4, 0, 0, 0, 0, 22181,},
|
||||
{4343, 3974, 1360, 415, 132, 96, 14, 1, 0, 0, 0, 1267,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{4787, 9297, 823, 168, 44, 12, 4, 0, 0, 0, 0, 0,},
|
||||
{3619, 4472, 719, 198, 60, 31, 3, 0, 0, 0, 0, 8401,},
|
||||
{1157, 1175, 483, 182, 88, 31, 8, 0, 0, 0, 0, 268,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{8299, 1226, 32, 5, 1, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{3502, 1568, 57, 4, 1, 1, 0, 0, 0, 0, 0, 9811,},
|
||||
{1055, 1070, 166, 29, 6, 1, 0, 0, 0, 0, 0, 527,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{27414, 27927, 1989, 347, 69, 26, 0, 0, 0, 0, 0, 0,},
|
||||
{5876, 10074, 1574, 341, 91, 24, 4, 0, 0, 0, 0, 21954,},
|
||||
{1571, 2171, 778, 324, 124, 65, 16, 0, 0, 0, 0, 979,},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
|
||||
{ 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459,},
|
||||
{ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13,},
|
||||
},
|
||||
// Coeff Band ( 3 )
|
||||
{26136, 9826, 252, 13, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{8134, 5574, 191, 14, 2, 0, 0, 0, 0, 0, 0, 35302},
|
||||
{ 605, 677, 116, 9, 1, 0, 0, 0, 0, 0, 0, 611},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{10263, 15463, 283, 17, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2773, 2191, 128, 9, 2, 2, 0, 0, 0, 0, 0, 10073},
|
||||
{ 134, 125, 32, 4, 0, 2, 0, 0, 0, 0, 0, 50},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{10483, 2663, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2137, 1251, 27, 1, 1, 0, 0, 0, 0, 0, 0, 14362},
|
||||
{ 116, 156, 14, 2, 1, 0, 0, 0, 0, 0, 0, 190},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{40977, 27614, 412, 28, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{6113, 5213, 261, 22, 3, 0, 0, 0, 0, 0, 0, 26164},
|
||||
{ 382, 312, 50, 14, 2, 0, 0, 0, 0, 0, 0, 345},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8},
|
||||
},
|
||||
},
|
||||
{
|
||||
// Block Type ( 1 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{3268, 19382, 1043, 250, 93, 82, 49, 26, 17, 8, 25, 82289},
|
||||
{8758, 32110, 5436, 1832, 827, 668, 420, 153, 24, 0, 3, 52914},
|
||||
{9337, 23725, 8487, 3954, 2107, 1836, 1069, 399, 59, 0, 0, 18620},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{12419, 8420, 452, 62, 9, 1, 0, 0, 0, 0, 0, 0},
|
||||
{11715, 8705, 693, 92, 15, 7, 2, 0, 0, 0, 0, 53988},
|
||||
{7603, 8585, 2306, 778, 270, 145, 39, 5, 0, 0, 0, 9136},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{15938, 14335, 1207, 184, 55, 13, 4, 1, 0, 0, 0, 0},
|
||||
{7415, 6829, 1138, 244, 71, 26, 7, 0, 0, 0, 0, 9980},
|
||||
{1580, 1824, 655, 241, 89, 46, 10, 2, 0, 0, 0, 429},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{19453, 5260, 201, 19, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{9173, 3758, 213, 22, 1, 1, 0, 0, 0, 0, 0, 9820},
|
||||
{1689, 1277, 276, 51, 17, 4, 0, 0, 0, 0, 0, 679},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{12076, 10667, 620, 85, 19, 9, 5, 0, 0, 0, 0, 0},
|
||||
{4665, 3625, 423, 55, 19, 9, 0, 0, 0, 0, 0, 5127},
|
||||
{ 415, 440, 143, 34, 20, 7, 2, 0, 0, 0, 0, 101},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{12183, 4846, 115, 11, 1, 0, 0, 0, 0, 0, 0, 0},
|
||||
{4226, 3149, 177, 21, 2, 0, 0, 0, 0, 0, 0, 7157},
|
||||
{ 375, 621, 189, 51, 11, 4, 1, 0, 0, 0, 0, 198},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{61658, 37743, 1203, 94, 10, 3, 0, 0, 0, 0, 0, 0},
|
||||
{15514, 11563, 903, 111, 14, 5, 0, 0, 0, 0, 0, 25195},
|
||||
{ 929, 1077, 291, 78, 14, 7, 1, 0, 0, 0, 0, 507},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 990, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 412, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1641},
|
||||
{ 0, 18, 7, 1, 0, 0, 0, 0, 0, 0, 0, 30},
|
||||
},
|
||||
},
|
||||
{
|
||||
// Block Type ( 2 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{ 953, 24519, 628, 120, 28, 12, 4, 0, 0, 0, 0, 2248798},
|
||||
{1525, 25654, 2647, 617, 239, 143, 42, 5, 0, 0, 0, 66837},
|
||||
{1180, 11011, 3001, 1237, 532, 448, 239, 54, 5, 0, 0, 7122},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{1356, 2220, 67, 10, 4, 1, 0, 0, 0, 0, 0, 0},
|
||||
{1450, 2544, 102, 18, 4, 3, 0, 0, 0, 0, 0, 57063},
|
||||
{1182, 2110, 470, 130, 41, 21, 0, 0, 0, 0, 0, 6047},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{ 370, 3378, 200, 30, 5, 4, 1, 0, 0, 0, 0, 0},
|
||||
{ 293, 1006, 131, 29, 11, 0, 0, 0, 0, 0, 0, 5404},
|
||||
{ 114, 387, 98, 23, 4, 8, 1, 0, 0, 0, 0, 236},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{ 579, 194, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 395, 213, 5, 1, 0, 0, 0, 0, 0, 0, 0, 4157},
|
||||
{ 119, 122, 4, 0, 0, 0, 0, 0, 0, 0, 0, 300},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{ 38, 557, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 21, 114, 12, 1, 0, 0, 0, 0, 0, 0, 0, 427},
|
||||
{ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{ 52, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 18, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652},
|
||||
{ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{ 640, 569, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 25, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 517},
|
||||
{ 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
},
|
||||
},
|
||||
{
|
||||
// Block Type ( 3 )
|
||||
{
|
||||
// Coeff Band ( 0 )
|
||||
{2506, 20161, 2707, 767, 261, 178, 107, 30, 14, 3, 0, 100694},
|
||||
{8806, 36478, 8817, 3268, 1280, 850, 401, 114, 42, 0, 0, 58572},
|
||||
{11003, 27214, 11798, 5716, 2482, 2072, 1048, 175, 32, 0, 0, 19284},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 1 )
|
||||
{9738, 11313, 959, 205, 70, 18, 11, 1, 0, 0, 0, 0},
|
||||
{12628, 15085, 1507, 273, 52, 19, 9, 0, 0, 0, 0, 54280},
|
||||
{10701, 15846, 5561, 1926, 813, 570, 249, 36, 0, 0, 0, 6460},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 2 )
|
||||
{6781, 22539, 2784, 634, 182, 123, 20, 4, 0, 0, 0, 0},
|
||||
{6263, 11544, 2649, 790, 259, 168, 27, 5, 0, 0, 0, 20539},
|
||||
{3109, 4075, 2031, 896, 457, 386, 158, 29, 0, 0, 0, 1138},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 3 )
|
||||
{11515, 4079, 465, 73, 5, 14, 2, 0, 0, 0, 0, 0},
|
||||
{9361, 5834, 650, 96, 24, 8, 4, 0, 0, 0, 0, 22181},
|
||||
{4343, 3974, 1360, 415, 132, 96, 14, 1, 0, 0, 0, 1267},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 4 )
|
||||
{4787, 9297, 823, 168, 44, 12, 4, 0, 0, 0, 0, 0},
|
||||
{3619, 4472, 719, 198, 60, 31, 3, 0, 0, 0, 0, 8401},
|
||||
{1157, 1175, 483, 182, 88, 31, 8, 0, 0, 0, 0, 268},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 5 )
|
||||
{8299, 1226, 32, 5, 1, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3502, 1568, 57, 4, 1, 1, 0, 0, 0, 0, 0, 9811},
|
||||
{1055, 1070, 166, 29, 6, 1, 0, 0, 0, 0, 0, 527},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 6 )
|
||||
{27414, 27927, 1989, 347, 69, 26, 0, 0, 0, 0, 0, 0},
|
||||
{5876, 10074, 1574, 341, 91, 24, 4, 0, 0, 0, 0, 21954},
|
||||
{1571, 2171, 778, 324, 124, 65, 16, 0, 0, 0, 0, 979},
|
||||
},
|
||||
{
|
||||
// Coeff Band ( 7 )
|
||||
{ 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459},
|
||||
{ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
//Update probabilities for the nodes in the token entropy tree.
|
||||
const vp8_prob tree_update_probs[vp8_coef_tree_dimen] =
|
||||
{
|
||||
// Update probabilities for the nodes in the token entropy tree.
|
||||
const vp8_prob tree_update_probs[vp8_coef_tree_dimen] = {
|
||||
{
|
||||
{
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{
|
||||
{217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255, },
|
||||
{234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{
|
||||
{186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{
|
||||
{248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
{217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255, },
|
||||
{234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
{186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
{248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
{
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
|
||||
},
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
@ -13,152 +13,137 @@
|
||||
#include "blockd.h"
|
||||
|
||||
|
||||
void vp8_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, int frame)
|
||||
{
|
||||
void vp8_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, int frame) {
|
||||
|
||||
int mb_row;
|
||||
int mb_col;
|
||||
int mb_index = 0;
|
||||
FILE *mvs = fopen("mvs.stt", "a");
|
||||
int mb_row;
|
||||
int mb_col;
|
||||
int mb_index = 0;
|
||||
FILE *mvs = fopen("mvs.stt", "a");
|
||||
|
||||
/* print out the macroblock Y modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
|
||||
/* print out the macroblock Y modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
|
||||
|
||||
for (mb_row = 0; mb_row < rows; mb_row++)
|
||||
{
|
||||
for (mb_col = 0; mb_col < cols; mb_col++)
|
||||
{
|
||||
for (mb_row = 0; mb_row < rows; mb_row++) {
|
||||
for (mb_col = 0; mb_col < cols; mb_col++) {
|
||||
|
||||
fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
|
||||
fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
|
||||
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
mb_index++;
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
for (mb_row = 0; mb_row < rows; mb_row++)
|
||||
{
|
||||
for (mb_col = 0; mb_col < cols; mb_col++)
|
||||
{
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
|
||||
|
||||
fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
|
||||
for (mb_row = 0; mb_row < rows; mb_row++) {
|
||||
for (mb_col = 0; mb_col < cols; mb_col++) {
|
||||
|
||||
mb_index++;
|
||||
}
|
||||
fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
mb_index++;
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
/* print out the macroblock UV modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "UV Modes for Frame %d\n", frame);
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
for (mb_row = 0; mb_row < rows; mb_row++)
|
||||
{
|
||||
for (mb_col = 0; mb_col < cols; mb_col++)
|
||||
{
|
||||
/* print out the macroblock UV modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "UV Modes for Frame %d\n", frame);
|
||||
|
||||
fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
|
||||
for (mb_row = 0; mb_row < rows; mb_row++) {
|
||||
for (mb_col = 0; mb_col < cols; mb_col++) {
|
||||
|
||||
mb_index++;
|
||||
}
|
||||
fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
|
||||
|
||||
mb_index++;
|
||||
fprintf(mvs, "\n");
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
mb_index++;
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
|
||||
/* print out the block modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "Mbs for Frame %d\n", frame);
|
||||
{
|
||||
int b_row;
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
for (b_row = 0; b_row < 4 * rows; b_row++)
|
||||
{
|
||||
int b_col;
|
||||
int bindex;
|
||||
/* print out the block modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "Mbs for Frame %d\n", frame);
|
||||
{
|
||||
int b_row;
|
||||
|
||||
for (b_col = 0; b_col < 4 * cols; b_col++)
|
||||
{
|
||||
mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
|
||||
bindex = (b_row & 3) * 4 + (b_col & 3);
|
||||
for (b_row = 0; b_row < 4 * rows; b_row++) {
|
||||
int b_col;
|
||||
int bindex;
|
||||
|
||||
if (mi[mb_index].mbmi.mode == B_PRED)
|
||||
{
|
||||
fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode.first);
|
||||
for (b_col = 0; b_col < 4 * cols; b_col++) {
|
||||
mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
|
||||
bindex = (b_row & 3) * 4 + (b_col & 3);
|
||||
|
||||
if (mi[mb_index].mbmi.mode == B_PRED) {
|
||||
fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode.first);
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode.second);
|
||||
fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode.second);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
fprintf(mvs, "xx ");
|
||||
} else
|
||||
fprintf(mvs, "xx ");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
/* print out the macroblock mvs */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "MVs for Frame %d\n", frame);
|
||||
/* print out the macroblock mvs */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "MVs for Frame %d\n", frame);
|
||||
|
||||
for (mb_row = 0; mb_row < rows; mb_row++)
|
||||
{
|
||||
for (mb_col = 0; mb_col < cols; mb_col++)
|
||||
{
|
||||
fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv.as_mv.row / 2, mi[mb_index].mbmi.mv.as_mv.col / 2);
|
||||
for (mb_row = 0; mb_row < rows; mb_row++) {
|
||||
for (mb_col = 0; mb_col < cols; mb_col++) {
|
||||
fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv.as_mv.row / 2, mi[mb_index].mbmi.mv.as_mv.col / 2);
|
||||
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
mb_index++;
|
||||
fprintf(mvs, "\n");
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
mb_index++;
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
|
||||
/* print out the block modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "MVs for Frame %d\n", frame);
|
||||
{
|
||||
int b_row;
|
||||
/* print out the block modes */
|
||||
mb_index = 0;
|
||||
fprintf(mvs, "MVs for Frame %d\n", frame);
|
||||
{
|
||||
int b_row;
|
||||
|
||||
for (b_row = 0; b_row < 4 * rows; b_row++)
|
||||
{
|
||||
int b_col;
|
||||
int bindex;
|
||||
for (b_row = 0; b_row < 4 * rows; b_row++) {
|
||||
int b_col;
|
||||
int bindex;
|
||||
|
||||
for (b_col = 0; b_col < 4 * cols; b_col++)
|
||||
{
|
||||
mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
|
||||
bindex = (b_row & 3) * 4 + (b_col & 3);
|
||||
fprintf(mvs, "%3d:%-3d ",
|
||||
mi[mb_index].bmi[bindex].as_mv.first.as_mv.row,
|
||||
mi[mb_index].bmi[bindex].as_mv.first.as_mv.col);
|
||||
for (b_col = 0; b_col < 4 * cols; b_col++) {
|
||||
mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
|
||||
bindex = (b_row & 3) * 4 + (b_col & 3);
|
||||
fprintf(mvs, "%3d:%-3d ",
|
||||
mi[mb_index].bmi[bindex].as_mv.first.as_mv.row,
|
||||
mi[mb_index].bmi[bindex].as_mv.first.as_mv.col);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
|
||||
fclose(mvs);
|
||||
fclose(mvs);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,24 +28,23 @@ typedef vp8_prob Prob;
|
||||
|
||||
#include "coefupdateprobs.h"
|
||||
|
||||
DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) =
|
||||
{
|
||||
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) = {
|
||||
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) =
|
||||
@ -55,15 +54,16 @@ DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) =
|
||||
#if CONFIG_EXPANDED_COEF_CONTEXT
|
||||
{ 0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 0};
|
||||
#else
|
||||
{ 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0};
|
||||
{
|
||||
0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) =
|
||||
{
|
||||
0, 1, 4, 8,
|
||||
5, 2, 3, 6,
|
||||
9, 12, 13, 10,
|
||||
7, 11, 14, 15,
|
||||
DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) = {
|
||||
0, 1, 4, 8,
|
||||
5, 2, 3, 6,
|
||||
9, 12, 13, 10,
|
||||
7, 11, 14, 15,
|
||||
};
|
||||
DECLARE_ALIGNED(64, cuchar, vp8_coef_bands_8x8[64]) = { 0, 1, 2, 3, 5, 4, 4, 5,
|
||||
5, 3, 6, 3, 5, 4, 6, 6,
|
||||
@ -73,34 +73,33 @@ DECLARE_ALIGNED(64, cuchar, vp8_coef_bands_8x8[64]) = { 0, 1, 2, 3, 5, 4, 4, 5,
|
||||
7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7
|
||||
};
|
||||
DECLARE_ALIGNED(64, const int, vp8_default_zig_zag1d_8x8[64]) =
|
||||
{
|
||||
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
|
||||
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
|
||||
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
|
||||
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
|
||||
};
|
||||
DECLARE_ALIGNED(64, const int, vp8_default_zig_zag1d_8x8[64]) = {
|
||||
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
|
||||
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
|
||||
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
|
||||
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
|
||||
};
|
||||
|
||||
|
||||
DECLARE_ALIGNED(16, short, vp8_default_zig_zag_mask[16]);
|
||||
DECLARE_ALIGNED(64, short, vp8_default_zig_zag_mask_8x8[64]);//int64_t
|
||||
DECLARE_ALIGNED(64, short, vp8_default_zig_zag_mask_8x8[64]);// int64_t
|
||||
|
||||
/* Array indices are identical to previously-existing CONTEXT_NODE indices */
|
||||
|
||||
const vp8_tree_index vp8_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
|
||||
{
|
||||
-DCT_EOB_TOKEN, 2, /* 0 = EOB */
|
||||
-ZERO_TOKEN, 4, /* 1 = ZERO */
|
||||
-ONE_TOKEN, 6, /* 2 = ONE */
|
||||
8, 12, /* 3 = LOW_VAL */
|
||||
-TWO_TOKEN, 10, /* 4 = TWO */
|
||||
-THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */
|
||||
14, 16, /* 6 = HIGH_LOW */
|
||||
-DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */
|
||||
18, 20, /* 8 = CAT_THREEFOUR */
|
||||
-DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
|
||||
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
|
||||
-DCT_EOB_TOKEN, 2, /* 0 = EOB */
|
||||
-ZERO_TOKEN, 4, /* 1 = ZERO */
|
||||
-ONE_TOKEN, 6, /* 2 = ONE */
|
||||
8, 12, /* 3 = LOW_VAL */
|
||||
-TWO_TOKEN, 10, /* 4 = TWO */
|
||||
-THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */
|
||||
14, 16, /* 6 = HIGH_LOW */
|
||||
-DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */
|
||||
18, 20, /* 8 = CAT_THREEFOUR */
|
||||
-DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
|
||||
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
|
||||
};
|
||||
|
||||
struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS];
|
||||
@ -118,57 +117,50 @@ static const Prob Pcat6[] =
|
||||
|
||||
static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[26];
|
||||
|
||||
void vp8_init_scan_order_mask()
|
||||
{
|
||||
int i;
|
||||
void vp8_init_scan_order_mask() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
|
||||
}
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
vp8_default_zig_zag_mask_8x8[vp8_default_zig_zag1d_8x8[i]] = 1 << i;
|
||||
}
|
||||
for (i = 0; i < 16; i++) {
|
||||
vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
|
||||
}
|
||||
for (i = 0; i < 64; i++) {
|
||||
vp8_default_zig_zag_mask_8x8[vp8_default_zig_zag1d_8x8[i]] = 1 << i;
|
||||
}
|
||||
}
|
||||
|
||||
static void init_bit_tree(vp8_tree_index *p, int n)
|
||||
{
|
||||
int i = 0;
|
||||
static void init_bit_tree(vp8_tree_index *p, int n) {
|
||||
int i = 0;
|
||||
|
||||
while (++i < n)
|
||||
{
|
||||
p[0] = p[1] = i << 1;
|
||||
p += 2;
|
||||
}
|
||||
while (++i < n) {
|
||||
p[0] = p[1] = i << 1;
|
||||
p += 2;
|
||||
}
|
||||
|
||||
p[0] = p[1] = 0;
|
||||
p[0] = p[1] = 0;
|
||||
}
|
||||
|
||||
static void init_bit_trees()
|
||||
{
|
||||
init_bit_tree(cat1, 1);
|
||||
init_bit_tree(cat2, 2);
|
||||
init_bit_tree(cat3, 3);
|
||||
init_bit_tree(cat4, 4);
|
||||
init_bit_tree(cat5, 5);
|
||||
init_bit_tree(cat6, 13);
|
||||
static void init_bit_trees() {
|
||||
init_bit_tree(cat1, 1);
|
||||
init_bit_tree(cat2, 2);
|
||||
init_bit_tree(cat3, 3);
|
||||
init_bit_tree(cat4, 4);
|
||||
init_bit_tree(cat5, 5);
|
||||
init_bit_tree(cat6, 13);
|
||||
}
|
||||
|
||||
vp8_extra_bit_struct vp8_extra_bits[12] =
|
||||
{
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 1},
|
||||
{ 0, 0, 0, 2},
|
||||
{ 0, 0, 0, 3},
|
||||
{ 0, 0, 0, 4},
|
||||
{ cat1, Pcat1, 1, 5},
|
||||
{ cat2, Pcat2, 2, 7},
|
||||
{ cat3, Pcat3, 3, 11},
|
||||
{ cat4, Pcat4, 4, 19},
|
||||
{ cat5, Pcat5, 5, 35},
|
||||
{ cat6, Pcat6, 13, 67},
|
||||
{ 0, 0, 0, 0}
|
||||
vp8_extra_bit_struct vp8_extra_bits[12] = {
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 1},
|
||||
{ 0, 0, 0, 2},
|
||||
{ 0, 0, 0, 3},
|
||||
{ 0, 0, 0, 4},
|
||||
{ cat1, Pcat1, 1, 5},
|
||||
{ cat2, Pcat2, 2, 7},
|
||||
{ cat3, Pcat3, 3, 11},
|
||||
{ cat4, Pcat4, 4, 19},
|
||||
{ cat5, Pcat5, 5, 35},
|
||||
{ cat6, Pcat6, 13, 67},
|
||||
{ 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#if CONFIG_NEWUPDATE
|
||||
@ -177,25 +169,23 @@ const vp8_prob updprobs[4] = {128, 136, 120, 112};
|
||||
|
||||
#include "default_coef_probs.h"
|
||||
|
||||
void vp8_default_coef_probs(VP8_COMMON *pc)
|
||||
{
|
||||
vpx_memcpy(pc->fc.coef_probs, default_coef_probs,
|
||||
sizeof(default_coef_probs));
|
||||
void vp8_default_coef_probs(VP8_COMMON *pc) {
|
||||
vpx_memcpy(pc->fc.coef_probs, default_coef_probs,
|
||||
sizeof(default_coef_probs));
|
||||
|
||||
vpx_memcpy(pc->fc.coef_probs_8x8, vp8_default_coef_probs_8x8,
|
||||
sizeof(vp8_default_coef_probs_8x8));
|
||||
vpx_memcpy(pc->fc.coef_probs_8x8, vp8_default_coef_probs_8x8,
|
||||
sizeof(vp8_default_coef_probs_8x8));
|
||||
|
||||
}
|
||||
|
||||
void vp8_coef_tree_initialize()
|
||||
{
|
||||
init_bit_trees();
|
||||
vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree);
|
||||
void vp8_coef_tree_initialize() {
|
||||
init_bit_trees();
|
||||
vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree);
|
||||
}
|
||||
|
||||
#if CONFIG_ADAPTIVE_ENTROPY
|
||||
|
||||
//#define COEF_COUNT_TESTING
|
||||
// #define COEF_COUNT_TESTING
|
||||
|
||||
#define COEF_COUNT_SAT 24
|
||||
#define COEF_MAX_UPDATE_FACTOR 112
|
||||
@ -204,127 +194,111 @@ void vp8_coef_tree_initialize()
|
||||
#define COEF_COUNT_SAT_AFTER_KEY 24
|
||||
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
|
||||
|
||||
void vp8_adapt_coef_probs(VP8_COMMON *cm)
|
||||
{
|
||||
int t, i, j, k, count;
|
||||
unsigned int branch_ct[ENTROPY_NODES][2];
|
||||
vp8_prob coef_probs[ENTROPY_NODES];
|
||||
int update_factor; /* denominator 256 */
|
||||
int factor;
|
||||
int count_sat;
|
||||
void vp8_adapt_coef_probs(VP8_COMMON *cm) {
|
||||
int t, i, j, k, count;
|
||||
unsigned int branch_ct[ENTROPY_NODES][2];
|
||||
vp8_prob coef_probs[ENTROPY_NODES];
|
||||
int update_factor; /* denominator 256 */
|
||||
int factor;
|
||||
int count_sat;
|
||||
|
||||
//printf("Frame type: %d\n", cm->frame_type);
|
||||
if (cm->frame_type == KEY_FRAME)
|
||||
{
|
||||
update_factor = COEF_MAX_UPDATE_FACTOR_KEY;
|
||||
count_sat = COEF_COUNT_SAT_KEY;
|
||||
}
|
||||
else if (cm->last_frame_type == KEY_FRAME)
|
||||
{
|
||||
update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */
|
||||
count_sat = COEF_COUNT_SAT_AFTER_KEY;
|
||||
}
|
||||
else
|
||||
{
|
||||
update_factor = COEF_MAX_UPDATE_FACTOR;
|
||||
count_sat = COEF_COUNT_SAT;
|
||||
}
|
||||
// printf("Frame type: %d\n", cm->frame_type);
|
||||
if (cm->frame_type == KEY_FRAME) {
|
||||
update_factor = COEF_MAX_UPDATE_FACTOR_KEY;
|
||||
count_sat = COEF_COUNT_SAT_KEY;
|
||||
} else if (cm->last_frame_type == KEY_FRAME) {
|
||||
update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */
|
||||
count_sat = COEF_COUNT_SAT_AFTER_KEY;
|
||||
} else {
|
||||
update_factor = COEF_MAX_UPDATE_FACTOR;
|
||||
count_sat = COEF_COUNT_SAT;
|
||||
}
|
||||
|
||||
#ifdef COEF_COUNT_TESTING
|
||||
{
|
||||
printf("static const unsigned int\ncoef_counts"
|
||||
"[BLOCK_TYPES] [COEF_BANDS]"
|
||||
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n");
|
||||
for (i = 0; i<BLOCK_TYPES; ++i)
|
||||
{
|
||||
printf(" {\n");
|
||||
for (j = 0; j<COEF_BANDS; ++j)
|
||||
{
|
||||
printf(" {\n");
|
||||
for (k = 0; k<PREV_COEF_CONTEXTS; ++k)
|
||||
{
|
||||
printf(" {");
|
||||
for (t = 0; t<MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts[i][j][k][t]);
|
||||
printf("},\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
{
|
||||
printf("static const unsigned int\ncoef_counts"
|
||||
"[BLOCK_TYPES] [COEF_BANDS]"
|
||||
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n");
|
||||
for (i = 0; i < BLOCK_TYPES; ++i) {
|
||||
printf(" {\n");
|
||||
for (j = 0; j < COEF_BANDS; ++j) {
|
||||
printf(" {\n");
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
printf(" {");
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts[i][j][k][t]);
|
||||
printf("},\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
printf(" },\n");
|
||||
}
|
||||
printf("};\n");
|
||||
printf("static const unsigned int\ncoef_counts_8x8"
|
||||
"[BLOCK_TYPES_8X8] [COEF_BANDS]"
|
||||
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n");
|
||||
for (i = 0; i<BLOCK_TYPES_8X8; ++i)
|
||||
{
|
||||
printf(" {\n");
|
||||
for (j = 0; j<COEF_BANDS; ++j)
|
||||
{
|
||||
printf(" {\n");
|
||||
for (k = 0; k<PREV_COEF_CONTEXTS; ++k)
|
||||
{
|
||||
printf(" {");
|
||||
for (t = 0; t<MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts_8x8[i][j][k][t]);
|
||||
printf("},\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
}
|
||||
printf("};\n");
|
||||
printf(" },\n");
|
||||
}
|
||||
printf("};\n");
|
||||
printf("static const unsigned int\ncoef_counts_8x8"
|
||||
"[BLOCK_TYPES_8X8] [COEF_BANDS]"
|
||||
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n");
|
||||
for (i = 0; i < BLOCK_TYPES_8X8; ++i) {
|
||||
printf(" {\n");
|
||||
for (j = 0; j < COEF_BANDS; ++j) {
|
||||
printf(" {\n");
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
printf(" {");
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts_8x8[i][j][k][t]);
|
||||
printf("},\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
}
|
||||
printf("};\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i<BLOCK_TYPES; ++i)
|
||||
for (j = 0; j<COEF_BANDS; ++j)
|
||||
for (k = 0; k<PREV_COEF_CONTEXTS; ++k)
|
||||
{
|
||||
for (i = 0; i < BLOCK_TYPES; ++i)
|
||||
for (j = 0; j < COEF_BANDS; ++j)
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
#if CONFIG_EXPANDED_COEF_CONTEXT
|
||||
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
|
||||
continue;
|
||||
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
|
||||
continue;
|
||||
#endif
|
||||
vp8_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
|
||||
coef_probs, branch_ct, cm->fc.coef_counts [i][j][k],
|
||||
256, 1);
|
||||
for (t=0; t<ENTROPY_NODES; ++t)
|
||||
{
|
||||
int prob;
|
||||
count = branch_ct[t][0] + branch_ct[t][1];
|
||||
count = count > count_sat ? count_sat : count;
|
||||
factor = (update_factor * count / count_sat);
|
||||
prob = ((int)cm->fc.pre_coef_probs[i][j][k][t] * (256-factor) +
|
||||
(int)coef_probs[t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.coef_probs[i][j][k][t] = 1;
|
||||
else if (prob > 255) cm->fc.coef_probs[i][j][k][t] = 255;
|
||||
else cm->fc.coef_probs[i][j][k][t] = prob;
|
||||
}
|
||||
}
|
||||
vp8_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
|
||||
coef_probs, branch_ct, cm->fc.coef_counts [i][j][k],
|
||||
256, 1);
|
||||
for (t = 0; t < ENTROPY_NODES; ++t) {
|
||||
int prob;
|
||||
count = branch_ct[t][0] + branch_ct[t][1];
|
||||
count = count > count_sat ? count_sat : count;
|
||||
factor = (update_factor * count / count_sat);
|
||||
prob = ((int)cm->fc.pre_coef_probs[i][j][k][t] * (256 - factor) +
|
||||
(int)coef_probs[t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.coef_probs[i][j][k][t] = 1;
|
||||
else if (prob > 255) cm->fc.coef_probs[i][j][k][t] = 255;
|
||||
else cm->fc.coef_probs[i][j][k][t] = prob;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i<BLOCK_TYPES_8X8; ++i)
|
||||
for (j = 0; j<COEF_BANDS; ++j)
|
||||
for (k = 0; k<PREV_COEF_CONTEXTS; ++k)
|
||||
{
|
||||
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
|
||||
for (j = 0; j < COEF_BANDS; ++j)
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
#if CONFIG_EXPANDED_COEF_CONTEXT
|
||||
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
|
||||
continue;
|
||||
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
|
||||
continue;
|
||||
#endif
|
||||
vp8_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
|
||||
coef_probs, branch_ct, cm->fc.coef_counts_8x8 [i][j][k],
|
||||
256, 1);
|
||||
for (t=0; t<ENTROPY_NODES; ++t)
|
||||
{
|
||||
int prob;
|
||||
count = branch_ct[t][0] + branch_ct[t][1];
|
||||
count = count > count_sat ? count_sat : count;
|
||||
factor = (update_factor * count / count_sat);
|
||||
prob = ((int)cm->fc.pre_coef_probs_8x8[i][j][k][t] * (256-factor) +
|
||||
(int)coef_probs[t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.coef_probs_8x8[i][j][k][t] = 1;
|
||||
else if (prob > 255) cm->fc.coef_probs_8x8[i][j][k][t] = 255;
|
||||
else cm->fc.coef_probs_8x8[i][j][k][t] = prob;
|
||||
}
|
||||
}
|
||||
vp8_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
|
||||
coef_probs, branch_ct, cm->fc.coef_counts_8x8 [i][j][k],
|
||||
256, 1);
|
||||
for (t = 0; t < ENTROPY_NODES; ++t) {
|
||||
int prob;
|
||||
count = branch_ct[t][0] + branch_ct[t][1];
|
||||
count = count > count_sat ? count_sat : count;
|
||||
factor = (update_factor * count / count_sat);
|
||||
prob = ((int)cm->fc.pre_coef_probs_8x8[i][j][k][t] * (256 - factor) +
|
||||
(int)coef_probs[t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.coef_probs_8x8[i][j][k][t] = 1;
|
||||
else if (prob > 255) cm->fc.coef_probs_8x8[i][j][k][t] = 255;
|
||||
else cm->fc.coef_probs_8x8[i][j][k][t] = prob;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -43,12 +43,11 @@ extern const vp8_tree_index vp8_coef_tree[];
|
||||
|
||||
extern struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vp8_tree_p tree;
|
||||
const vp8_prob *prob;
|
||||
int Len;
|
||||
int base_val;
|
||||
typedef struct {
|
||||
vp8_tree_p tree;
|
||||
const vp8_prob *prob;
|
||||
int Len;
|
||||
int base_val;
|
||||
} vp8_extra_bit_struct;
|
||||
|
||||
extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
|
||||
@ -110,7 +109,7 @@ void vp8_default_coef_probs(struct VP8Common *);
|
||||
extern DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]);
|
||||
extern short vp8_default_zig_zag_mask[16];
|
||||
extern DECLARE_ALIGNED(64, const int, vp8_default_zig_zag1d_8x8[64]);
|
||||
extern short vp8_default_zig_zag_mask_8x8[64];//int64_t
|
||||
extern short vp8_default_zig_zag_mask_8x8[64];// int64_t
|
||||
void vp8_coef_tree_initialize(void);
|
||||
|
||||
#if CONFIG_ADAPTIVE_ENTROPY
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,12 +21,12 @@ extern vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS];
|
||||
|
||||
extern const int vp8_mbsplit_count [VP8_NUMMBSPLITS]; /* # of subsets */
|
||||
|
||||
extern const vp8_prob vp8_mbsplit_probs [VP8_NUMMBSPLITS-1];
|
||||
extern const vp8_prob vp8_mbsplit_probs [VP8_NUMMBSPLITS - 1];
|
||||
|
||||
extern int vp8_mv_cont(const int_mv *l, const int_mv *a);
|
||||
|
||||
extern const vp8_prob vp8_sub_mv_ref_prob [VP8_SUBMVREFS-1];
|
||||
extern const vp8_prob vp8_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS-1];
|
||||
extern const vp8_prob vp8_sub_mv_ref_prob [VP8_SUBMVREFS - 1];
|
||||
extern const vp8_prob vp8_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
|
||||
|
||||
|
||||
extern const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES];
|
||||
@ -60,11 +60,11 @@ void vp8_init_mbmode_probs(VP8_COMMON *x);
|
||||
extern void vp8_init_mode_contexts(VP8_COMMON *pc);
|
||||
extern void vp8_update_mode_context(VP8_COMMON *pc);;
|
||||
extern void vp8_accum_mv_refs(VP8_COMMON *pc,
|
||||
MB_PREDICTION_MODE m,
|
||||
const int ct[4]);
|
||||
MB_PREDICTION_MODE m,
|
||||
const int ct[4]);
|
||||
|
||||
void vp8_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES-1]);
|
||||
void vp8_kf_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1]);
|
||||
void vp8_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES - 1]);
|
||||
void vp8_kf_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES - 1]);
|
||||
|
||||
#if CONFIG_ADAPTIVE_ENTROPY
|
||||
void vp8_adapt_mode_probs(struct VP8Common *);
|
||||
|
@ -13,427 +13,403 @@
|
||||
#include "entropymv.h"
|
||||
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
const MV_CONTEXT_HP vp8_mv_update_probs_hp[2] =
|
||||
{
|
||||
{{
|
||||
237,
|
||||
246,
|
||||
253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 250, 250, 252, 254, 254, 254
|
||||
}},
|
||||
{{
|
||||
231,
|
||||
243,
|
||||
245, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 251, 251, 254, 254, 254, 254
|
||||
}}
|
||||
const MV_CONTEXT_HP vp8_mv_update_probs_hp[2] = {
|
||||
{{
|
||||
237,
|
||||
246,
|
||||
253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 250, 250, 252, 254, 254, 254
|
||||
}
|
||||
},
|
||||
{{
|
||||
231,
|
||||
243,
|
||||
245, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 251, 251, 254, 254, 254, 254
|
||||
}
|
||||
}
|
||||
};
|
||||
const MV_CONTEXT_HP vp8_default_mv_context_hp[2] =
|
||||
{
|
||||
{{
|
||||
/* row */
|
||||
162, /* is short */
|
||||
128, /* sign */
|
||||
220, 204, 180, 192, 192, 119, 192, 192, 180, 140, 192, 192, 224, 224, 224, /* short tree */
|
||||
128, 129, 132, 75, 145, 178, 206, 239, 254, 254, 254 /* long bits */
|
||||
}},
|
||||
{{
|
||||
/* same for column */
|
||||
164, /* is short */
|
||||
128,
|
||||
220, 204, 180, 192, 192, 119, 192, 192, 180, 140, 192, 192, 224, 224, 224, /* short tree */
|
||||
128, 130, 130, 74, 148, 180, 203, 236, 254, 254, 254 /* long bits */
|
||||
}}
|
||||
const MV_CONTEXT_HP vp8_default_mv_context_hp[2] = {
|
||||
{{
|
||||
/* row */
|
||||
162, /* is short */
|
||||
128, /* sign */
|
||||
220, 204, 180, 192, 192, 119, 192, 192, 180, 140, 192, 192, 224, 224, 224, /* short tree */
|
||||
128, 129, 132, 75, 145, 178, 206, 239, 254, 254, 254 /* long bits */
|
||||
}
|
||||
},
|
||||
{{
|
||||
/* same for column */
|
||||
164, /* is short */
|
||||
128,
|
||||
220, 204, 180, 192, 192, 119, 192, 192, 180, 140, 192, 192, 224, 224, 224, /* short tree */
|
||||
128, 130, 130, 74, 148, 180, 203, 236, 254, 254, 254 /* long bits */
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif /* CONFIG_HIGH_PRECISION_MV */
|
||||
|
||||
const MV_CONTEXT vp8_mv_update_probs[2] =
|
||||
{
|
||||
{{
|
||||
237,
|
||||
246,
|
||||
253, 253, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 250, 250, 252, 254, 254
|
||||
}},
|
||||
{{
|
||||
231,
|
||||
243,
|
||||
245, 253, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 251, 251, 254, 254, 254
|
||||
}}
|
||||
const MV_CONTEXT vp8_mv_update_probs[2] = {
|
||||
{{
|
||||
237,
|
||||
246,
|
||||
253, 253, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 250, 250, 252, 254, 254
|
||||
}
|
||||
},
|
||||
{{
|
||||
231,
|
||||
243,
|
||||
245, 253, 254, 254, 254, 254, 254,
|
||||
254, 254, 254, 254, 254, 251, 251, 254, 254, 254
|
||||
}
|
||||
}
|
||||
};
|
||||
const MV_CONTEXT vp8_default_mv_context[2] =
|
||||
{
|
||||
{{
|
||||
/* row */
|
||||
162, /* is short */
|
||||
128, /* sign */
|
||||
225, 146, 172, 147, 214, 39, 156, /* short tree */
|
||||
128, 129, 132, 75, 145, 178, 206, 239, 254, 254 /* long bits */
|
||||
}},
|
||||
{{
|
||||
/* same for column */
|
||||
164, /* is short */
|
||||
128,
|
||||
204, 170, 119, 235, 140, 230, 228,
|
||||
128, 130, 130, 74, 148, 180, 203, 236, 254, 254 /* long bits */
|
||||
}}
|
||||
const MV_CONTEXT vp8_default_mv_context[2] = {
|
||||
{{
|
||||
/* row */
|
||||
162, /* is short */
|
||||
128, /* sign */
|
||||
225, 146, 172, 147, 214, 39, 156, /* short tree */
|
||||
128, 129, 132, 75, 145, 178, 206, 239, 254, 254 /* long bits */
|
||||
}
|
||||
},
|
||||
{{
|
||||
/* same for column */
|
||||
164, /* is short */
|
||||
128,
|
||||
204, 170, 119, 235, 140, 230, 228,
|
||||
128, 130, 130, 74, 148, 180, 203, 236, 254, 254 /* long bits */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
const vp8_tree_index vp8_small_mvtree_hp [30] =
|
||||
{
|
||||
2, 16,
|
||||
4, 10,
|
||||
6, 8,
|
||||
-0, -1,
|
||||
-2, -3,
|
||||
12, 14,
|
||||
-4, -5,
|
||||
-6, -7,
|
||||
18, 24,
|
||||
20, 22,
|
||||
-8, -9,
|
||||
-10, -11,
|
||||
26, 28,
|
||||
-12, -13,
|
||||
-14, -15
|
||||
const vp8_tree_index vp8_small_mvtree_hp [30] = {
|
||||
2, 16,
|
||||
4, 10,
|
||||
6, 8,
|
||||
-0, -1,
|
||||
-2, -3,
|
||||
12, 14,
|
||||
-4, -5,
|
||||
-6, -7,
|
||||
18, 24,
|
||||
20, 22,
|
||||
-8, -9,
|
||||
-10, -11,
|
||||
26, 28,
|
||||
-12, -13,
|
||||
-14, -15
|
||||
};
|
||||
struct vp8_token_struct vp8_small_mvencodings_hp [16];
|
||||
#endif /* CONFIG_HIGH_PRECISION_MV */
|
||||
|
||||
const vp8_tree_index vp8_small_mvtree [14] =
|
||||
{
|
||||
2, 8,
|
||||
4, 6,
|
||||
-0, -1,
|
||||
-2, -3,
|
||||
10, 12,
|
||||
-4, -5,
|
||||
-6, -7
|
||||
const vp8_tree_index vp8_small_mvtree [14] = {
|
||||
2, 8,
|
||||
4, 6,
|
||||
-0, -1,
|
||||
-2, -3,
|
||||
10, 12,
|
||||
-4, -5,
|
||||
-6, -7
|
||||
};
|
||||
struct vp8_token_struct vp8_small_mvencodings [8];
|
||||
|
||||
|
||||
__inline static void calc_prob(vp8_prob *p, const unsigned int ct[2], int pbits)
|
||||
{
|
||||
const unsigned int tot = ct[0] + ct[1];
|
||||
if (tot)
|
||||
{
|
||||
const vp8_prob x = ((ct[0] * 255) / tot) & -(1<<(8-pbits));
|
||||
*p = x ? x : 1;
|
||||
}
|
||||
__inline static void calc_prob(vp8_prob *p, const unsigned int ct[2], int pbits) {
|
||||
const unsigned int tot = ct[0] + ct[1];
|
||||
if (tot) {
|
||||
const vp8_prob x = ((ct[0] * 255) / tot) & -(1 << (8 - pbits));
|
||||
*p = x ? x : 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void compute_component_probs(
|
||||
const unsigned int events [MVvals],
|
||||
vp8_prob Pnew [MVPcount],
|
||||
unsigned int is_short_ct[2],
|
||||
unsigned int sign_ct[2],
|
||||
unsigned int bit_ct [mvlong_width] [2],
|
||||
unsigned int short_ct [mvnum_short],
|
||||
unsigned int short_bct [mvnum_short-1] [2]
|
||||
)
|
||||
{
|
||||
is_short_ct[0] = is_short_ct[1] = 0;
|
||||
sign_ct[0] = sign_ct[1] = 0;
|
||||
vpx_memset(bit_ct, 0, sizeof(unsigned int)*mvlong_width*2);
|
||||
vpx_memset(short_ct, 0, sizeof(unsigned int)*mvnum_short);
|
||||
vpx_memset(short_bct, 0, sizeof(unsigned int)*(mvnum_short-1)*2);
|
||||
const unsigned int events [MVvals],
|
||||
vp8_prob Pnew [MVPcount],
|
||||
unsigned int is_short_ct[2],
|
||||
unsigned int sign_ct[2],
|
||||
unsigned int bit_ct [mvlong_width] [2],
|
||||
unsigned int short_ct [mvnum_short],
|
||||
unsigned int short_bct [mvnum_short - 1] [2]
|
||||
) {
|
||||
is_short_ct[0] = is_short_ct[1] = 0;
|
||||
sign_ct[0] = sign_ct[1] = 0;
|
||||
vpx_memset(bit_ct, 0, sizeof(unsigned int)*mvlong_width * 2);
|
||||
vpx_memset(short_ct, 0, sizeof(unsigned int)*mvnum_short);
|
||||
vpx_memset(short_bct, 0, sizeof(unsigned int) * (mvnum_short - 1) * 2);
|
||||
|
||||
{
|
||||
const int c = events [mv_max];
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [0] += c; // Magnitude distribution
|
||||
}
|
||||
{
|
||||
int j = 1;
|
||||
do
|
||||
{
|
||||
const int c1 = events [mv_max + j]; //positive
|
||||
const int c2 = events [mv_max - j]; //negative
|
||||
const int c = c1 + c2;
|
||||
int a = j;
|
||||
{
|
||||
const int c = events [mv_max];
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [0] += c; // Magnitude distribution
|
||||
}
|
||||
{
|
||||
int j = 1;
|
||||
do {
|
||||
const int c1 = events [mv_max + j]; // positive
|
||||
const int c2 = events [mv_max - j]; // negative
|
||||
const int c = c1 + c2;
|
||||
int a = j;
|
||||
|
||||
sign_ct [0] += c1;
|
||||
sign_ct [1] += c2;
|
||||
sign_ct [0] += c1;
|
||||
sign_ct [1] += c2;
|
||||
|
||||
if (a < mvnum_short)
|
||||
{
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [a] += c; // Magnitude distribution
|
||||
}
|
||||
else
|
||||
{
|
||||
int k = mvlong_width - 1;
|
||||
is_short_ct [1] += c; // Long vector
|
||||
|
||||
do
|
||||
bit_ct [k] [(a >> k) & 1] += c;
|
||||
|
||||
while (--k >= 0);
|
||||
}
|
||||
}
|
||||
while (++j <= mv_max);
|
||||
}
|
||||
calc_prob(Pnew + mvpis_short, is_short_ct, 8);
|
||||
|
||||
calc_prob(Pnew + MVPsign, sign_ct, 8);
|
||||
|
||||
{
|
||||
vp8_prob p [mvnum_short - 1]; /* actually only need branch ct */
|
||||
int j = 0;
|
||||
|
||||
vp8_tree_probs_from_distribution(
|
||||
mvnum_short, vp8_small_mvencodings, vp8_small_mvtree,
|
||||
p, short_bct, short_ct,
|
||||
256, 1
|
||||
);
|
||||
if (a < mvnum_short) {
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [a] += c; // Magnitude distribution
|
||||
} else {
|
||||
int k = mvlong_width - 1;
|
||||
is_short_ct [1] += c; // Long vector
|
||||
|
||||
do
|
||||
calc_prob(Pnew + MVPshort + j, short_bct[j], 8);
|
||||
while (++j < mvnum_short - 1);
|
||||
}
|
||||
bit_ct [k] [(a >> k) & 1] += c;
|
||||
|
||||
{
|
||||
int j = 0;
|
||||
do
|
||||
calc_prob(Pnew + MVPbits + j, bit_ct[j], 8);
|
||||
while (++j < mvlong_width);
|
||||
}
|
||||
while (--k >= 0);
|
||||
}
|
||||
} while (++j <= mv_max);
|
||||
}
|
||||
calc_prob(Pnew + mvpis_short, is_short_ct, 8);
|
||||
|
||||
calc_prob(Pnew + MVPsign, sign_ct, 8);
|
||||
|
||||
{
|
||||
vp8_prob p [mvnum_short - 1]; /* actually only need branch ct */
|
||||
int j = 0;
|
||||
|
||||
vp8_tree_probs_from_distribution(
|
||||
mvnum_short, vp8_small_mvencodings, vp8_small_mvtree,
|
||||
p, short_bct, short_ct,
|
||||
256, 1
|
||||
);
|
||||
|
||||
do
|
||||
calc_prob(Pnew + MVPshort + j, short_bct[j], 8);
|
||||
while (++j < mvnum_short - 1);
|
||||
}
|
||||
|
||||
{
|
||||
int j = 0;
|
||||
do
|
||||
calc_prob(Pnew + MVPbits + j, bit_ct[j], 8);
|
||||
while (++j < mvlong_width);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
static void compute_component_probs_hp(
|
||||
const unsigned int events [MVvals_hp],
|
||||
vp8_prob Pnew [MVPcount_hp],
|
||||
unsigned int is_short_ct[2],
|
||||
unsigned int sign_ct[2],
|
||||
unsigned int bit_ct [mvlong_width_hp] [2],
|
||||
unsigned int short_ct [mvnum_short_hp],
|
||||
unsigned int short_bct [mvnum_short_hp-1] [2]
|
||||
)
|
||||
{
|
||||
is_short_ct[0] = is_short_ct[1] = 0;
|
||||
sign_ct[0] = sign_ct[1] = 0;
|
||||
vpx_memset(bit_ct, 0, sizeof(unsigned int)*mvlong_width_hp*2);
|
||||
vpx_memset(short_ct, 0, sizeof(unsigned int)*mvnum_short_hp);
|
||||
vpx_memset(short_bct, 0, sizeof(unsigned int)*(mvnum_short_hp-1)*2);
|
||||
const unsigned int events [MVvals_hp],
|
||||
vp8_prob Pnew [MVPcount_hp],
|
||||
unsigned int is_short_ct[2],
|
||||
unsigned int sign_ct[2],
|
||||
unsigned int bit_ct [mvlong_width_hp] [2],
|
||||
unsigned int short_ct [mvnum_short_hp],
|
||||
unsigned int short_bct [mvnum_short_hp - 1] [2]
|
||||
) {
|
||||
is_short_ct[0] = is_short_ct[1] = 0;
|
||||
sign_ct[0] = sign_ct[1] = 0;
|
||||
vpx_memset(bit_ct, 0, sizeof(unsigned int)*mvlong_width_hp * 2);
|
||||
vpx_memset(short_ct, 0, sizeof(unsigned int)*mvnum_short_hp);
|
||||
vpx_memset(short_bct, 0, sizeof(unsigned int) * (mvnum_short_hp - 1) * 2);
|
||||
|
||||
{
|
||||
const int c = events [mv_max_hp];
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [0] += c; // Magnitude distribution
|
||||
}
|
||||
{
|
||||
int j = 1;
|
||||
do
|
||||
{
|
||||
const int c1 = events [mv_max_hp + j]; //positive
|
||||
const int c2 = events [mv_max_hp - j]; //negative
|
||||
const int c = c1 + c2;
|
||||
int a = j;
|
||||
{
|
||||
const int c = events [mv_max_hp];
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [0] += c; // Magnitude distribution
|
||||
}
|
||||
{
|
||||
int j = 1;
|
||||
do {
|
||||
const int c1 = events [mv_max_hp + j]; // positive
|
||||
const int c2 = events [mv_max_hp - j]; // negative
|
||||
const int c = c1 + c2;
|
||||
int a = j;
|
||||
|
||||
sign_ct [0] += c1;
|
||||
sign_ct [1] += c2;
|
||||
sign_ct [0] += c1;
|
||||
sign_ct [1] += c2;
|
||||
|
||||
if (a < mvnum_short_hp)
|
||||
{
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [a] += c; // Magnitude distribution
|
||||
}
|
||||
else
|
||||
{
|
||||
int k = mvlong_width_hp - 1;
|
||||
is_short_ct [1] += c; // Long vector
|
||||
|
||||
do
|
||||
bit_ct [k] [(a >> k) & 1] += c;
|
||||
|
||||
while (--k >= 0);
|
||||
}
|
||||
}
|
||||
while (++j <= mv_max_hp);
|
||||
}
|
||||
calc_prob(Pnew + mvpis_short_hp, is_short_ct, 8);
|
||||
|
||||
calc_prob(Pnew + MVPsign_hp, sign_ct, 8);
|
||||
|
||||
{
|
||||
vp8_prob p [mvnum_short_hp - 1]; /* actually only need branch ct */
|
||||
int j = 0;
|
||||
|
||||
vp8_tree_probs_from_distribution(
|
||||
mvnum_short_hp, vp8_small_mvencodings_hp, vp8_small_mvtree_hp,
|
||||
p, short_bct, short_ct,
|
||||
256, 1
|
||||
);
|
||||
if (a < mvnum_short_hp) {
|
||||
is_short_ct [0] += c; // Short vector
|
||||
short_ct [a] += c; // Magnitude distribution
|
||||
} else {
|
||||
int k = mvlong_width_hp - 1;
|
||||
is_short_ct [1] += c; // Long vector
|
||||
|
||||
do
|
||||
calc_prob(Pnew + MVPshort_hp + j, short_bct[j], 8);
|
||||
while (++j < mvnum_short_hp - 1);
|
||||
}
|
||||
bit_ct [k] [(a >> k) & 1] += c;
|
||||
|
||||
{
|
||||
int j = 0;
|
||||
do
|
||||
calc_prob(Pnew + MVPbits_hp + j, bit_ct[j], 8);
|
||||
while (++j < mvlong_width_hp);
|
||||
}
|
||||
while (--k >= 0);
|
||||
}
|
||||
} while (++j <= mv_max_hp);
|
||||
}
|
||||
calc_prob(Pnew + mvpis_short_hp, is_short_ct, 8);
|
||||
|
||||
calc_prob(Pnew + MVPsign_hp, sign_ct, 8);
|
||||
|
||||
{
|
||||
vp8_prob p [mvnum_short_hp - 1]; /* actually only need branch ct */
|
||||
int j = 0;
|
||||
|
||||
vp8_tree_probs_from_distribution(
|
||||
mvnum_short_hp, vp8_small_mvencodings_hp, vp8_small_mvtree_hp,
|
||||
p, short_bct, short_ct,
|
||||
256, 1
|
||||
);
|
||||
|
||||
do
|
||||
calc_prob(Pnew + MVPshort_hp + j, short_bct[j], 8);
|
||||
while (++j < mvnum_short_hp - 1);
|
||||
}
|
||||
|
||||
{
|
||||
int j = 0;
|
||||
do
|
||||
calc_prob(Pnew + MVPbits_hp + j, bit_ct[j], 8);
|
||||
while (++j < mvlong_width_hp);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_HIGH_PRECISION_MV */
|
||||
|
||||
void vp8_entropy_mv_init()
|
||||
{
|
||||
vp8_tokens_from_tree(vp8_small_mvencodings, vp8_small_mvtree);
|
||||
void vp8_entropy_mv_init() {
|
||||
vp8_tokens_from_tree(vp8_small_mvencodings, vp8_small_mvtree);
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
vp8_tokens_from_tree(vp8_small_mvencodings_hp, vp8_small_mvtree_hp);
|
||||
vp8_tokens_from_tree(vp8_small_mvencodings_hp, vp8_small_mvtree_hp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_ADAPTIVE_ENTROPY
|
||||
//#define MV_COUNT_TESTING
|
||||
// #define MV_COUNT_TESTING
|
||||
#define MV_COUNT_SAT 16
|
||||
#define MV_MAX_UPDATE_FACTOR 128
|
||||
void vp8_adapt_mv_probs(VP8_COMMON *cm)
|
||||
{
|
||||
int i, t, count, factor;
|
||||
void vp8_adapt_mv_probs(VP8_COMMON *cm) {
|
||||
int i, t, count, factor;
|
||||
#ifdef MV_COUNT_TESTING
|
||||
printf("static const unsigned int\nMVcount[2][MVvals]={\n");
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
printf(" { ");
|
||||
for (t = 0; t < MVvals; t++)
|
||||
{
|
||||
printf("%d, ", cm->fc.MVcount[i][t]);
|
||||
if (t%16 == 15 && t!=MVvals-1) printf("\n ");
|
||||
}
|
||||
printf("},\n");
|
||||
printf("static const unsigned int\nMVcount[2][MVvals]={\n");
|
||||
for (i = 0; i < 2; ++i) {
|
||||
printf(" { ");
|
||||
for (t = 0; t < MVvals; t++) {
|
||||
printf("%d, ", cm->fc.MVcount[i][t]);
|
||||
if (t % 16 == 15 && t != MVvals - 1) printf("\n ");
|
||||
}
|
||||
printf("};\n");
|
||||
printf("},\n");
|
||||
}
|
||||
printf("};\n");
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
printf("static const unsigned int\nMVcount_hp[2][MVvals_hp]={\n");
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
printf(" { ");
|
||||
for (t = 0; t < MVvals_hp; t++)
|
||||
{
|
||||
printf("%d, ", cm->fc.MVcount_hp[i][t]);
|
||||
if (t%16 == 15 && t!=MVvals_hp-1) printf("\n ");
|
||||
}
|
||||
printf("},\n");
|
||||
printf("static const unsigned int\nMVcount_hp[2][MVvals_hp]={\n");
|
||||
for (i = 0; i < 2; ++i) {
|
||||
printf(" { ");
|
||||
for (t = 0; t < MVvals_hp; t++) {
|
||||
printf("%d, ", cm->fc.MVcount_hp[i][t]);
|
||||
if (t % 16 == 15 && t != MVvals_hp - 1) printf("\n ");
|
||||
}
|
||||
printf("};\n");
|
||||
printf("},\n");
|
||||
}
|
||||
printf("};\n");
|
||||
#endif
|
||||
#endif /* MV_COUNT_TESTING */
|
||||
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
int prob;
|
||||
unsigned int is_short_ct[2];
|
||||
unsigned int sign_ct[2];
|
||||
unsigned int bit_ct [mvlong_width] [2];
|
||||
unsigned int short_ct [mvnum_short];
|
||||
unsigned int short_bct [mvnum_short-1] [2];
|
||||
vp8_prob Pnew [MVPcount];
|
||||
compute_component_probs(cm->fc.MVcount[i], Pnew,
|
||||
is_short_ct, sign_ct,
|
||||
bit_ct, short_ct, short_bct);
|
||||
count = is_short_ct[0] + is_short_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[mvpis_short] * (256-factor) +
|
||||
(int)Pnew[mvpis_short] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[mvpis_short] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[mvpis_short] = 255;
|
||||
else cm->fc.mvc[i].prob[mvpis_short] = prob;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
int prob;
|
||||
unsigned int is_short_ct[2];
|
||||
unsigned int sign_ct[2];
|
||||
unsigned int bit_ct [mvlong_width] [2];
|
||||
unsigned int short_ct [mvnum_short];
|
||||
unsigned int short_bct [mvnum_short - 1] [2];
|
||||
vp8_prob Pnew [MVPcount];
|
||||
compute_component_probs(cm->fc.MVcount[i], Pnew,
|
||||
is_short_ct, sign_ct,
|
||||
bit_ct, short_ct, short_bct);
|
||||
count = is_short_ct[0] + is_short_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[mvpis_short] * (256 - factor) +
|
||||
(int)Pnew[mvpis_short] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[mvpis_short] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[mvpis_short] = 255;
|
||||
else cm->fc.mvc[i].prob[mvpis_short] = prob;
|
||||
|
||||
count = sign_ct[0] + sign_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[MVPsign] * (256-factor) +
|
||||
(int)Pnew[MVPsign] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[MVPsign] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[MVPsign] = 255;
|
||||
else cm->fc.mvc[i].prob[MVPsign] = prob;
|
||||
count = sign_ct[0] + sign_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[MVPsign] * (256 - factor) +
|
||||
(int)Pnew[MVPsign] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[MVPsign] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[MVPsign] = 255;
|
||||
else cm->fc.mvc[i].prob[MVPsign] = prob;
|
||||
|
||||
for (t = 0; t < mvnum_short - 1; ++t)
|
||||
{
|
||||
count = short_bct[t][0] + short_bct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[MVPshort+t] * (256-factor) +
|
||||
(int)Pnew[MVPshort+t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[MVPshort+t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[MVPshort+t] = 255;
|
||||
else cm->fc.mvc[i].prob[MVPshort+t] = prob;
|
||||
}
|
||||
for (t = 0; t < mvlong_width; ++t)
|
||||
{
|
||||
count = bit_ct[t][0] + bit_ct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[MVPbits+t] * (256-factor) +
|
||||
(int)Pnew[MVPbits+t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[MVPbits+t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[MVPbits+t] = 255;
|
||||
else cm->fc.mvc[i].prob[MVPbits+t] = prob;
|
||||
}
|
||||
for (t = 0; t < mvnum_short - 1; ++t) {
|
||||
count = short_bct[t][0] + short_bct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[MVPshort + t] * (256 - factor) +
|
||||
(int)Pnew[MVPshort + t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[MVPshort + t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[MVPshort + t] = 255;
|
||||
else cm->fc.mvc[i].prob[MVPshort + t] = prob;
|
||||
}
|
||||
for (t = 0; t < mvlong_width; ++t) {
|
||||
count = bit_ct[t][0] + bit_ct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc[i].prob[MVPbits + t] * (256 - factor) +
|
||||
(int)Pnew[MVPbits + t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc[i].prob[MVPbits + t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc[i].prob[MVPbits + t] = 255;
|
||||
else cm->fc.mvc[i].prob[MVPbits + t] = prob;
|
||||
}
|
||||
}
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
int prob;
|
||||
unsigned int is_short_ct[2];
|
||||
unsigned int sign_ct[2];
|
||||
unsigned int bit_ct [mvlong_width_hp] [2];
|
||||
unsigned int short_ct [mvnum_short_hp];
|
||||
unsigned int short_bct [mvnum_short_hp-1] [2];
|
||||
vp8_prob Pnew [MVPcount_hp];
|
||||
compute_component_probs_hp(cm->fc.MVcount_hp[i], Pnew,
|
||||
is_short_ct, sign_ct,
|
||||
bit_ct, short_ct, short_bct);
|
||||
count = is_short_ct[0] + is_short_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[mvpis_short_hp] * (256-factor) +
|
||||
(int)Pnew[mvpis_short_hp] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[mvpis_short_hp] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[mvpis_short_hp] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[mvpis_short_hp] = prob;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
int prob;
|
||||
unsigned int is_short_ct[2];
|
||||
unsigned int sign_ct[2];
|
||||
unsigned int bit_ct [mvlong_width_hp] [2];
|
||||
unsigned int short_ct [mvnum_short_hp];
|
||||
unsigned int short_bct [mvnum_short_hp - 1] [2];
|
||||
vp8_prob Pnew [MVPcount_hp];
|
||||
compute_component_probs_hp(cm->fc.MVcount_hp[i], Pnew,
|
||||
is_short_ct, sign_ct,
|
||||
bit_ct, short_ct, short_bct);
|
||||
count = is_short_ct[0] + is_short_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[mvpis_short_hp] * (256 - factor) +
|
||||
(int)Pnew[mvpis_short_hp] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[mvpis_short_hp] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[mvpis_short_hp] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[mvpis_short_hp] = prob;
|
||||
|
||||
count = sign_ct[0] + sign_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[MVPsign_hp] * (256-factor) +
|
||||
(int)Pnew[MVPsign_hp] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[MVPsign_hp] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[MVPsign_hp] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[MVPsign_hp] = prob;
|
||||
count = sign_ct[0] + sign_ct[1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[MVPsign_hp] * (256 - factor) +
|
||||
(int)Pnew[MVPsign_hp] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[MVPsign_hp] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[MVPsign_hp] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[MVPsign_hp] = prob;
|
||||
|
||||
for (t = 0; t < mvnum_short_hp - 1; ++t)
|
||||
{
|
||||
count = short_bct[t][0] + short_bct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[MVPshort_hp+t] * (256-factor) +
|
||||
(int)Pnew[MVPshort_hp+t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[MVPshort_hp+t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[MVPshort_hp+t] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[MVPshort_hp+t] = prob;
|
||||
}
|
||||
for (t = 0; t < mvlong_width_hp; ++t)
|
||||
{
|
||||
count = bit_ct[t][0] + bit_ct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[MVPbits_hp+t] * (256-factor) +
|
||||
(int)Pnew[MVPbits_hp+t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[MVPbits_hp+t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[MVPbits_hp+t] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[MVPbits_hp+t] = prob;
|
||||
}
|
||||
for (t = 0; t < mvnum_short_hp - 1; ++t) {
|
||||
count = short_bct[t][0] + short_bct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[MVPshort_hp + t] * (256 - factor) +
|
||||
(int)Pnew[MVPshort_hp + t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[MVPshort_hp + t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[MVPshort_hp + t] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[MVPshort_hp + t] = prob;
|
||||
}
|
||||
for (t = 0; t < mvlong_width_hp; ++t) {
|
||||
count = bit_ct[t][0] + bit_ct[t][1];
|
||||
count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
|
||||
factor = (MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
|
||||
prob = ((int)cm->fc.pre_mvc_hp[i].prob[MVPbits_hp + t] * (256 - factor) +
|
||||
(int)Pnew[MVPbits_hp + t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.mvc_hp[i].prob[MVPbits_hp + t] = 1;
|
||||
else if (prob > 255) cm->fc.mvc_hp[i].prob[MVPbits_hp + t] = 255;
|
||||
else cm->fc.mvc_hp[i].prob[MVPbits_hp + t] = prob;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_ADAPTIVE_ENTROPY */
|
||||
|
@ -15,59 +15,55 @@
|
||||
#include "treecoder.h"
|
||||
#include "vpx_config.h"
|
||||
|
||||
enum
|
||||
{
|
||||
mv_max = 1023, /* max absolute value of a MV component */
|
||||
MVvals = (2 * mv_max) + 1, /* # possible values "" */
|
||||
mvlong_width = 10, /* Large MVs have 9 bit magnitudes */
|
||||
mvnum_short = 8, /* magnitudes 0 through 7 */
|
||||
mvnum_short_bits = 3, /* number of bits for short mvs */
|
||||
enum {
|
||||
mv_max = 1023, /* max absolute value of a MV component */
|
||||
MVvals = (2 * mv_max) + 1, /* # possible values "" */
|
||||
mvlong_width = 10, /* Large MVs have 9 bit magnitudes */
|
||||
mvnum_short = 8, /* magnitudes 0 through 7 */
|
||||
mvnum_short_bits = 3, /* number of bits for short mvs */
|
||||
|
||||
mvfp_max = 255, /* max absolute value of a full pixel MV component */
|
||||
MVfpvals = (2 * mvfp_max) + 1, /* # possible full pixel MV values */
|
||||
mvfp_max = 255, /* max absolute value of a full pixel MV component */
|
||||
MVfpvals = (2 * mvfp_max) + 1, /* # possible full pixel MV values */
|
||||
|
||||
/* probability offsets for coding each MV component */
|
||||
/* probability offsets for coding each MV component */
|
||||
|
||||
mvpis_short = 0, /* short (<= 7) vs long (>= 8) */
|
||||
MVPsign, /* sign for non-zero */
|
||||
MVPshort, /* 8 short values = 7-position tree */
|
||||
mvpis_short = 0, /* short (<= 7) vs long (>= 8) */
|
||||
MVPsign, /* sign for non-zero */
|
||||
MVPshort, /* 8 short values = 7-position tree */
|
||||
|
||||
MVPbits = MVPshort + mvnum_short - 1, /* mvlong_width long value bits */
|
||||
MVPcount = MVPbits + mvlong_width /* (with independent probabilities) */
|
||||
MVPbits = MVPshort + mvnum_short - 1, /* mvlong_width long value bits */
|
||||
MVPcount = MVPbits + mvlong_width /* (with independent probabilities) */
|
||||
};
|
||||
|
||||
typedef struct mv_context
|
||||
{
|
||||
vp8_prob prob[MVPcount]; /* often come in row, col pairs */
|
||||
typedef struct mv_context {
|
||||
vp8_prob prob[MVPcount]; /* often come in row, col pairs */
|
||||
} MV_CONTEXT;
|
||||
|
||||
extern const MV_CONTEXT vp8_mv_update_probs[2], vp8_default_mv_context[2];
|
||||
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
enum
|
||||
{
|
||||
mv_max_hp = 2047, /* max absolute value of a MV component */
|
||||
MVvals_hp = (2 * mv_max_hp) + 1, /* # possible values "" */
|
||||
mvlong_width_hp = 11, /* Large MVs have 9 bit magnitudes */
|
||||
mvnum_short_hp = 16, /* magnitudes 0 through 15 */
|
||||
mvnum_short_bits_hp = 4, /* number of bits for short mvs */
|
||||
enum {
|
||||
mv_max_hp = 2047, /* max absolute value of a MV component */
|
||||
MVvals_hp = (2 * mv_max_hp) + 1, /* # possible values "" */
|
||||
mvlong_width_hp = 11, /* Large MVs have 9 bit magnitudes */
|
||||
mvnum_short_hp = 16, /* magnitudes 0 through 15 */
|
||||
mvnum_short_bits_hp = 4, /* number of bits for short mvs */
|
||||
|
||||
mvfp_max_hp = 255, /* max absolute value of a full pixel MV component */
|
||||
MVfpvals_hp = (2 * mvfp_max_hp) + 1, /* # possible full pixel MV values */
|
||||
mvfp_max_hp = 255, /* max absolute value of a full pixel MV component */
|
||||
MVfpvals_hp = (2 * mvfp_max_hp) + 1, /* # possible full pixel MV values */
|
||||
|
||||
/* probability offsets for coding each MV component */
|
||||
/* probability offsets for coding each MV component */
|
||||
|
||||
mvpis_short_hp = 0, /* short (<= 7) vs long (>= 8) */
|
||||
MVPsign_hp, /* sign for non-zero */
|
||||
MVPshort_hp, /* 8 short values = 7-position tree */
|
||||
mvpis_short_hp = 0, /* short (<= 7) vs long (>= 8) */
|
||||
MVPsign_hp, /* sign for non-zero */
|
||||
MVPshort_hp, /* 8 short values = 7-position tree */
|
||||
|
||||
MVPbits_hp = MVPshort_hp + mvnum_short_hp - 1, /* mvlong_width long value bits */
|
||||
MVPcount_hp = MVPbits_hp + mvlong_width_hp /* (with independent probabilities) */
|
||||
MVPbits_hp = MVPshort_hp + mvnum_short_hp - 1, /* mvlong_width long value bits */
|
||||
MVPcount_hp = MVPbits_hp + mvlong_width_hp /* (with independent probabilities) */
|
||||
};
|
||||
|
||||
typedef struct mv_context_hp
|
||||
{
|
||||
vp8_prob prob[MVPcount_hp]; /* often come in row, col pairs */
|
||||
typedef struct mv_context_hp {
|
||||
vp8_prob prob[MVPcount_hp]; /* often come in row, col pairs */
|
||||
} MV_CONTEXT_HP;
|
||||
|
||||
extern const MV_CONTEXT_HP vp8_mv_update_probs_hp[2], vp8_default_mv_context_hp[2];
|
||||
|
@ -15,171 +15,162 @@
|
||||
|
||||
static void copy_and_extend_plane
|
||||
(
|
||||
unsigned char *s, /* source */
|
||||
int sp, /* source pitch */
|
||||
unsigned char *d, /* destination */
|
||||
int dp, /* destination pitch */
|
||||
int h, /* height */
|
||||
int w, /* width */
|
||||
int et, /* extend top border */
|
||||
int el, /* extend left border */
|
||||
int eb, /* extend bottom border */
|
||||
int er /* extend right border */
|
||||
)
|
||||
{
|
||||
int i;
|
||||
unsigned char *src_ptr1, *src_ptr2;
|
||||
unsigned char *dest_ptr1, *dest_ptr2;
|
||||
int linesize;
|
||||
unsigned char *s, /* source */
|
||||
int sp, /* source pitch */
|
||||
unsigned char *d, /* destination */
|
||||
int dp, /* destination pitch */
|
||||
int h, /* height */
|
||||
int w, /* width */
|
||||
int et, /* extend top border */
|
||||
int el, /* extend left border */
|
||||
int eb, /* extend bottom border */
|
||||
int er /* extend right border */
|
||||
) {
|
||||
int i;
|
||||
unsigned char *src_ptr1, *src_ptr2;
|
||||
unsigned char *dest_ptr1, *dest_ptr2;
|
||||
int linesize;
|
||||
|
||||
/* copy the left and right most columns out */
|
||||
src_ptr1 = s;
|
||||
src_ptr2 = s + w - 1;
|
||||
dest_ptr1 = d - el;
|
||||
dest_ptr2 = d + w;
|
||||
/* copy the left and right most columns out */
|
||||
src_ptr1 = s;
|
||||
src_ptr2 = s + w - 1;
|
||||
dest_ptr1 = d - el;
|
||||
dest_ptr2 = d + w;
|
||||
|
||||
for (i = 0; i < h; i++)
|
||||
{
|
||||
vpx_memset(dest_ptr1, src_ptr1[0], el);
|
||||
vpx_memcpy(dest_ptr1 + el, src_ptr1, w);
|
||||
vpx_memset(dest_ptr2, src_ptr2[0], er);
|
||||
src_ptr1 += sp;
|
||||
src_ptr2 += sp;
|
||||
dest_ptr1 += dp;
|
||||
dest_ptr2 += dp;
|
||||
}
|
||||
for (i = 0; i < h; i++) {
|
||||
vpx_memset(dest_ptr1, src_ptr1[0], el);
|
||||
vpx_memcpy(dest_ptr1 + el, src_ptr1, w);
|
||||
vpx_memset(dest_ptr2, src_ptr2[0], er);
|
||||
src_ptr1 += sp;
|
||||
src_ptr2 += sp;
|
||||
dest_ptr1 += dp;
|
||||
dest_ptr2 += dp;
|
||||
}
|
||||
|
||||
/* Now copy the top and bottom lines into each line of the respective
|
||||
* borders
|
||||
*/
|
||||
src_ptr1 = d - el;
|
||||
src_ptr2 = d + dp * (h - 1) - el;
|
||||
dest_ptr1 = d + dp * (-et) - el;
|
||||
dest_ptr2 = d + dp * (h) - el;
|
||||
linesize = el + er + w;
|
||||
/* Now copy the top and bottom lines into each line of the respective
|
||||
* borders
|
||||
*/
|
||||
src_ptr1 = d - el;
|
||||
src_ptr2 = d + dp * (h - 1) - el;
|
||||
dest_ptr1 = d + dp * (-et) - el;
|
||||
dest_ptr2 = d + dp * (h) - el;
|
||||
linesize = el + er + w;
|
||||
|
||||
for (i = 0; i < et; i++)
|
||||
{
|
||||
vpx_memcpy(dest_ptr1, src_ptr1, linesize);
|
||||
dest_ptr1 += dp;
|
||||
}
|
||||
for (i = 0; i < et; i++) {
|
||||
vpx_memcpy(dest_ptr1, src_ptr1, linesize);
|
||||
dest_ptr1 += dp;
|
||||
}
|
||||
|
||||
for (i = 0; i < eb; i++)
|
||||
{
|
||||
vpx_memcpy(dest_ptr2, src_ptr2, linesize);
|
||||
dest_ptr2 += dp;
|
||||
}
|
||||
for (i = 0; i < eb; i++) {
|
||||
vpx_memcpy(dest_ptr2, src_ptr2, linesize);
|
||||
dest_ptr2 += dp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp8_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst)
|
||||
{
|
||||
int et = dst->border;
|
||||
int el = dst->border;
|
||||
int eb = dst->border + dst->y_height - src->y_height;
|
||||
int er = dst->border + dst->y_width - src->y_width;
|
||||
YV12_BUFFER_CONFIG *dst) {
|
||||
int et = dst->border;
|
||||
int el = dst->border;
|
||||
int eb = dst->border + dst->y_height - src->y_height;
|
||||
int er = dst->border + dst->y_width - src->y_width;
|
||||
|
||||
copy_and_extend_plane(src->y_buffer, src->y_stride,
|
||||
dst->y_buffer, dst->y_stride,
|
||||
src->y_height, src->y_width,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->y_buffer, src->y_stride,
|
||||
dst->y_buffer, dst->y_stride,
|
||||
src->y_height, src->y_width,
|
||||
et, el, eb, er);
|
||||
|
||||
et = dst->border >> 1;
|
||||
el = dst->border >> 1;
|
||||
eb = (dst->border >> 1) + dst->uv_height - src->uv_height;
|
||||
er = (dst->border >> 1) + dst->uv_width - src->uv_width;
|
||||
et = dst->border >> 1;
|
||||
el = dst->border >> 1;
|
||||
eb = (dst->border >> 1) + dst->uv_height - src->uv_height;
|
||||
er = (dst->border >> 1) + dst->uv_width - src->uv_width;
|
||||
|
||||
copy_and_extend_plane(src->u_buffer, src->uv_stride,
|
||||
dst->u_buffer, dst->uv_stride,
|
||||
src->uv_height, src->uv_width,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->u_buffer, src->uv_stride,
|
||||
dst->u_buffer, dst->uv_stride,
|
||||
src->uv_height, src->uv_width,
|
||||
et, el, eb, er);
|
||||
|
||||
copy_and_extend_plane(src->v_buffer, src->uv_stride,
|
||||
dst->v_buffer, dst->uv_stride,
|
||||
src->uv_height, src->uv_width,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->v_buffer, src->uv_stride,
|
||||
dst->v_buffer, dst->uv_stride,
|
||||
src->uv_height, src->uv_width,
|
||||
et, el, eb, er);
|
||||
}
|
||||
|
||||
|
||||
void vp8_copy_and_extend_frame_with_rect(YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst,
|
||||
int srcy, int srcx,
|
||||
int srch, int srcw)
|
||||
{
|
||||
int et = dst->border;
|
||||
int el = dst->border;
|
||||
int eb = dst->border + dst->y_height - src->y_height;
|
||||
int er = dst->border + dst->y_width - src->y_width;
|
||||
int src_y_offset = srcy * src->y_stride + srcx;
|
||||
int dst_y_offset = srcy * dst->y_stride + srcx;
|
||||
int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1);
|
||||
int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1);
|
||||
int srch, int srcw) {
|
||||
int et = dst->border;
|
||||
int el = dst->border;
|
||||
int eb = dst->border + dst->y_height - src->y_height;
|
||||
int er = dst->border + dst->y_width - src->y_width;
|
||||
int src_y_offset = srcy * src->y_stride + srcx;
|
||||
int dst_y_offset = srcy * dst->y_stride + srcx;
|
||||
int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1);
|
||||
int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1);
|
||||
|
||||
// If the side is not touching the bounder then don't extend.
|
||||
if (srcy)
|
||||
et = 0;
|
||||
if (srcx)
|
||||
el = 0;
|
||||
if (srcy + srch != src->y_height)
|
||||
eb = 0;
|
||||
if (srcx + srcw != src->y_width)
|
||||
er = 0;
|
||||
// If the side is not touching the bounder then don't extend.
|
||||
if (srcy)
|
||||
et = 0;
|
||||
if (srcx)
|
||||
el = 0;
|
||||
if (srcy + srch != src->y_height)
|
||||
eb = 0;
|
||||
if (srcx + srcw != src->y_width)
|
||||
er = 0;
|
||||
|
||||
copy_and_extend_plane(src->y_buffer + src_y_offset,
|
||||
src->y_stride,
|
||||
dst->y_buffer + dst_y_offset,
|
||||
dst->y_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->y_buffer + src_y_offset,
|
||||
src->y_stride,
|
||||
dst->y_buffer + dst_y_offset,
|
||||
dst->y_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
|
||||
et = (et + 1) >> 1;
|
||||
el = (el + 1) >> 1;
|
||||
eb = (eb + 1) >> 1;
|
||||
er = (er + 1) >> 1;
|
||||
srch = (srch + 1) >> 1;
|
||||
srcw = (srcw + 1) >> 1;
|
||||
et = (et + 1) >> 1;
|
||||
el = (el + 1) >> 1;
|
||||
eb = (eb + 1) >> 1;
|
||||
er = (er + 1) >> 1;
|
||||
srch = (srch + 1) >> 1;
|
||||
srcw = (srcw + 1) >> 1;
|
||||
|
||||
copy_and_extend_plane(src->u_buffer + src_uv_offset,
|
||||
src->uv_stride,
|
||||
dst->u_buffer + dst_uv_offset,
|
||||
dst->uv_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->u_buffer + src_uv_offset,
|
||||
src->uv_stride,
|
||||
dst->u_buffer + dst_uv_offset,
|
||||
dst->uv_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
|
||||
copy_and_extend_plane(src->v_buffer + src_uv_offset,
|
||||
src->uv_stride,
|
||||
dst->v_buffer + dst_uv_offset,
|
||||
dst->uv_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->v_buffer + src_uv_offset,
|
||||
src->uv_stride,
|
||||
dst->v_buffer + dst_uv_offset,
|
||||
dst->uv_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
}
|
||||
|
||||
|
||||
/* note the extension is only for the last row, for intra prediction purpose */
|
||||
void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned char *UPtr, unsigned char *VPtr)
|
||||
{
|
||||
int i;
|
||||
void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned char *UPtr, unsigned char *VPtr) {
|
||||
int i;
|
||||
|
||||
YPtr += ybf->y_stride * 14;
|
||||
UPtr += ybf->uv_stride * 6;
|
||||
VPtr += ybf->uv_stride * 6;
|
||||
YPtr += ybf->y_stride * 14;
|
||||
UPtr += ybf->uv_stride * 6;
|
||||
VPtr += ybf->uv_stride * 6;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
YPtr[i] = YPtr[-1];
|
||||
UPtr[i] = UPtr[-1];
|
||||
VPtr[i] = VPtr[-1];
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
YPtr[i] = YPtr[-1];
|
||||
UPtr[i] = UPtr[-1];
|
||||
VPtr[i] = VPtr[-1];
|
||||
}
|
||||
|
||||
YPtr += ybf->y_stride;
|
||||
UPtr += ybf->uv_stride;
|
||||
VPtr += ybf->uv_stride;
|
||||
YPtr += ybf->y_stride;
|
||||
UPtr += ybf->uv_stride;
|
||||
VPtr += ybf->uv_stride;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
YPtr[i] = YPtr[-1];
|
||||
UPtr[i] = UPtr[-1];
|
||||
VPtr[i] = VPtr[-1];
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
YPtr[i] = YPtr[-1];
|
||||
UPtr[i] = UPtr[-1];
|
||||
VPtr[i] = VPtr[-1];
|
||||
}
|
||||
}
|
||||
|
2141
vp8/common/filter.c
2141
vp8/common/filter.c
File diff suppressed because it is too large
Load Diff
@ -29,4 +29,4 @@ extern const short vp8_sub_pel_filters_6[SUBPEL_SHIFTS][6];
|
||||
extern const short vp8_sub_pel_filters_8[SUBPEL_SHIFTS][8];
|
||||
extern const short vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][8];
|
||||
|
||||
#endif //FILTER_H
|
||||
#endif // FILTER_H
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "findnearmv.h"
|
||||
|
||||
const unsigned char vp8_mbsplit_offset[4][16] = {
|
||||
{ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
{ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
};
|
||||
|
||||
/* Predict motion vectors using those from already-decoded nearby blocks.
|
||||
@ -24,162 +24,144 @@ const unsigned char vp8_mbsplit_offset[4][16] = {
|
||||
|
||||
void vp8_find_near_mvs
|
||||
(
|
||||
MACROBLOCKD *xd,
|
||||
const MODE_INFO *here,
|
||||
const MODE_INFO *lf_here,
|
||||
int_mv *nearest,
|
||||
int_mv *nearby,
|
||||
int_mv *best_mv,
|
||||
int cnt[4],
|
||||
int refframe,
|
||||
int *ref_frame_sign_bias
|
||||
)
|
||||
{
|
||||
const MODE_INFO *above = here - xd->mode_info_stride;
|
||||
const MODE_INFO *left = here - 1;
|
||||
const MODE_INFO *aboveleft = above - 1;
|
||||
const MODE_INFO *third = NULL;
|
||||
int_mv near_mvs[4];
|
||||
int_mv *mv = near_mvs;
|
||||
int *cntx = cnt;
|
||||
enum {CNT_INTRA, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV};
|
||||
MACROBLOCKD *xd,
|
||||
const MODE_INFO *here,
|
||||
const MODE_INFO *lf_here,
|
||||
int_mv *nearest,
|
||||
int_mv *nearby,
|
||||
int_mv *best_mv,
|
||||
int cnt[4],
|
||||
int refframe,
|
||||
int *ref_frame_sign_bias
|
||||
) {
|
||||
const MODE_INFO *above = here - xd->mode_info_stride;
|
||||
const MODE_INFO *left = here - 1;
|
||||
const MODE_INFO *aboveleft = above - 1;
|
||||
const MODE_INFO *third = NULL;
|
||||
int_mv near_mvs[4];
|
||||
int_mv *mv = near_mvs;
|
||||
int *cntx = cnt;
|
||||
enum {CNT_INTRA, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV};
|
||||
|
||||
/* Zero accumulators */
|
||||
mv[0].as_int = mv[1].as_int = mv[2].as_int = 0;
|
||||
cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
|
||||
/* Zero accumulators */
|
||||
mv[0].as_int = mv[1].as_int = mv[2].as_int = 0;
|
||||
cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
|
||||
|
||||
/* Process above */
|
||||
if (above->mbmi.ref_frame != INTRA_FRAME)
|
||||
{
|
||||
if (above->mbmi.mv.as_int)
|
||||
{
|
||||
(++mv)->as_int = above->mbmi.mv.as_int;
|
||||
mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame],
|
||||
refframe, mv, ref_frame_sign_bias);
|
||||
++cntx;
|
||||
}
|
||||
*cntx += 2;
|
||||
/* Process above */
|
||||
if (above->mbmi.ref_frame != INTRA_FRAME) {
|
||||
if (above->mbmi.mv.as_int) {
|
||||
(++mv)->as_int = above->mbmi.mv.as_int;
|
||||
mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame],
|
||||
refframe, mv, ref_frame_sign_bias);
|
||||
++cntx;
|
||||
}
|
||||
*cntx += 2;
|
||||
}
|
||||
|
||||
/* Process left */
|
||||
if (left->mbmi.ref_frame != INTRA_FRAME)
|
||||
{
|
||||
if (left->mbmi.mv.as_int)
|
||||
{
|
||||
int_mv this_mv;
|
||||
this_mv.as_int = left->mbmi.mv.as_int;
|
||||
mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame],
|
||||
refframe, &this_mv, ref_frame_sign_bias);
|
||||
/* Process left */
|
||||
if (left->mbmi.ref_frame != INTRA_FRAME) {
|
||||
if (left->mbmi.mv.as_int) {
|
||||
int_mv this_mv;
|
||||
this_mv.as_int = left->mbmi.mv.as_int;
|
||||
mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame],
|
||||
refframe, &this_mv, ref_frame_sign_bias);
|
||||
|
||||
if (this_mv.as_int != mv->as_int)
|
||||
{
|
||||
(++mv)->as_int = this_mv.as_int;
|
||||
++cntx;
|
||||
}
|
||||
*cntx += 2;
|
||||
}
|
||||
else
|
||||
cnt[CNT_INTRA] += 2;
|
||||
if (this_mv.as_int != mv->as_int) {
|
||||
(++mv)->as_int = this_mv.as_int;
|
||||
++cntx;
|
||||
}
|
||||
*cntx += 2;
|
||||
} else
|
||||
cnt[CNT_INTRA] += 2;
|
||||
}
|
||||
/* Process above left or the one from last frame */
|
||||
if (aboveleft->mbmi.ref_frame != INTRA_FRAME ||
|
||||
(lf_here->mbmi.ref_frame == LAST_FRAME && refframe == LAST_FRAME)) {
|
||||
if (aboveleft->mbmi.mv.as_int) {
|
||||
third = aboveleft;
|
||||
} else if (lf_here->mbmi.mv.as_int) {
|
||||
third = lf_here;
|
||||
}
|
||||
/* Process above left or the one from last frame */
|
||||
if ( aboveleft->mbmi.ref_frame != INTRA_FRAME||
|
||||
(lf_here->mbmi.ref_frame==LAST_FRAME && refframe == LAST_FRAME))
|
||||
{
|
||||
if (aboveleft->mbmi.mv.as_int)
|
||||
{
|
||||
third = aboveleft;
|
||||
}
|
||||
else if(lf_here->mbmi.mv.as_int)
|
||||
{
|
||||
third = lf_here;
|
||||
}
|
||||
if(third)
|
||||
{
|
||||
int_mv this_mv;
|
||||
this_mv.as_int = third->mbmi.mv.as_int;
|
||||
mv_bias(ref_frame_sign_bias[third->mbmi.ref_frame],
|
||||
refframe, &this_mv, ref_frame_sign_bias);
|
||||
if (third) {
|
||||
int_mv this_mv;
|
||||
this_mv.as_int = third->mbmi.mv.as_int;
|
||||
mv_bias(ref_frame_sign_bias[third->mbmi.ref_frame],
|
||||
refframe, &this_mv, ref_frame_sign_bias);
|
||||
|
||||
if (this_mv.as_int != mv->as_int)
|
||||
{
|
||||
(++mv)->as_int = this_mv.as_int;
|
||||
++cntx;
|
||||
}
|
||||
*cntx += 1;
|
||||
}
|
||||
else
|
||||
cnt[CNT_INTRA] += 1;
|
||||
}
|
||||
if (this_mv.as_int != mv->as_int) {
|
||||
(++mv)->as_int = this_mv.as_int;
|
||||
++cntx;
|
||||
}
|
||||
*cntx += 1;
|
||||
} else
|
||||
cnt[CNT_INTRA] += 1;
|
||||
}
|
||||
|
||||
/* If we have three distinct MV's ... */
|
||||
if (cnt[CNT_SPLITMV])
|
||||
{
|
||||
/* See if the third MV can be merged with NEAREST */
|
||||
if (mv->as_int == near_mvs[CNT_NEAREST].as_int)
|
||||
cnt[CNT_NEAREST] += 1;
|
||||
}
|
||||
/* If we have three distinct MV's ... */
|
||||
if (cnt[CNT_SPLITMV]) {
|
||||
/* See if the third MV can be merged with NEAREST */
|
||||
if (mv->as_int == near_mvs[CNT_NEAREST].as_int)
|
||||
cnt[CNT_NEAREST] += 1;
|
||||
}
|
||||
|
||||
cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV)
|
||||
+ (left->mbmi.mode == SPLITMV)) * 2
|
||||
+ (
|
||||
lf_here->mbmi.mode == SPLITMV ||
|
||||
cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV)
|
||||
+ (left->mbmi.mode == SPLITMV)) * 2
|
||||
+ (
|
||||
lf_here->mbmi.mode == SPLITMV ||
|
||||
aboveleft->mbmi.mode == SPLITMV);
|
||||
|
||||
/* Swap near and nearest if necessary */
|
||||
if (cnt[CNT_NEAR] > cnt[CNT_NEAREST])
|
||||
{
|
||||
int tmp;
|
||||
tmp = cnt[CNT_NEAREST];
|
||||
cnt[CNT_NEAREST] = cnt[CNT_NEAR];
|
||||
cnt[CNT_NEAR] = tmp;
|
||||
tmp = near_mvs[CNT_NEAREST].as_int;
|
||||
near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
|
||||
near_mvs[CNT_NEAR].as_int = tmp;
|
||||
}
|
||||
/* Swap near and nearest if necessary */
|
||||
if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) {
|
||||
int tmp;
|
||||
tmp = cnt[CNT_NEAREST];
|
||||
cnt[CNT_NEAREST] = cnt[CNT_NEAR];
|
||||
cnt[CNT_NEAR] = tmp;
|
||||
tmp = near_mvs[CNT_NEAREST].as_int;
|
||||
near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
|
||||
near_mvs[CNT_NEAR].as_int = tmp;
|
||||
}
|
||||
|
||||
/* Use near_mvs[0] to store the "best" MV */
|
||||
if (cnt[CNT_NEAREST] >= cnt[CNT_INTRA])
|
||||
near_mvs[CNT_INTRA] = near_mvs[CNT_NEAREST];
|
||||
/* Use near_mvs[0] to store the "best" MV */
|
||||
if (cnt[CNT_NEAREST] >= cnt[CNT_INTRA])
|
||||
near_mvs[CNT_INTRA] = near_mvs[CNT_NEAREST];
|
||||
|
||||
/* Set up return values */
|
||||
best_mv->as_int = near_mvs[0].as_int;
|
||||
nearest->as_int = near_mvs[CNT_NEAREST].as_int;
|
||||
nearby->as_int = near_mvs[CNT_NEAR].as_int;
|
||||
/* Set up return values */
|
||||
best_mv->as_int = near_mvs[0].as_int;
|
||||
nearest->as_int = near_mvs[CNT_NEAREST].as_int;
|
||||
nearby->as_int = near_mvs[CNT_NEAR].as_int;
|
||||
|
||||
/* Make sure that the 1/8th bits of the Mvs are zero if high_precision
|
||||
* is not being used, by truncating the last bit towards 0
|
||||
*/
|
||||
/* Make sure that the 1/8th bits of the Mvs are zero if high_precision
|
||||
* is not being used, by truncating the last bit towards 0
|
||||
*/
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
if (!xd->allow_high_precision_mv)
|
||||
{
|
||||
if (best_mv->as_mv.row & 1)
|
||||
best_mv->as_mv.row += (best_mv->as_mv.row > 0 ? -1 : 1);
|
||||
if (best_mv->as_mv.col & 1)
|
||||
best_mv->as_mv.col += (best_mv->as_mv.col > 0 ? -1 : 1);
|
||||
if (nearest->as_mv.row & 1)
|
||||
nearest->as_mv.row += (nearest->as_mv.row > 0 ? -1 : 1);
|
||||
if (nearest->as_mv.col & 1)
|
||||
nearest->as_mv.col += (nearest->as_mv.col > 0 ? -1 : 1);
|
||||
if (nearby->as_mv.row & 1)
|
||||
nearby->as_mv.row += (nearby->as_mv.row > 0 ? -1 : 1);
|
||||
if (nearby->as_mv.col & 1)
|
||||
nearby->as_mv.col += (nearby->as_mv.col > 0 ? -1 : 1);
|
||||
}
|
||||
if (!xd->allow_high_precision_mv) {
|
||||
if (best_mv->as_mv.row & 1)
|
||||
best_mv->as_mv.row += (best_mv->as_mv.row > 0 ? -1 : 1);
|
||||
if (best_mv->as_mv.col & 1)
|
||||
best_mv->as_mv.col += (best_mv->as_mv.col > 0 ? -1 : 1);
|
||||
if (nearest->as_mv.row & 1)
|
||||
nearest->as_mv.row += (nearest->as_mv.row > 0 ? -1 : 1);
|
||||
if (nearest->as_mv.col & 1)
|
||||
nearest->as_mv.col += (nearest->as_mv.col > 0 ? -1 : 1);
|
||||
if (nearby->as_mv.row & 1)
|
||||
nearby->as_mv.row += (nearby->as_mv.row > 0 ? -1 : 1);
|
||||
if (nearby->as_mv.col & 1)
|
||||
nearby->as_mv.col += (nearby->as_mv.col > 0 ? -1 : 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
//TODO: move clamp outside findnearmv
|
||||
vp8_clamp_mv2(nearest, xd);
|
||||
vp8_clamp_mv2(nearby, xd);
|
||||
vp8_clamp_mv2(best_mv, xd);
|
||||
// TODO: move clamp outside findnearmv
|
||||
vp8_clamp_mv2(nearest, xd);
|
||||
vp8_clamp_mv2(nearby, xd);
|
||||
vp8_clamp_mv2(best_mv, xd);
|
||||
}
|
||||
|
||||
vp8_prob *vp8_mv_ref_probs(VP8_COMMON *pc,
|
||||
vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
|
||||
)
|
||||
{
|
||||
p[0] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[0]] [0];
|
||||
p[1] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[1]] [1];
|
||||
p[2] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[2]] [2];
|
||||
p[3] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[3]] [3];
|
||||
return p;
|
||||
vp8_prob p[VP8_MVREFS - 1], const int near_mv_ref_ct[4]
|
||||
) {
|
||||
p[0] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[0]] [0];
|
||||
p[1] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[1]] [1];
|
||||
p[2] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[2]] [2];
|
||||
p[3] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[3]] [3];
|
||||
return p;
|
||||
}
|
||||
|
@ -19,190 +19,171 @@
|
||||
#include "onyxc_int.h"
|
||||
|
||||
|
||||
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, const int *ref_frame_sign_bias)
|
||||
{
|
||||
MV xmv;
|
||||
xmv = mvp->as_mv;
|
||||
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, const int *ref_frame_sign_bias) {
|
||||
MV xmv;
|
||||
xmv = mvp->as_mv;
|
||||
|
||||
if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe])
|
||||
{
|
||||
xmv.row *= -1;
|
||||
xmv.col *= -1;
|
||||
}
|
||||
if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
|
||||
xmv.row *= -1;
|
||||
xmv.col *= -1;
|
||||
}
|
||||
|
||||
mvp->as_mv = xmv;
|
||||
mvp->as_mv = xmv;
|
||||
}
|
||||
|
||||
#define LEFT_TOP_MARGIN (16 << 3)
|
||||
#define RIGHT_BOTTOM_MARGIN (16 << 3)
|
||||
static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd)
|
||||
{
|
||||
if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
|
||||
mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
|
||||
else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
|
||||
mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
|
||||
static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
|
||||
if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
|
||||
mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
|
||||
else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
|
||||
mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
|
||||
|
||||
if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
|
||||
mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
|
||||
else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
|
||||
mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
|
||||
if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
|
||||
mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
|
||||
else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
|
||||
mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
|
||||
}
|
||||
|
||||
static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge,
|
||||
int mb_to_top_edge, int mb_to_bottom_edge)
|
||||
{
|
||||
mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
|
||||
mb_to_left_edge : mv->as_mv.col;
|
||||
mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
|
||||
mb_to_right_edge : mv->as_mv.col;
|
||||
mv->as_mv.row = (mv->as_mv.row < mb_to_top_edge) ?
|
||||
mb_to_top_edge : mv->as_mv.row;
|
||||
mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
|
||||
mb_to_bottom_edge : mv->as_mv.row;
|
||||
int mb_to_top_edge, int mb_to_bottom_edge) {
|
||||
mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
|
||||
mb_to_left_edge : mv->as_mv.col;
|
||||
mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
|
||||
mb_to_right_edge : mv->as_mv.col;
|
||||
mv->as_mv.row = (mv->as_mv.row < mb_to_top_edge) ?
|
||||
mb_to_top_edge : mv->as_mv.row;
|
||||
mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
|
||||
mb_to_bottom_edge : mv->as_mv.row;
|
||||
}
|
||||
static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
|
||||
int mb_to_right_edge, int mb_to_top_edge,
|
||||
int mb_to_bottom_edge)
|
||||
{
|
||||
unsigned int need_to_clamp;
|
||||
need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0;
|
||||
need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0;
|
||||
need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0;
|
||||
need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0;
|
||||
return need_to_clamp;
|
||||
int mb_to_right_edge, int mb_to_top_edge,
|
||||
int mb_to_bottom_edge) {
|
||||
unsigned int need_to_clamp;
|
||||
need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0;
|
||||
need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0;
|
||||
need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0;
|
||||
need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0;
|
||||
return need_to_clamp;
|
||||
}
|
||||
|
||||
void vp8_find_near_mvs
|
||||
(
|
||||
MACROBLOCKD *xd,
|
||||
const MODE_INFO *here,
|
||||
const MODE_INFO *lfhere,
|
||||
int_mv *nearest, int_mv *nearby, int_mv *best,
|
||||
int near_mv_ref_cts[4],
|
||||
int refframe,
|
||||
int *ref_frame_sign_bias
|
||||
MACROBLOCKD *xd,
|
||||
const MODE_INFO *here,
|
||||
const MODE_INFO *lfhere,
|
||||
int_mv *nearest, int_mv *nearby, int_mv *best,
|
||||
int near_mv_ref_cts[4],
|
||||
int refframe,
|
||||
int *ref_frame_sign_bias
|
||||
);
|
||||
|
||||
vp8_prob *vp8_mv_ref_probs(VP8_COMMON *pc,
|
||||
vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
|
||||
);
|
||||
vp8_prob p[VP8_MVREFS - 1], const int near_mv_ref_ct[4]
|
||||
);
|
||||
|
||||
extern const unsigned char vp8_mbsplit_offset[4][16];
|
||||
|
||||
|
||||
static int left_block_mv(const MODE_INFO *cur_mb, int b)
|
||||
{
|
||||
if (!(b & 3))
|
||||
{
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
static int left_block_mv(const MODE_INFO *cur_mb, int b) {
|
||||
if (!(b & 3)) {
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
|
||||
if(cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.mv.as_int;
|
||||
b += 4;
|
||||
}
|
||||
if (cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.mv.as_int;
|
||||
b += 4;
|
||||
}
|
||||
|
||||
return (cur_mb->bmi + b - 1)->as_mv.first.as_int;
|
||||
return (cur_mb->bmi + b - 1)->as_mv.first.as_int;
|
||||
}
|
||||
|
||||
static int left_block_second_mv(const MODE_INFO *cur_mb, int b)
|
||||
{
|
||||
if (!(b & 3))
|
||||
{
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
static int left_block_second_mv(const MODE_INFO *cur_mb, int b) {
|
||||
if (!(b & 3)) {
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
|
||||
if(cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.second_ref_frame ? cur_mb->mbmi.second_mv.as_int : cur_mb->mbmi.mv.as_int;
|
||||
b += 4;
|
||||
}
|
||||
if (cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.second_ref_frame ? cur_mb->mbmi.second_mv.as_int : cur_mb->mbmi.mv.as_int;
|
||||
b += 4;
|
||||
}
|
||||
|
||||
return cur_mb->mbmi.second_ref_frame ? (cur_mb->bmi + b - 1)->as_mv.second.as_int : (cur_mb->bmi + b - 1)->as_mv.first.as_int;
|
||||
return cur_mb->mbmi.second_ref_frame ? (cur_mb->bmi + b - 1)->as_mv.second.as_int : (cur_mb->bmi + b - 1)->as_mv.first.as_int;
|
||||
}
|
||||
|
||||
static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride)
|
||||
{
|
||||
if (!(b >> 2))
|
||||
{
|
||||
/* On top edge, get from MB above us */
|
||||
cur_mb -= mi_stride;
|
||||
static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
|
||||
if (!(b >> 2)) {
|
||||
/* On top edge, get from MB above us */
|
||||
cur_mb -= mi_stride;
|
||||
|
||||
if(cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.mv.as_int;
|
||||
b += 16;
|
||||
}
|
||||
if (cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.mv.as_int;
|
||||
b += 16;
|
||||
}
|
||||
|
||||
return (cur_mb->bmi + b - 4)->as_mv.first.as_int;
|
||||
return (cur_mb->bmi + b - 4)->as_mv.first.as_int;
|
||||
}
|
||||
|
||||
static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride)
|
||||
{
|
||||
if (!(b >> 2))
|
||||
{
|
||||
/* On top edge, get from MB above us */
|
||||
cur_mb -= mi_stride;
|
||||
static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
|
||||
if (!(b >> 2)) {
|
||||
/* On top edge, get from MB above us */
|
||||
cur_mb -= mi_stride;
|
||||
|
||||
if(cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.second_ref_frame ? cur_mb->mbmi.second_mv.as_int : cur_mb->mbmi.mv.as_int;
|
||||
b += 16;
|
||||
}
|
||||
if (cur_mb->mbmi.mode != SPLITMV)
|
||||
return cur_mb->mbmi.second_ref_frame ? cur_mb->mbmi.second_mv.as_int : cur_mb->mbmi.mv.as_int;
|
||||
b += 16;
|
||||
}
|
||||
|
||||
return cur_mb->mbmi.second_ref_frame ? (cur_mb->bmi + b - 4)->as_mv.second.as_int : (cur_mb->bmi + b - 4)->as_mv.first.as_int;
|
||||
return cur_mb->mbmi.second_ref_frame ? (cur_mb->bmi + b - 4)->as_mv.second.as_int : (cur_mb->bmi + b - 4)->as_mv.first.as_int;
|
||||
}
|
||||
|
||||
static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b)
|
||||
{
|
||||
if (!(b & 3))
|
||||
{
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
switch (cur_mb->mbmi.mode)
|
||||
{
|
||||
case DC_PRED:
|
||||
return B_DC_PRED;
|
||||
case V_PRED:
|
||||
return B_VE_PRED;
|
||||
case H_PRED:
|
||||
return B_HE_PRED;
|
||||
case TM_PRED:
|
||||
return B_TM_PRED;
|
||||
case I8X8_PRED:
|
||||
case B_PRED:
|
||||
return (cur_mb->bmi + b + 3)->as_mode.first;
|
||||
default:
|
||||
return B_DC_PRED;
|
||||
}
|
||||
static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
|
||||
if (!(b & 3)) {
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
switch (cur_mb->mbmi.mode) {
|
||||
case DC_PRED:
|
||||
return B_DC_PRED;
|
||||
case V_PRED:
|
||||
return B_VE_PRED;
|
||||
case H_PRED:
|
||||
return B_HE_PRED;
|
||||
case TM_PRED:
|
||||
return B_TM_PRED;
|
||||
case I8X8_PRED:
|
||||
case B_PRED:
|
||||
return (cur_mb->bmi + b + 3)->as_mode.first;
|
||||
default:
|
||||
return B_DC_PRED;
|
||||
}
|
||||
return (cur_mb->bmi + b - 1)->as_mode.first;
|
||||
}
|
||||
return (cur_mb->bmi + b - 1)->as_mode.first;
|
||||
}
|
||||
|
||||
static B_PREDICTION_MODE above_block_mode(const MODE_INFO
|
||||
*cur_mb, int b, int mi_stride)
|
||||
{
|
||||
if (!(b >> 2))
|
||||
{
|
||||
/* On top edge, get from MB above us */
|
||||
cur_mb -= mi_stride;
|
||||
*cur_mb, int b, int mi_stride) {
|
||||
if (!(b >> 2)) {
|
||||
/* On top edge, get from MB above us */
|
||||
cur_mb -= mi_stride;
|
||||
|
||||
switch (cur_mb->mbmi.mode)
|
||||
{
|
||||
case DC_PRED:
|
||||
return B_DC_PRED;
|
||||
case V_PRED:
|
||||
return B_VE_PRED;
|
||||
case H_PRED:
|
||||
return B_HE_PRED;
|
||||
case TM_PRED:
|
||||
return B_TM_PRED;
|
||||
case I8X8_PRED:
|
||||
case B_PRED:
|
||||
return (cur_mb->bmi + b + 12)->as_mode.first;
|
||||
default:
|
||||
return B_DC_PRED;
|
||||
}
|
||||
switch (cur_mb->mbmi.mode) {
|
||||
case DC_PRED:
|
||||
return B_DC_PRED;
|
||||
case V_PRED:
|
||||
return B_VE_PRED;
|
||||
case H_PRED:
|
||||
return B_HE_PRED;
|
||||
case TM_PRED:
|
||||
return B_TM_PRED;
|
||||
case I8X8_PRED:
|
||||
case B_PRED:
|
||||
return (cur_mb->bmi + b + 12)->as_mode.first;
|
||||
default:
|
||||
return B_DC_PRED;
|
||||
}
|
||||
}
|
||||
|
||||
return (cur_mb->bmi + b - 4)->as_mode.first;
|
||||
return (cur_mb->bmi + b - 4)->as_mode.first;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -13,9 +13,9 @@ extern void (*vp8_clear_system_state)(void);
|
||||
extern void (*vp8_plane_add_noise)(unsigned char *Start, unsigned int Width, unsigned int Height, int Pitch, int DPitch, int q);
|
||||
extern void (*de_interlace)
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int Width,
|
||||
int Height,
|
||||
int Stride
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int Width,
|
||||
int Height,
|
||||
int Stride
|
||||
);
|
||||
|
@ -20,123 +20,122 @@
|
||||
extern void vp8_arch_x86_common_init(VP8_COMMON *ctx);
|
||||
extern void vp8_arch_arm_common_init(VP8_COMMON *ctx);
|
||||
|
||||
void vp8_machine_specific_config(VP8_COMMON *ctx)
|
||||
{
|
||||
void vp8_machine_specific_config(VP8_COMMON *ctx) {
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
|
||||
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_c;
|
||||
rtcd->idct.idct16 = vp8_short_idct4x4llm_c;
|
||||
rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_c;
|
||||
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_c;
|
||||
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_c;
|
||||
rtcd->idct.idct8 = vp8_short_idct8x8_c;
|
||||
rtcd->idct.idct1_scalar_add_8x8 = vp8_dc_only_idct_add_8x8_c;
|
||||
rtcd->idct.ihaar2 = vp8_short_ihaar2x2_c;
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_c;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_c;
|
||||
rtcd->recon.avg16x16 = vp8_avg_mem16x16_c;
|
||||
rtcd->recon.avg8x8 = vp8_avg_mem8x8_c;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_c;
|
||||
rtcd->recon.recon = vp8_recon_b_c;
|
||||
rtcd->recon.recon_uv = vp8_recon_uv_b_c;
|
||||
rtcd->recon.recon2 = vp8_recon2b_c;
|
||||
rtcd->recon.recon4 = vp8_recon4b_c;
|
||||
rtcd->recon.recon_mb = vp8_recon_mb_c;
|
||||
rtcd->recon.recon_mby = vp8_recon_mby_c;
|
||||
rtcd->recon.build_intra_predictors_mby =
|
||||
vp8_build_intra_predictors_mby;
|
||||
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_c;
|
||||
rtcd->idct.idct16 = vp8_short_idct4x4llm_c;
|
||||
rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_c;
|
||||
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_c;
|
||||
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_c;
|
||||
rtcd->idct.idct8 = vp8_short_idct8x8_c;
|
||||
rtcd->idct.idct1_scalar_add_8x8 = vp8_dc_only_idct_add_8x8_c;
|
||||
rtcd->idct.ihaar2 = vp8_short_ihaar2x2_c;
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_c;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_c;
|
||||
rtcd->recon.avg16x16 = vp8_avg_mem16x16_c;
|
||||
rtcd->recon.avg8x8 = vp8_avg_mem8x8_c;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_c;
|
||||
rtcd->recon.recon = vp8_recon_b_c;
|
||||
rtcd->recon.recon_uv = vp8_recon_uv_b_c;
|
||||
rtcd->recon.recon2 = vp8_recon2b_c;
|
||||
rtcd->recon.recon4 = vp8_recon4b_c;
|
||||
rtcd->recon.recon_mb = vp8_recon_mb_c;
|
||||
rtcd->recon.recon_mby = vp8_recon_mby_c;
|
||||
rtcd->recon.build_intra_predictors_mby =
|
||||
vp8_build_intra_predictors_mby;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
rtcd->recon.build_comp_intra_predictors_mby =
|
||||
vp8_build_comp_intra_predictors_mby;
|
||||
rtcd->recon.build_comp_intra_predictors_mby =
|
||||
vp8_build_comp_intra_predictors_mby;
|
||||
#endif
|
||||
rtcd->recon.build_intra_predictors_mby_s =
|
||||
vp8_build_intra_predictors_mby_s;
|
||||
rtcd->recon.build_intra_predictors_mbuv =
|
||||
vp8_build_intra_predictors_mbuv;
|
||||
rtcd->recon.build_intra_predictors_mbuv_s =
|
||||
vp8_build_intra_predictors_mbuv_s;
|
||||
rtcd->recon.build_intra_predictors_mby_s =
|
||||
vp8_build_intra_predictors_mby_s;
|
||||
rtcd->recon.build_intra_predictors_mbuv =
|
||||
vp8_build_intra_predictors_mbuv;
|
||||
rtcd->recon.build_intra_predictors_mbuv_s =
|
||||
vp8_build_intra_predictors_mbuv_s;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
rtcd->recon.build_comp_intra_predictors_mbuv =
|
||||
vp8_build_comp_intra_predictors_mbuv;
|
||||
rtcd->recon.build_comp_intra_predictors_mbuv =
|
||||
vp8_build_comp_intra_predictors_mbuv;
|
||||
#endif
|
||||
rtcd->recon.intra4x4_predict =
|
||||
vp8_intra4x4_predict;
|
||||
rtcd->recon.intra4x4_predict =
|
||||
vp8_intra4x4_predict;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
rtcd->recon.comp_intra4x4_predict =
|
||||
vp8_comp_intra4x4_predict;
|
||||
rtcd->recon.comp_intra4x4_predict =
|
||||
vp8_comp_intra4x4_predict;
|
||||
#endif
|
||||
rtcd->recon.intra8x8_predict =
|
||||
vp8_intra8x8_predict;
|
||||
rtcd->recon.intra8x8_predict =
|
||||
vp8_intra8x8_predict;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
rtcd->recon.comp_intra8x8_predict =
|
||||
vp8_comp_intra8x8_predict;
|
||||
rtcd->recon.comp_intra8x8_predict =
|
||||
vp8_comp_intra8x8_predict;
|
||||
#endif
|
||||
rtcd->recon.intra_uv4x4_predict =
|
||||
vp8_intra_uv4x4_predict;
|
||||
rtcd->recon.intra_uv4x4_predict =
|
||||
vp8_intra_uv4x4_predict;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
rtcd->recon.comp_intra_uv4x4_predict =
|
||||
vp8_comp_intra_uv4x4_predict;
|
||||
rtcd->recon.comp_intra_uv4x4_predict =
|
||||
vp8_comp_intra_uv4x4_predict;
|
||||
#endif
|
||||
|
||||
#if CONFIG_ENHANCED_INTERP
|
||||
rtcd->subpix.eighttap16x16 = vp8_eighttap_predict16x16_c;
|
||||
rtcd->subpix.eighttap8x8 = vp8_eighttap_predict8x8_c;
|
||||
rtcd->subpix.eighttap_avg16x16 = vp8_eighttap_predict_avg16x16_c;
|
||||
rtcd->subpix.eighttap_avg8x8 = vp8_eighttap_predict_avg8x8_c;
|
||||
rtcd->subpix.eighttap_avg4x4 = vp8_eighttap_predict_avg4x4_c;
|
||||
rtcd->subpix.eighttap8x4 = vp8_eighttap_predict8x4_c;
|
||||
rtcd->subpix.eighttap4x4 = vp8_eighttap_predict_c;
|
||||
rtcd->subpix.eighttap16x16_sharp = vp8_eighttap_predict16x16_sharp_c;
|
||||
rtcd->subpix.eighttap8x8_sharp = vp8_eighttap_predict8x8_sharp_c;
|
||||
rtcd->subpix.eighttap_avg16x16_sharp = vp8_eighttap_predict_avg16x16_sharp_c;
|
||||
rtcd->subpix.eighttap_avg8x8_sharp = vp8_eighttap_predict_avg8x8_sharp_c;
|
||||
rtcd->subpix.eighttap_avg4x4_sharp = vp8_eighttap_predict_avg4x4_sharp_c;
|
||||
rtcd->subpix.eighttap8x4_sharp = vp8_eighttap_predict8x4_sharp_c;
|
||||
rtcd->subpix.eighttap4x4_sharp = vp8_eighttap_predict_sharp_c;
|
||||
rtcd->subpix.eighttap16x16 = vp8_eighttap_predict16x16_c;
|
||||
rtcd->subpix.eighttap8x8 = vp8_eighttap_predict8x8_c;
|
||||
rtcd->subpix.eighttap_avg16x16 = vp8_eighttap_predict_avg16x16_c;
|
||||
rtcd->subpix.eighttap_avg8x8 = vp8_eighttap_predict_avg8x8_c;
|
||||
rtcd->subpix.eighttap_avg4x4 = vp8_eighttap_predict_avg4x4_c;
|
||||
rtcd->subpix.eighttap8x4 = vp8_eighttap_predict8x4_c;
|
||||
rtcd->subpix.eighttap4x4 = vp8_eighttap_predict_c;
|
||||
rtcd->subpix.eighttap16x16_sharp = vp8_eighttap_predict16x16_sharp_c;
|
||||
rtcd->subpix.eighttap8x8_sharp = vp8_eighttap_predict8x8_sharp_c;
|
||||
rtcd->subpix.eighttap_avg16x16_sharp = vp8_eighttap_predict_avg16x16_sharp_c;
|
||||
rtcd->subpix.eighttap_avg8x8_sharp = vp8_eighttap_predict_avg8x8_sharp_c;
|
||||
rtcd->subpix.eighttap_avg4x4_sharp = vp8_eighttap_predict_avg4x4_sharp_c;
|
||||
rtcd->subpix.eighttap8x4_sharp = vp8_eighttap_predict8x4_sharp_c;
|
||||
rtcd->subpix.eighttap4x4_sharp = vp8_eighttap_predict_sharp_c;
|
||||
#endif
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_c;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_c;
|
||||
rtcd->subpix.sixtap_avg16x16 = vp8_sixtap_predict_avg16x16_c;
|
||||
rtcd->subpix.sixtap_avg8x8 = vp8_sixtap_predict_avg8x8_c;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_c;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_c;
|
||||
rtcd->subpix.sixtap_avg4x4 = vp8_sixtap_predict_avg_c;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_c;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_c;
|
||||
rtcd->subpix.bilinear_avg16x16 = vp8_bilinear_predict_avg16x16_c;
|
||||
rtcd->subpix.bilinear_avg8x8 = vp8_bilinear_predict_avg8x8_c;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_c;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_c;
|
||||
rtcd->subpix.bilinear_avg4x4 = vp8_bilinear_predict_avg4x4_c;
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_c;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_c;
|
||||
rtcd->subpix.sixtap_avg16x16 = vp8_sixtap_predict_avg16x16_c;
|
||||
rtcd->subpix.sixtap_avg8x8 = vp8_sixtap_predict_avg8x8_c;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_c;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_c;
|
||||
rtcd->subpix.sixtap_avg4x4 = vp8_sixtap_predict_avg_c;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_c;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_c;
|
||||
rtcd->subpix.bilinear_avg16x16 = vp8_bilinear_predict_avg16x16_c;
|
||||
rtcd->subpix.bilinear_avg8x8 = vp8_bilinear_predict_avg8x8_c;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_c;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_c;
|
||||
rtcd->subpix.bilinear_avg4x4 = vp8_bilinear_predict_avg4x4_c;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_c;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_c;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_c;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_c;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_c;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_c;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_c;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_c;
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_c;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_c;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_c;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_c;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_c;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_c;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_c;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_c;
|
||||
|
||||
#if CONFIG_POSTPROC || (CONFIG_VP8_ENCODER && CONFIG_INTERNAL_STATS)
|
||||
rtcd->postproc.down = vp8_mbpost_proc_down_c;
|
||||
rtcd->postproc.across = vp8_mbpost_proc_across_ip_c;
|
||||
rtcd->postproc.downacross = vp8_post_proc_down_and_across_c;
|
||||
rtcd->postproc.addnoise = vp8_plane_add_noise_c;
|
||||
rtcd->postproc.blend_mb_inner = vp8_blend_mb_inner_c;
|
||||
rtcd->postproc.blend_mb_outer = vp8_blend_mb_outer_c;
|
||||
rtcd->postproc.blend_b = vp8_blend_b_c;
|
||||
rtcd->postproc.down = vp8_mbpost_proc_down_c;
|
||||
rtcd->postproc.across = vp8_mbpost_proc_across_ip_c;
|
||||
rtcd->postproc.downacross = vp8_post_proc_down_and_across_c;
|
||||
rtcd->postproc.addnoise = vp8_plane_add_noise_c;
|
||||
rtcd->postproc.blend_mb_inner = vp8_blend_mb_inner_c;
|
||||
rtcd->postproc.blend_mb_outer = vp8_blend_mb_outer_c;
|
||||
rtcd->postproc.blend_b = vp8_blend_b_c;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
vp8_arch_x86_common_init(ctx);
|
||||
vp8_arch_x86_common_init(ctx);
|
||||
#endif
|
||||
|
||||
|
||||
#if ARCH_ARM
|
||||
vp8_arch_arm_common_init(ctx);
|
||||
vp8_arch_arm_common_init(ctx);
|
||||
#endif
|
||||
}
|
||||
|
@ -13,22 +13,21 @@
|
||||
#define __INC_HEADER_H
|
||||
|
||||
/* 24 bits total */
|
||||
typedef struct
|
||||
{
|
||||
unsigned int type: 1;
|
||||
unsigned int version: 3;
|
||||
unsigned int show_frame: 1;
|
||||
typedef struct {
|
||||
unsigned int type: 1;
|
||||
unsigned int version: 3;
|
||||
unsigned int show_frame: 1;
|
||||
|
||||
/* Allow 2^20 bytes = 8 megabits for first partition */
|
||||
/* Allow 2^20 bytes = 8 megabits for first partition */
|
||||
|
||||
unsigned int first_partition_length_in_bytes: 19;
|
||||
unsigned int first_partition_length_in_bytes: 19;
|
||||
|
||||
#ifdef PACKET_TESTING
|
||||
unsigned int frame_number;
|
||||
unsigned int update_gold: 1;
|
||||
unsigned int uses_gold: 1;
|
||||
unsigned int update_last: 1;
|
||||
unsigned int uses_last: 1;
|
||||
unsigned int frame_number;
|
||||
unsigned int update_gold: 1;
|
||||
unsigned int uses_gold: 1;
|
||||
unsigned int update_last: 1;
|
||||
unsigned int uses_last: 1;
|
||||
#endif
|
||||
|
||||
} VP8_HEADER;
|
||||
|
@ -13,15 +13,15 @@
|
||||
#define __INC_IDCT_H
|
||||
|
||||
#define prototype_second_order(sym) \
|
||||
void sym(short *input, short *output)
|
||||
void sym(short *input, short *output)
|
||||
|
||||
#define prototype_idct(sym) \
|
||||
void sym(short *input, short *output, int pitch)
|
||||
void sym(short *input, short *output, int pitch)
|
||||
|
||||
#define prototype_idct_scalar_add(sym) \
|
||||
void sym(short input, \
|
||||
unsigned char *pred, unsigned char *output, \
|
||||
int pitch, int stride)
|
||||
void sym(short input, \
|
||||
unsigned char *pred, unsigned char *output, \
|
||||
int pitch, int stride)
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#include "x86/idct_x86.h"
|
||||
@ -101,20 +101,19 @@ typedef prototype_idct((*vp8_idct_fn_t));
|
||||
typedef prototype_idct_scalar_add((*vp8_idct_scalar_add_fn_t));
|
||||
typedef prototype_second_order((*vp8_second_order_fn_t));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vp8_idct_fn_t idct1;
|
||||
vp8_idct_fn_t idct16;
|
||||
vp8_idct_scalar_add_fn_t idct1_scalar_add;
|
||||
typedef struct {
|
||||
vp8_idct_fn_t idct1;
|
||||
vp8_idct_fn_t idct16;
|
||||
vp8_idct_scalar_add_fn_t idct1_scalar_add;
|
||||
|
||||
vp8_second_order_fn_t iwalsh1;
|
||||
vp8_second_order_fn_t iwalsh16;
|
||||
vp8_second_order_fn_t iwalsh1;
|
||||
vp8_second_order_fn_t iwalsh16;
|
||||
|
||||
vp8_idct_fn_t idct8;
|
||||
vp8_idct_fn_t idct8_1;
|
||||
vp8_idct_scalar_add_fn_t idct1_scalar_add_8x8;
|
||||
vp8_idct_fn_t ihaar2;
|
||||
vp8_idct_fn_t ihaar2_1;
|
||||
vp8_idct_fn_t idct8;
|
||||
vp8_idct_fn_t idct8_1;
|
||||
vp8_idct_scalar_add_fn_t idct1_scalar_add_8x8;
|
||||
vp8_idct_fn_t ihaar2;
|
||||
vp8_idct_fn_t ihaar2_1;
|
||||
} vp8_idct_rtcd_vtable_t;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
|
@ -32,360 +32,330 @@ static const int cospi8sqrt2minus1 = 20091;
|
||||
static const int sinpi8sqrt2 = 35468;
|
||||
static const int rounding = 0;
|
||||
|
||||
void vp8_short_idct4x4llm_c(short *input, short *output, int pitch)
|
||||
{
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
void vp8_short_idct4x4llm_c(short *input, short *output, int pitch) {
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
int temp1, temp2;
|
||||
int shortpitch = pitch >> 1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
int temp1, temp2;
|
||||
int shortpitch = pitch >> 1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ip[0] + ip[8];
|
||||
b1 = ip[0] - ip[8];
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[0] + ip[8];
|
||||
b1 = ip[0] - ip[8];
|
||||
|
||||
temp1 = (ip[4] * sinpi8sqrt2 + rounding) >> 16;
|
||||
temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
c1 = temp1 - temp2;
|
||||
temp1 = (ip[4] * sinpi8sqrt2 + rounding) >> 16;
|
||||
temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
c1 = temp1 - temp2;
|
||||
|
||||
temp1 = ip[4] + ((ip[4] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
temp2 = (ip[12] * sinpi8sqrt2 + rounding) >> 16;
|
||||
d1 = temp1 + temp2;
|
||||
temp1 = ip[4] + ((ip[4] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
temp2 = (ip[12] * sinpi8sqrt2 + rounding) >> 16;
|
||||
d1 = temp1 + temp2;
|
||||
|
||||
op[shortpitch*0] = a1 + d1;
|
||||
op[shortpitch*3] = a1 - d1;
|
||||
op[shortpitch * 0] = a1 + d1;
|
||||
op[shortpitch * 3] = a1 - d1;
|
||||
|
||||
op[shortpitch*1] = b1 + c1;
|
||||
op[shortpitch*2] = b1 - c1;
|
||||
op[shortpitch * 1] = b1 + c1;
|
||||
op[shortpitch * 2] = b1 - c1;
|
||||
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
|
||||
ip = output;
|
||||
op = output;
|
||||
ip = output;
|
||||
op = output;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ip[0] + ip[2];
|
||||
b1 = ip[0] - ip[2];
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[0] + ip[2];
|
||||
b1 = ip[0] - ip[2];
|
||||
|
||||
temp1 = (ip[1] * sinpi8sqrt2 + rounding) >> 16;
|
||||
temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
c1 = temp1 - temp2;
|
||||
temp1 = (ip[1] * sinpi8sqrt2 + rounding) >> 16;
|
||||
temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
c1 = temp1 - temp2;
|
||||
|
||||
temp1 = ip[1] + ((ip[1] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
temp2 = (ip[3] * sinpi8sqrt2 + rounding) >> 16;
|
||||
d1 = temp1 + temp2;
|
||||
temp1 = ip[1] + ((ip[1] * cospi8sqrt2minus1 + rounding) >> 16);
|
||||
temp2 = (ip[3] * sinpi8sqrt2 + rounding) >> 16;
|
||||
d1 = temp1 + temp2;
|
||||
|
||||
op[0] = (a1 + d1 + 16) >> 5;
|
||||
op[3] = (a1 - d1 + 16) >> 5;
|
||||
op[0] = (a1 + d1 + 16) >> 5;
|
||||
op[3] = (a1 - d1 + 16) >> 5;
|
||||
|
||||
op[1] = (b1 + c1 + 16) >> 5;
|
||||
op[2] = (b1 - c1 + 16) >> 5;
|
||||
op[1] = (b1 + c1 + 16) >> 5;
|
||||
op[2] = (b1 - c1 + 16) >> 5;
|
||||
|
||||
ip += shortpitch;
|
||||
op += shortpitch;
|
||||
}
|
||||
ip += shortpitch;
|
||||
op += shortpitch;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch)
|
||||
{
|
||||
int i;
|
||||
int a1;
|
||||
short *op = output;
|
||||
int shortpitch = pitch >> 1;
|
||||
a1 = ((input[0] + 16) >> 5);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
op[0] = a1;
|
||||
op[1] = a1;
|
||||
op[2] = a1;
|
||||
op[3] = a1;
|
||||
op += shortpitch;
|
||||
}
|
||||
void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch) {
|
||||
int i;
|
||||
int a1;
|
||||
short *op = output;
|
||||
int shortpitch = pitch >> 1;
|
||||
a1 = ((input[0] + 16) >> 5);
|
||||
for (i = 0; i < 4; i++) {
|
||||
op[0] = a1;
|
||||
op[1] = a1;
|
||||
op[2] = a1;
|
||||
op[3] = a1;
|
||||
op += shortpitch;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride)
|
||||
{
|
||||
int a1 = ((input_dc + 16) >> 5);
|
||||
int r, c;
|
||||
void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride) {
|
||||
int a1 = ((input_dc + 16) >> 5);
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = a1 + pred_ptr[c] ;
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = a1 + pred_ptr[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void vp8_short_inv_walsh4x4_c(short *input, short *output)
|
||||
{
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
void vp8_short_inv_walsh4x4_c(short *input, short *output) {
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ((ip[0] + ip[3]));
|
||||
b1 = ((ip[1] + ip[2]));
|
||||
c1 = ((ip[1] - ip[2]));
|
||||
d1 = ((ip[0] - ip[3]));
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ((ip[0] + ip[3]));
|
||||
b1 = ((ip[1] + ip[2]));
|
||||
c1 = ((ip[1] - ip[2]));
|
||||
d1 = ((ip[0] - ip[3]));
|
||||
|
||||
op[0] = (a1 + b1 + 1)>>1;
|
||||
op[1] = (c1 + d1)>>1;
|
||||
op[2] = (a1 - b1)>>1;
|
||||
op[3] = (d1 - c1)>>1;
|
||||
op[0] = (a1 + b1 + 1) >> 1;
|
||||
op[1] = (c1 + d1) >> 1;
|
||||
op[2] = (a1 - b1) >> 1;
|
||||
op[3] = (d1 - c1) >> 1;
|
||||
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
|
||||
ip = output;
|
||||
op = output;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ip[0] + ip[12];
|
||||
b1 = ip[4] + ip[8];
|
||||
c1 = ip[4] - ip[8];
|
||||
d1 = ip[0] - ip[12];
|
||||
op[0] = (a1 + b1 + 1)>>1;
|
||||
op[4] = (c1 + d1)>>1;
|
||||
op[8] = (a1 - b1)>>1;
|
||||
op[12]= (d1 - c1)>>1;
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
ip = output;
|
||||
op = output;
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[0] + ip[12];
|
||||
b1 = ip[4] + ip[8];
|
||||
c1 = ip[4] - ip[8];
|
||||
d1 = ip[0] - ip[12];
|
||||
op[0] = (a1 + b1 + 1) >> 1;
|
||||
op[4] = (c1 + d1) >> 1;
|
||||
op[8] = (a1 - b1) >> 1;
|
||||
op[12] = (d1 - c1) >> 1;
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_short_inv_walsh4x4_1_c(short *in, short *out)
|
||||
{
|
||||
int i;
|
||||
short tmp[4];
|
||||
short *ip = in;
|
||||
short *op = tmp;
|
||||
void vp8_short_inv_walsh4x4_1_c(short *in, short *out) {
|
||||
int i;
|
||||
short tmp[4];
|
||||
short *ip = in;
|
||||
short *op = tmp;
|
||||
|
||||
op[0] =(ip[0]+ 1)>>1;
|
||||
op[1] = op[2] = op[3] = (ip[0]>>1);
|
||||
op[0] = (ip[0] + 1) >> 1;
|
||||
op[1] = op[2] = op[3] = (ip[0] >> 1);
|
||||
|
||||
ip = tmp;
|
||||
op = out;
|
||||
for(i = 0; i<4; i++)
|
||||
{
|
||||
op[0] =(ip[0]+ 1)>>1;
|
||||
op[4] = op[8] = op[12] = (ip[0]>>1);
|
||||
ip ++;
|
||||
op ++;
|
||||
}
|
||||
ip = tmp;
|
||||
op = out;
|
||||
for (i = 0; i < 4; i++) {
|
||||
op[0] = (ip[0] + 1) >> 1;
|
||||
op[4] = op[8] = op[12] = (ip[0] >> 1);
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_LOSSLESS
|
||||
void vp8_short_inv_walsh4x4_lossless_c(short *input, short *output)
|
||||
{
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
void vp8_short_inv_walsh4x4_lossless_c(short *input, short *output) {
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ((ip[0] + ip[3]))>>Y2_WHT_UPSCALE_FACTOR;
|
||||
b1 = ((ip[1] + ip[2]))>>Y2_WHT_UPSCALE_FACTOR;
|
||||
c1 = ((ip[1] - ip[2]))>>Y2_WHT_UPSCALE_FACTOR;
|
||||
d1 = ((ip[0] - ip[3]))>>Y2_WHT_UPSCALE_FACTOR;
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ((ip[0] + ip[3])) >> Y2_WHT_UPSCALE_FACTOR;
|
||||
b1 = ((ip[1] + ip[2])) >> Y2_WHT_UPSCALE_FACTOR;
|
||||
c1 = ((ip[1] - ip[2])) >> Y2_WHT_UPSCALE_FACTOR;
|
||||
d1 = ((ip[0] - ip[3])) >> Y2_WHT_UPSCALE_FACTOR;
|
||||
|
||||
op[0] = (a1 + b1 + 1)>>1;
|
||||
op[1] = (c1 + d1)>>1;
|
||||
op[2] = (a1 - b1)>>1;
|
||||
op[3] = (d1 - c1)>>1;
|
||||
op[0] = (a1 + b1 + 1) >> 1;
|
||||
op[1] = (c1 + d1) >> 1;
|
||||
op[2] = (a1 - b1) >> 1;
|
||||
op[3] = (d1 - c1) >> 1;
|
||||
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
|
||||
ip = output;
|
||||
op = output;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ip[0] + ip[12];
|
||||
b1 = ip[4] + ip[8];
|
||||
c1 = ip[4] - ip[8];
|
||||
d1 = ip[0] - ip[12];
|
||||
ip = output;
|
||||
op = output;
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[0] + ip[12];
|
||||
b1 = ip[4] + ip[8];
|
||||
c1 = ip[4] - ip[8];
|
||||
d1 = ip[0] - ip[12];
|
||||
|
||||
|
||||
op[0] = ((a1 + b1 + 1)>>1)<<Y2_WHT_UPSCALE_FACTOR;
|
||||
op[4] = ((c1 + d1)>>1)<<Y2_WHT_UPSCALE_FACTOR;
|
||||
op[8] = ((a1 - b1)>>1)<<Y2_WHT_UPSCALE_FACTOR;
|
||||
op[12]= ((d1 - c1)>>1)<<Y2_WHT_UPSCALE_FACTOR;
|
||||
op[0] = ((a1 + b1 + 1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
|
||||
op[4] = ((c1 + d1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
|
||||
op[8] = ((a1 - b1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
|
||||
op[12] = ((d1 - c1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
|
||||
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_short_inv_walsh4x4_1_lossless_c(short *in, short *out)
|
||||
{
|
||||
int i;
|
||||
short tmp[4];
|
||||
short *ip = in;
|
||||
short *op = tmp;
|
||||
void vp8_short_inv_walsh4x4_1_lossless_c(short *in, short *out) {
|
||||
int i;
|
||||
short tmp[4];
|
||||
short *ip = in;
|
||||
short *op = tmp;
|
||||
|
||||
op[0] =((ip[0]>>Y2_WHT_UPSCALE_FACTOR)+ 1)>>1;
|
||||
op[1] = op[2] = op[3] = ((ip[0]>>Y2_WHT_UPSCALE_FACTOR)>>1);
|
||||
op[0] = ((ip[0] >> Y2_WHT_UPSCALE_FACTOR) + 1) >> 1;
|
||||
op[1] = op[2] = op[3] = ((ip[0] >> Y2_WHT_UPSCALE_FACTOR) >> 1);
|
||||
|
||||
ip = tmp;
|
||||
op = out;
|
||||
for(i = 0; i<4; i++)
|
||||
{
|
||||
op[0] =((ip[0]+ 1)>>1)<<Y2_WHT_UPSCALE_FACTOR;
|
||||
op[4] = op[8] = op[12] = ((ip[0]>>1))<<Y2_WHT_UPSCALE_FACTOR;
|
||||
ip ++;
|
||||
op ++;
|
||||
}
|
||||
ip = tmp;
|
||||
op = out;
|
||||
for (i = 0; i < 4; i++) {
|
||||
op[0] = ((ip[0] + 1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
|
||||
op[4] = op[8] = op[12] = ((ip[0] >> 1)) << Y2_WHT_UPSCALE_FACTOR;
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_short_inv_walsh4x4_x8_c(short *input, short *output, int pitch)
|
||||
{
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
int shortpitch = pitch >> 1;
|
||||
void vp8_short_inv_walsh4x4_x8_c(short *input, short *output, int pitch) {
|
||||
int i;
|
||||
int a1, b1, c1, d1;
|
||||
short *ip = input;
|
||||
short *op = output;
|
||||
int shortpitch = pitch >> 1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ((ip[0] + ip[3]))>>WHT_UPSCALE_FACTOR;
|
||||
b1 = ((ip[1] + ip[2]))>>WHT_UPSCALE_FACTOR;
|
||||
c1 = ((ip[1] - ip[2]))>>WHT_UPSCALE_FACTOR;
|
||||
d1 = ((ip[0] - ip[3]))>>WHT_UPSCALE_FACTOR;
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ((ip[0] + ip[3])) >> WHT_UPSCALE_FACTOR;
|
||||
b1 = ((ip[1] + ip[2])) >> WHT_UPSCALE_FACTOR;
|
||||
c1 = ((ip[1] - ip[2])) >> WHT_UPSCALE_FACTOR;
|
||||
d1 = ((ip[0] - ip[3])) >> WHT_UPSCALE_FACTOR;
|
||||
|
||||
op[0] = (a1 + b1 + 1)>>1;
|
||||
op[1] = (c1 + d1)>>1;
|
||||
op[2] = (a1 - b1)>>1;
|
||||
op[3] = (d1 - c1)>>1;
|
||||
op[0] = (a1 + b1 + 1) >> 1;
|
||||
op[1] = (c1 + d1) >> 1;
|
||||
op[2] = (a1 - b1) >> 1;
|
||||
op[3] = (d1 - c1) >> 1;
|
||||
|
||||
ip += 4;
|
||||
op += shortpitch;
|
||||
}
|
||||
ip += 4;
|
||||
op += shortpitch;
|
||||
}
|
||||
|
||||
ip = output;
|
||||
op = output;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a1 = ip[shortpitch*0] + ip[shortpitch*3];
|
||||
b1 = ip[shortpitch*1] + ip[shortpitch*2];
|
||||
c1 = ip[shortpitch*1] - ip[shortpitch*2];
|
||||
d1 = ip[shortpitch*0] - ip[shortpitch*3];
|
||||
ip = output;
|
||||
op = output;
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[shortpitch * 0] + ip[shortpitch * 3];
|
||||
b1 = ip[shortpitch * 1] + ip[shortpitch * 2];
|
||||
c1 = ip[shortpitch * 1] - ip[shortpitch * 2];
|
||||
d1 = ip[shortpitch * 0] - ip[shortpitch * 3];
|
||||
|
||||
|
||||
op[shortpitch*0] = (a1 + b1 + 1)>>1;
|
||||
op[shortpitch*1] = (c1 + d1)>>1;
|
||||
op[shortpitch*2] = (a1 - b1)>>1;
|
||||
op[shortpitch*3] = (d1 - c1)>>1;
|
||||
op[shortpitch * 0] = (a1 + b1 + 1) >> 1;
|
||||
op[shortpitch * 1] = (c1 + d1) >> 1;
|
||||
op[shortpitch * 2] = (a1 - b1) >> 1;
|
||||
op[shortpitch * 3] = (d1 - c1) >> 1;
|
||||
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_short_inv_walsh4x4_1_x8_c(short *in, short *out, int pitch)
|
||||
{
|
||||
int i;
|
||||
short tmp[4];
|
||||
short *ip = in;
|
||||
short *op = tmp;
|
||||
int shortpitch = pitch >> 1;
|
||||
void vp8_short_inv_walsh4x4_1_x8_c(short *in, short *out, int pitch) {
|
||||
int i;
|
||||
short tmp[4];
|
||||
short *ip = in;
|
||||
short *op = tmp;
|
||||
int shortpitch = pitch >> 1;
|
||||
|
||||
op[0] =((ip[0]>>WHT_UPSCALE_FACTOR) + 1)>>1;
|
||||
op[1] = op[2] = op[3] = ((ip[0]>>WHT_UPSCALE_FACTOR)>>1);
|
||||
op[0] = ((ip[0] >> WHT_UPSCALE_FACTOR) + 1) >> 1;
|
||||
op[1] = op[2] = op[3] = ((ip[0] >> WHT_UPSCALE_FACTOR) >> 1);
|
||||
|
||||
|
||||
ip = tmp;
|
||||
op = out;
|
||||
for(i = 0; i<4; i++)
|
||||
{
|
||||
op[shortpitch*0] =(ip[0]+ 1)>>1;
|
||||
op[shortpitch*1] = op[shortpitch*2] = op[shortpitch*3] = ip[0]>>1;
|
||||
ip ++;
|
||||
op ++;
|
||||
}
|
||||
ip = tmp;
|
||||
op = out;
|
||||
for (i = 0; i < 4; i++) {
|
||||
op[shortpitch * 0] = (ip[0] + 1) >> 1;
|
||||
op[shortpitch * 1] = op[shortpitch * 2] = op[shortpitch * 3] = ip[0] >> 1;
|
||||
ip++;
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dc_only_inv_walsh_add_c(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride)
|
||||
{
|
||||
int r, c;
|
||||
short tmp[16];
|
||||
vp8_short_inv_walsh4x4_1_x8_c( &input_dc, tmp, 4<<1);
|
||||
void vp8_dc_only_inv_walsh_add_c(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride) {
|
||||
int r, c;
|
||||
short tmp[16];
|
||||
vp8_short_inv_walsh4x4_1_x8_c(&input_dc, tmp, 4 << 1);
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = tmp[r*4 + c] + pred_ptr[c] ;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = tmp[r * 4 + c] + pred_ptr[c];
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
}
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void vp8_dc_only_idct_add_8x8_c(short input_dc,
|
||||
unsigned char *pred_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int pitch, int stride)
|
||||
{
|
||||
int a1 = ((input_dc + 16) >> 5);
|
||||
int r, c, b;
|
||||
unsigned char *orig_pred = pred_ptr;
|
||||
unsigned char *orig_dst = dst_ptr;
|
||||
for (b = 0; b < 4; b++)
|
||||
{
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = a1 + pred_ptr[c] ;
|
||||
int pitch, int stride) {
|
||||
int a1 = ((input_dc + 16) >> 5);
|
||||
int r, c, b;
|
||||
unsigned char *orig_pred = pred_ptr;
|
||||
unsigned char *orig_dst = dst_ptr;
|
||||
for (b = 0; b < 4; b++) {
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = a1 + pred_ptr[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
}
|
||||
dst_ptr = orig_dst + (b+1)%2*4 + (b+1)/2*4*stride;
|
||||
pred_ptr = orig_pred + (b+1)%2*4 + (b+1)/2*4*pitch;
|
||||
dst_ptr += stride;
|
||||
pred_ptr += pitch;
|
||||
}
|
||||
dst_ptr = orig_dst + (b + 1) % 2 * 4 + (b + 1) / 2 * 4 * stride;
|
||||
pred_ptr = orig_pred + (b + 1) % 2 * 4 + (b + 1) / 2 * 4 * pitch;
|
||||
}
|
||||
}
|
||||
|
||||
#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
|
||||
@ -402,55 +372,53 @@ void vp8_dc_only_idct_add_8x8_c(short input_dc,
|
||||
*
|
||||
* where: c[0] = 128 c[1..7] = 128*sqrt(2) */
|
||||
|
||||
static void idctrow (int *blk)
|
||||
{
|
||||
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
|
||||
/* shortcut */
|
||||
if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
|
||||
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3])))
|
||||
{
|
||||
blk[0] = blk[1] = blk[2] = blk[3] = blk[4]
|
||||
= blk[5] = blk[6] = blk[7] = blk[0] << 3;
|
||||
return;
|
||||
}
|
||||
static void idctrow(int *blk) {
|
||||
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
|
||||
/* shortcut */
|
||||
if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
|
||||
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
|
||||
blk[0] = blk[1] = blk[2] = blk[3] = blk[4]
|
||||
= blk[5] = blk[6] = blk[7] = blk[0] << 3;
|
||||
return;
|
||||
}
|
||||
|
||||
x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
|
||||
/* first stage */
|
||||
x8 = W7 * (x4 + x5);
|
||||
x4 = x8 + (W1 - W7) * x4;
|
||||
x5 = x8 - (W1 + W7) * x5;
|
||||
x8 = W3 * (x6 + x7);
|
||||
x6 = x8 - (W3 - W5) * x6;
|
||||
x7 = x8 - (W3 + W5) * x7;
|
||||
x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
|
||||
/* first stage */
|
||||
x8 = W7 * (x4 + x5);
|
||||
x4 = x8 + (W1 - W7) * x4;
|
||||
x5 = x8 - (W1 + W7) * x5;
|
||||
x8 = W3 * (x6 + x7);
|
||||
x6 = x8 - (W3 - W5) * x6;
|
||||
x7 = x8 - (W3 + W5) * x7;
|
||||
|
||||
/* second stage */
|
||||
x8 = x0 + x1;
|
||||
x0 -= x1;
|
||||
x1 = W6 * (x3 + x2);
|
||||
x2 = x1 - (W2 + W6) * x2;
|
||||
x3 = x1 + (W2 - W6) * x3;
|
||||
x1 = x4 + x6;
|
||||
x4 -= x6;
|
||||
x6 = x5 + x7;
|
||||
x5 -= x7;
|
||||
/* second stage */
|
||||
x8 = x0 + x1;
|
||||
x0 -= x1;
|
||||
x1 = W6 * (x3 + x2);
|
||||
x2 = x1 - (W2 + W6) * x2;
|
||||
x3 = x1 + (W2 - W6) * x3;
|
||||
x1 = x4 + x6;
|
||||
x4 -= x6;
|
||||
x6 = x5 + x7;
|
||||
x5 -= x7;
|
||||
|
||||
/* third stage */
|
||||
x7 = x8 + x3;
|
||||
x8 -= x3;
|
||||
x3 = x0 + x2;
|
||||
x0 -= x2;
|
||||
x2 = (181 * (x4 + x5) + 128) >> 8;
|
||||
x4 = (181 * (x4 - x5) + 128) >> 8;
|
||||
/* third stage */
|
||||
x7 = x8 + x3;
|
||||
x8 -= x3;
|
||||
x3 = x0 + x2;
|
||||
x0 -= x2;
|
||||
x2 = (181 * (x4 + x5) + 128) >> 8;
|
||||
x4 = (181 * (x4 - x5) + 128) >> 8;
|
||||
|
||||
/* fourth stage */
|
||||
blk[0] = (x7 + x1) >> 8;
|
||||
blk[1] = (x3 + x2) >> 8;
|
||||
blk[2] = (x0 + x4) >> 8;
|
||||
blk[3] = (x8 + x6) >> 8;
|
||||
blk[4] = (x8 - x6) >> 8;
|
||||
blk[5] = (x0 - x4) >> 8;
|
||||
blk[6] = (x3 - x2) >> 8;
|
||||
blk[7] = (x7 - x1) >> 8;
|
||||
/* fourth stage */
|
||||
blk[0] = (x7 + x1) >> 8;
|
||||
blk[1] = (x3 + x2) >> 8;
|
||||
blk[2] = (x0 + x4) >> 8;
|
||||
blk[3] = (x8 + x6) >> 8;
|
||||
blk[4] = (x8 - x6) >> 8;
|
||||
blk[5] = (x0 - x4) >> 8;
|
||||
blk[6] = (x3 - x2) >> 8;
|
||||
blk[7] = (x7 - x1) >> 8;
|
||||
}
|
||||
|
||||
/* column (vertical) IDCT
|
||||
@ -459,105 +427,96 @@ static void idctrow (int *blk)
|
||||
* cos( -- * ( k + - ) * l ) l=0 8 2
|
||||
*
|
||||
* where: c[0] = 1/1024 c[1..7] = (1/1024)*sqrt(2) */
|
||||
static void idctcol (int *blk)
|
||||
{
|
||||
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
|
||||
static void idctcol(int *blk) {
|
||||
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
|
||||
|
||||
/* shortcut */
|
||||
if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
|
||||
/* shortcut */
|
||||
if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
|
||||
(x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) |
|
||||
(x7 = blk[8 * 3])))
|
||||
{
|
||||
blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3]
|
||||
= blk[8 * 4] = blk[8 * 5] = blk[8 * 6]
|
||||
= blk[8 * 7] = ((blk[8 * 0] + 32) >>6);
|
||||
return;
|
||||
}
|
||||
(x7 = blk[8 * 3]))) {
|
||||
blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3]
|
||||
= blk[8 * 4] = blk[8 * 5] = blk[8 * 6]
|
||||
= blk[8 * 7] = ((blk[8 * 0] + 32) >> 6);
|
||||
return;
|
||||
}
|
||||
|
||||
x0 = (blk[8 * 0] << 8) + 16384;
|
||||
x0 = (blk[8 * 0] << 8) + 16384;
|
||||
|
||||
/* first stage */
|
||||
x8 = W7 * (x4 + x5) + 4;
|
||||
x4 = (x8 + (W1 - W7) * x4) >> 3;
|
||||
x5 = (x8 - (W1 + W7) * x5) >> 3;
|
||||
x8 = W3 * (x6 + x7) + 4;
|
||||
x6 = (x8 - (W3 - W5) * x6) >> 3;
|
||||
x7 = (x8 - (W3 + W5) * x7) >> 3;
|
||||
/* first stage */
|
||||
x8 = W7 * (x4 + x5) + 4;
|
||||
x4 = (x8 + (W1 - W7) * x4) >> 3;
|
||||
x5 = (x8 - (W1 + W7) * x5) >> 3;
|
||||
x8 = W3 * (x6 + x7) + 4;
|
||||
x6 = (x8 - (W3 - W5) * x6) >> 3;
|
||||
x7 = (x8 - (W3 + W5) * x7) >> 3;
|
||||
|
||||
/* second stage */
|
||||
x8 = x0 + x1;
|
||||
x0 -= x1;
|
||||
x1 = W6 * (x3 + x2) + 4;
|
||||
x2 = (x1 - (W2 + W6) * x2) >> 3;
|
||||
x3 = (x1 + (W2 - W6) * x3) >> 3;
|
||||
x1 = x4 + x6;
|
||||
x4 -= x6;
|
||||
x6 = x5 + x7;
|
||||
x5 -= x7;
|
||||
/* second stage */
|
||||
x8 = x0 + x1;
|
||||
x0 -= x1;
|
||||
x1 = W6 * (x3 + x2) + 4;
|
||||
x2 = (x1 - (W2 + W6) * x2) >> 3;
|
||||
x3 = (x1 + (W2 - W6) * x3) >> 3;
|
||||
x1 = x4 + x6;
|
||||
x4 -= x6;
|
||||
x6 = x5 + x7;
|
||||
x5 -= x7;
|
||||
|
||||
/* third stage */
|
||||
x7 = x8 + x3;
|
||||
x8 -= x3;
|
||||
x3 = x0 + x2;
|
||||
x0 -= x2;
|
||||
x2 = (181 * (x4 + x5) + 128) >> 8;
|
||||
x4 = (181 * (x4 - x5) + 128) >> 8;
|
||||
/* third stage */
|
||||
x7 = x8 + x3;
|
||||
x8 -= x3;
|
||||
x3 = x0 + x2;
|
||||
x0 -= x2;
|
||||
x2 = (181 * (x4 + x5) + 128) >> 8;
|
||||
x4 = (181 * (x4 - x5) + 128) >> 8;
|
||||
|
||||
/* fourth stage */
|
||||
blk[8 * 0] = (x7 + x1 ) >> 14;
|
||||
blk[8 * 1] = (x3 + x2 ) >> 14;
|
||||
blk[8 * 2] = (x0 + x4 ) >> 14;
|
||||
blk[8 * 3] = (x8 + x6 ) >> 14;
|
||||
blk[8 * 4] = (x8 - x6 ) >> 14;
|
||||
blk[8 * 5] = (x0 - x4 ) >> 14;
|
||||
blk[8 * 6] = (x3 - x2 ) >> 14;
|
||||
blk[8 * 7] = (x7 - x1 ) >> 14;
|
||||
/* fourth stage */
|
||||
blk[8 * 0] = (x7 + x1) >> 14;
|
||||
blk[8 * 1] = (x3 + x2) >> 14;
|
||||
blk[8 * 2] = (x0 + x4) >> 14;
|
||||
blk[8 * 3] = (x8 + x6) >> 14;
|
||||
blk[8 * 4] = (x8 - x6) >> 14;
|
||||
blk[8 * 5] = (x0 - x4) >> 14;
|
||||
blk[8 * 6] = (x3 - x2) >> 14;
|
||||
blk[8 * 7] = (x7 - x1) >> 14;
|
||||
}
|
||||
|
||||
#define TX_DIM 8
|
||||
void vp8_short_idct8x8_c(short *coefs, short *block, int pitch)
|
||||
{
|
||||
int X[TX_DIM*TX_DIM];
|
||||
int i,j;
|
||||
int shortpitch = pitch >> 1;
|
||||
void vp8_short_idct8x8_c(short *coefs, short *block, int pitch) {
|
||||
int X[TX_DIM * TX_DIM];
|
||||
int i, j;
|
||||
int shortpitch = pitch >> 1;
|
||||
|
||||
for (i = 0; i < TX_DIM; i++)
|
||||
{
|
||||
for (j = 0; j < TX_DIM; j++)
|
||||
{
|
||||
X[i * TX_DIM + j] = (int)(coefs[i * TX_DIM + j]+1
|
||||
+ (coefs[i * TX_DIM + j]<0))>>2;
|
||||
}
|
||||
for (i = 0; i < TX_DIM; i++) {
|
||||
for (j = 0; j < TX_DIM; j++) {
|
||||
X[i * TX_DIM + j] = (int)(coefs[i * TX_DIM + j] + 1
|
||||
+ (coefs[i * TX_DIM + j] < 0)) >> 2;
|
||||
}
|
||||
for (i = 0; i < 8; i++)
|
||||
idctrow (X + 8 * i);
|
||||
}
|
||||
for (i = 0; i < 8; i++)
|
||||
idctrow(X + 8 * i);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
idctcol (X + i);
|
||||
for (i = 0; i < 8; i++)
|
||||
idctcol(X + i);
|
||||
|
||||
for (i = 0; i < TX_DIM; i++)
|
||||
{
|
||||
for (j = 0; j < TX_DIM; j++)
|
||||
{
|
||||
block[i*shortpitch+j] = X[i * TX_DIM + j]>>1;
|
||||
}
|
||||
for (i = 0; i < TX_DIM; i++) {
|
||||
for (j = 0; j < TX_DIM; j++) {
|
||||
block[i * shortpitch + j] = X[i * TX_DIM + j] >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp8_short_ihaar2x2_c(short *input, short *output, int pitch)
|
||||
{
|
||||
int i;
|
||||
short *ip = input; //0,1, 4, 8
|
||||
short *op = output;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
op[i] = 0;
|
||||
}
|
||||
void vp8_short_ihaar2x2_c(short *input, short *output, int pitch) {
|
||||
int i;
|
||||
short *ip = input; // 0,1, 4, 8
|
||||
short *op = output;
|
||||
for (i = 0; i < 16; i++) {
|
||||
op[i] = 0;
|
||||
}
|
||||
|
||||
op[0] = (ip[0] + ip[1] + ip[4] + ip[8] + 1)>>1;
|
||||
op[1] = (ip[0] - ip[1] + ip[4] - ip[8])>>1;
|
||||
op[4] = (ip[0] + ip[1] - ip[4] - ip[8])>>1;
|
||||
op[8] = (ip[0] - ip[1] - ip[4] + ip[8])>>1;
|
||||
op[0] = (ip[0] + ip[1] + ip[4] + ip[8] + 1) >> 1;
|
||||
op[1] = (ip[0] - ip[1] + ip[4] - ip[8]) >> 1;
|
||||
op[4] = (ip[0] + ip[1] - ip[4] - ip[8]) >> 1;
|
||||
op[8] = (ip[0] - ip[1] - ip[4] + ip[8]) >> 1;
|
||||
}
|
||||
|
||||
|
@ -20,16 +20,15 @@
|
||||
// this linked list structure holds equivalences for connected
|
||||
// component labeling
|
||||
struct list_el {
|
||||
int label;
|
||||
int seg_value;
|
||||
int count;
|
||||
struct list_el * next;
|
||||
int label;
|
||||
int seg_value;
|
||||
int count;
|
||||
struct list_el *next;
|
||||
};
|
||||
typedef struct list_el item;
|
||||
|
||||
// connected colorsegments
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
int min_x;
|
||||
int min_y;
|
||||
int max_x;
|
||||
@ -42,8 +41,7 @@ typedef struct
|
||||
} segment_info;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
SEGMENT_MODE,
|
||||
SEGMENT_MV,
|
||||
SEGMENT_REFFRAME,
|
||||
@ -54,8 +52,7 @@ typedef enum
|
||||
// this merges the two equivalence lists and
|
||||
// then makes sure that every label points to the same
|
||||
// equivalence list
|
||||
void merge ( item *labels, int u, int v )
|
||||
{
|
||||
void merge(item *labels, int u, int v) {
|
||||
item *a = labels[u].next;
|
||||
item *b = labels[v].next;
|
||||
item c;
|
||||
@ -63,21 +60,17 @@ void merge ( item *labels, int u, int v )
|
||||
int count;
|
||||
|
||||
// check if they are already merged
|
||||
if(u==v || a==b)
|
||||
if (u == v || a == b)
|
||||
return;
|
||||
|
||||
count = a->count + b->count;
|
||||
|
||||
// merge 2 sorted linked lists.
|
||||
while ( a != NULL && b != NULL )
|
||||
{
|
||||
if ( a->label < b->label)
|
||||
{
|
||||
while (a != NULL && b != NULL) {
|
||||
if (a->label < b->label) {
|
||||
it->next = a;
|
||||
a = a->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
it->next = b;
|
||||
b = b->next;
|
||||
}
|
||||
@ -85,7 +78,7 @@ void merge ( item *labels, int u, int v )
|
||||
it = it->next;
|
||||
}
|
||||
|
||||
if ( a == NULL )
|
||||
if (a == NULL)
|
||||
it->next = b;
|
||||
else
|
||||
it->next = a;
|
||||
@ -93,187 +86,169 @@ void merge ( item *labels, int u, int v )
|
||||
it = c.next;
|
||||
|
||||
// make sure every equivalence in the linked list points to this new ll
|
||||
while( it != NULL)
|
||||
{
|
||||
while (it != NULL) {
|
||||
labels[it->label].next = c.next;
|
||||
it=it->next;
|
||||
it = it->next;
|
||||
}
|
||||
c.next->count = count;
|
||||
|
||||
}
|
||||
|
||||
void segment_via_mode_info( VP8_COMMON *oci, int how)
|
||||
{
|
||||
MODE_INFO *mi = oci->mi;
|
||||
int i,j;
|
||||
int mb_index = 0;
|
||||
void segment_via_mode_info(VP8_COMMON *oci, int how) {
|
||||
MODE_INFO *mi = oci->mi;
|
||||
int i, j;
|
||||
int mb_index = 0;
|
||||
|
||||
int label=1;
|
||||
int pitch = oci->mb_cols;
|
||||
int label = 1;
|
||||
int pitch = oci->mb_cols;
|
||||
|
||||
// holds linked list equivalences
|
||||
// the max should probably be allocated at a higher level in oci
|
||||
item equivalences[MAX_REGIONS];
|
||||
int eq_ptr = 0;
|
||||
item labels[MAX_REGIONS];
|
||||
segment_info segments[MAX_REGIONS];
|
||||
int label_count = 1;
|
||||
int labeling[400*300];
|
||||
int *lp = labeling;
|
||||
// holds linked list equivalences
|
||||
// the max should probably be allocated at a higher level in oci
|
||||
item equivalences[MAX_REGIONS];
|
||||
int eq_ptr = 0;
|
||||
item labels[MAX_REGIONS];
|
||||
segment_info segments[MAX_REGIONS];
|
||||
int label_count = 1;
|
||||
int labeling[400 * 300];
|
||||
int *lp = labeling;
|
||||
|
||||
label_count = 1;
|
||||
memset(labels,0,sizeof(labels));
|
||||
memset(segments,0,sizeof(segments));
|
||||
label_count = 1;
|
||||
memset(labels, 0, sizeof(labels));
|
||||
memset(segments, 0, sizeof(segments));
|
||||
|
||||
/* Go through each macroblock first pass labelling */
|
||||
for (i = 0; i < oci->mb_rows; i++,lp+=pitch)
|
||||
{
|
||||
for (j = 0; j < oci->mb_cols; j++)
|
||||
{
|
||||
// int above seg_value, left seg_value, this seg_value...
|
||||
int a=-1,l=-1,n=-1;
|
||||
/* Go through each macroblock first pass labelling */
|
||||
for (i = 0; i < oci->mb_rows; i++, lp += pitch) {
|
||||
for (j = 0; j < oci->mb_cols; j++) {
|
||||
// int above seg_value, left seg_value, this seg_value...
|
||||
int a = -1, l = -1, n = -1;
|
||||
|
||||
// above label, left label
|
||||
int al=-1,ll=-1;
|
||||
if(i)
|
||||
{
|
||||
al=lp[j-pitch];
|
||||
a = labels[al].next->seg_value;
|
||||
}
|
||||
if(j)
|
||||
{
|
||||
ll=lp[j-1];
|
||||
l = labels[ll].next->seg_value;
|
||||
}
|
||||
// above label, left label
|
||||
int al = -1, ll = -1;
|
||||
if (i) {
|
||||
al = lp[j - pitch];
|
||||
a = labels[al].next->seg_value;
|
||||
}
|
||||
if (j) {
|
||||
ll = lp[j - 1];
|
||||
l = labels[ll].next->seg_value;
|
||||
}
|
||||
|
||||
// what setting are we going to do the implicit segmentation on
|
||||
switch (how)
|
||||
{
|
||||
case SEGMENT_MODE:
|
||||
n= mi[mb_index].mbmi.mode;
|
||||
break;
|
||||
case SEGMENT_MV:
|
||||
n = mi[mb_index].mbmi.mv.as_int;
|
||||
if(mi[mb_index].mbmi.ref_frame == INTRA_FRAME)
|
||||
n=-9999999;
|
||||
break;
|
||||
case SEGMENT_REFFRAME:
|
||||
n = mi[mb_index].mbmi.ref_frame;
|
||||
break;
|
||||
case SEGMENT_SKIPPED:
|
||||
n = mi[mb_index].mbmi.mb_skip_coeff;
|
||||
break;
|
||||
}
|
||||
// what setting are we going to do the implicit segmentation on
|
||||
switch (how) {
|
||||
case SEGMENT_MODE:
|
||||
n = mi[mb_index].mbmi.mode;
|
||||
break;
|
||||
case SEGMENT_MV:
|
||||
n = mi[mb_index].mbmi.mv.as_int;
|
||||
if (mi[mb_index].mbmi.ref_frame == INTRA_FRAME)
|
||||
n = -9999999;
|
||||
break;
|
||||
case SEGMENT_REFFRAME:
|
||||
n = mi[mb_index].mbmi.ref_frame;
|
||||
break;
|
||||
case SEGMENT_SKIPPED:
|
||||
n = mi[mb_index].mbmi.mb_skip_coeff;
|
||||
break;
|
||||
}
|
||||
|
||||
// above and left both have the same seg_value
|
||||
if(n==a&&n==l)
|
||||
{
|
||||
// pick the lowest label
|
||||
lp[j] = (al<ll?al:ll);
|
||||
labels[lp[j]].next->count++;
|
||||
// above and left both have the same seg_value
|
||||
if (n == a && n == l) {
|
||||
// pick the lowest label
|
||||
lp[j] = (al < ll ? al : ll);
|
||||
labels[lp[j]].next->count++;
|
||||
|
||||
// merge the above and left equivalencies
|
||||
merge( labels, al, ll );
|
||||
}
|
||||
// this matches above seg_value
|
||||
else if(n==a)
|
||||
{
|
||||
// give it the same label as above
|
||||
lp[j]=al;
|
||||
labels[al].next->count++;
|
||||
}
|
||||
// this matches left seg_value
|
||||
else if(n==l)
|
||||
{
|
||||
// give it the same label as above
|
||||
lp[j]=ll;
|
||||
labels[ll].next->count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// new label doesn't match either
|
||||
item *e = &labels[label];
|
||||
item *nl = &equivalences[eq_ptr++];
|
||||
lp[j]=label;
|
||||
nl->label = label;
|
||||
nl->next = 0;
|
||||
nl->seg_value = n;
|
||||
nl->count = 1;
|
||||
e->next = nl;
|
||||
label++;
|
||||
}
|
||||
mb_index++;
|
||||
// merge the above and left equivalencies
|
||||
merge(labels, al, ll);
|
||||
}
|
||||
// this matches above seg_value
|
||||
else if (n == a) {
|
||||
// give it the same label as above
|
||||
lp[j] = al;
|
||||
labels[al].next->count++;
|
||||
}
|
||||
// this matches left seg_value
|
||||
else if (n == l) {
|
||||
// give it the same label as above
|
||||
lp[j] = ll;
|
||||
labels[ll].next->count++;
|
||||
} else {
|
||||
// new label doesn't match either
|
||||
item *e = &labels[label];
|
||||
item *nl = &equivalences[eq_ptr++];
|
||||
lp[j] = label;
|
||||
nl->label = label;
|
||||
nl->next = 0;
|
||||
nl->seg_value = n;
|
||||
nl->count = 1;
|
||||
e->next = nl;
|
||||
label++;
|
||||
}
|
||||
mb_index++;
|
||||
}
|
||||
lp = labeling;
|
||||
mb_index++;
|
||||
}
|
||||
lp = labeling;
|
||||
|
||||
// give new labels to regions
|
||||
for(i=1;i<label;i++)
|
||||
if(labels[i].next->count >min_mbs_in_region && labels[labels[i].next->label].label == 0 )
|
||||
{
|
||||
segment_info *cs= &segments[label_count];
|
||||
cs->label = label_count;
|
||||
labels[labels[i].next->label].label = label_count++;
|
||||
labels[labels[i].next->label].seg_value = labels[i].next->seg_value;
|
||||
cs->seg_value = labels[labels[i].next->label].seg_value;
|
||||
cs->min_x = oci->mb_cols;
|
||||
cs->min_y = oci->mb_rows;
|
||||
cs->max_x = 0;
|
||||
cs->max_y = 0;
|
||||
cs->sum_x = 0;
|
||||
cs->sum_y = 0;
|
||||
cs->pixels= 0;
|
||||
// give new labels to regions
|
||||
for (i = 1; i < label; i++)
|
||||
if (labels[i].next->count > min_mbs_in_region && labels[labels[i].next->label].label == 0) {
|
||||
segment_info *cs = &segments[label_count];
|
||||
cs->label = label_count;
|
||||
labels[labels[i].next->label].label = label_count++;
|
||||
labels[labels[i].next->label].seg_value = labels[i].next->seg_value;
|
||||
cs->seg_value = labels[labels[i].next->label].seg_value;
|
||||
cs->min_x = oci->mb_cols;
|
||||
cs->min_y = oci->mb_rows;
|
||||
cs->max_x = 0;
|
||||
cs->max_y = 0;
|
||||
cs->sum_x = 0;
|
||||
cs->sum_y = 0;
|
||||
cs->pixels = 0;
|
||||
|
||||
}
|
||||
lp = labeling;
|
||||
}
|
||||
lp = labeling;
|
||||
|
||||
// this is just to gather stats...
|
||||
for(i=0;i<oci->mb_rows;i++,lp+=pitch)
|
||||
{
|
||||
for(j=0;j<oci->mb_cols;j++)
|
||||
{
|
||||
segment_info *cs;
|
||||
int oldlab = labels[lp[j]].next->label;
|
||||
int lab = labels[oldlab].label;
|
||||
lp[j] = lab;
|
||||
// this is just to gather stats...
|
||||
for (i = 0; i < oci->mb_rows; i++, lp += pitch) {
|
||||
for (j = 0; j < oci->mb_cols; j++) {
|
||||
segment_info *cs;
|
||||
int oldlab = labels[lp[j]].next->label;
|
||||
int lab = labels[oldlab].label;
|
||||
lp[j] = lab;
|
||||
|
||||
cs= &segments[lab];
|
||||
cs = &segments[lab];
|
||||
|
||||
cs->min_x = (j<cs->min_x?j:cs->min_x);
|
||||
cs->max_x = (j>cs->max_x?j:cs->max_x);
|
||||
cs->min_y = (i<cs->min_y?i:cs->min_y);
|
||||
cs->max_y = (i>cs->max_y?i:cs->max_y);
|
||||
cs->sum_x += j;
|
||||
cs->sum_y += i;
|
||||
cs->pixels ++;
|
||||
cs->min_x = (j < cs->min_x ? j : cs->min_x);
|
||||
cs->max_x = (j > cs->max_x ? j : cs->max_x);
|
||||
cs->min_y = (i < cs->min_y ? i : cs->min_y);
|
||||
cs->max_y = (i > cs->max_y ? i : cs->max_y);
|
||||
cs->sum_x += j;
|
||||
cs->sum_y += i;
|
||||
cs->pixels++;
|
||||
|
||||
lp[j] = lab;
|
||||
mb_index++;
|
||||
}
|
||||
lp[j] = lab;
|
||||
mb_index++;
|
||||
}
|
||||
mb_index++;
|
||||
}
|
||||
|
||||
{
|
||||
lp = labeling;
|
||||
printf("labelling \n");
|
||||
mb_index = 0;
|
||||
for(i=0;i<oci->mb_rows;i++,lp+=pitch)
|
||||
{
|
||||
for(j=0;j<oci->mb_cols;j++)
|
||||
{
|
||||
printf("%4d",lp[j]);
|
||||
}
|
||||
printf(" ");
|
||||
for(j=0;j<oci->mb_cols;j++,mb_index++)
|
||||
{
|
||||
//printf("%3d",mi[mb_index].mbmi.mode );
|
||||
printf("%4d:%4d",mi[mb_index].mbmi.mv.as_mv.row,mi[mb_index].mbmi.mv.as_mv.col );
|
||||
}
|
||||
printf("\n");
|
||||
++mb_index;
|
||||
{
|
||||
lp = labeling;
|
||||
printf("labelling \n");
|
||||
mb_index = 0;
|
||||
for (i = 0; i < oci->mb_rows; i++, lp += pitch) {
|
||||
for (j = 0; j < oci->mb_cols; j++) {
|
||||
printf("%4d", lp[j]);
|
||||
}
|
||||
printf(" ");
|
||||
for (j = 0; j < oci->mb_cols; j++, mb_index++) {
|
||||
// printf("%3d",mi[mb_index].mbmi.mode );
|
||||
printf("%4d:%4d", mi[mb_index].mbmi.mv.as_mv.row, mi[mb_index].mbmi.mv.as_mv.col);
|
||||
}
|
||||
printf("\n");
|
||||
++mb_index;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,161 +13,138 @@
|
||||
|
||||
|
||||
|
||||
static void recon_dcblock(MACROBLOCKD *x)
|
||||
{
|
||||
BLOCKD *b = &x->block[24];
|
||||
int i;
|
||||
static void recon_dcblock(MACROBLOCKD *x) {
|
||||
BLOCKD *b = &x->block[24];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
x->block[i].dqcoeff[0] = b->diff[i];
|
||||
}
|
||||
for (i = 0; i < 16; i++) {
|
||||
x->block[i].dqcoeff[0] = b->diff[i];
|
||||
}
|
||||
|
||||
}
|
||||
static void recon_dcblock_8x8(MACROBLOCKD *x)
|
||||
{
|
||||
BLOCKD *b = &x->block[24]; //for coeff 0, 2, 8, 10
|
||||
x->block[0].dqcoeff[0] = b->diff[0];
|
||||
x->block[4].dqcoeff[0] = b->diff[1];
|
||||
x->block[8].dqcoeff[0] = b->diff[4];
|
||||
x->block[12].dqcoeff[0] = b->diff[8];
|
||||
static void recon_dcblock_8x8(MACROBLOCKD *x) {
|
||||
BLOCKD *b = &x->block[24]; // for coeff 0, 2, 8, 10
|
||||
x->block[0].dqcoeff[0] = b->diff[0];
|
||||
x->block[4].dqcoeff[0] = b->diff[1];
|
||||
x->block[8].dqcoeff[0] = b->diff[4];
|
||||
x->block[12].dqcoeff[0] = b->diff[8];
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_b(const vp8_idct_rtcd_vtable_t *rtcd, BLOCKD *b, int pitch)
|
||||
{
|
||||
if (b->eob <= 1)
|
||||
IDCT_INVOKE(rtcd, idct1)(b->dqcoeff, b->diff, pitch);
|
||||
else
|
||||
IDCT_INVOKE(rtcd, idct16)(b->dqcoeff, b->diff, pitch);
|
||||
void vp8_inverse_transform_b(const vp8_idct_rtcd_vtable_t *rtcd, BLOCKD *b, int pitch) {
|
||||
if (b->eob <= 1)
|
||||
IDCT_INVOKE(rtcd, idct1)(b->dqcoeff, b->diff, pitch);
|
||||
else
|
||||
IDCT_INVOKE(rtcd, idct16)(b->dqcoeff, b->diff, pitch);
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_mby(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
int i;
|
||||
void vp8_inverse_transform_mby(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
int i;
|
||||
|
||||
/* do 2nd order transform on the dc block */
|
||||
IDCT_INVOKE(rtcd, iwalsh16)(x->block[24].dqcoeff, x->block[24].diff);
|
||||
|
||||
recon_dcblock(x);
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 32);
|
||||
}
|
||||
|
||||
}
|
||||
void vp8_inverse_transform_mbuv(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
int i;
|
||||
|
||||
for (i = 16; i < 24; i++) {
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_mb(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
int i;
|
||||
|
||||
if (x->mode_info_context->mbmi.mode != B_PRED &&
|
||||
x->mode_info_context->mbmi.mode != I8X8_PRED &&
|
||||
x->mode_info_context->mbmi.mode != SPLITMV) {
|
||||
/* do 2nd order transform on the dc block */
|
||||
IDCT_INVOKE(rtcd, iwalsh16)(x->block[24].dqcoeff, x->block[24].diff);
|
||||
|
||||
IDCT_INVOKE(rtcd, iwalsh16)(&x->block[24].dqcoeff[0], x->block[24].diff);
|
||||
recon_dcblock(x);
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 32);
|
||||
}
|
||||
for (i = 0; i < 16; i++) {
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 32);
|
||||
}
|
||||
|
||||
}
|
||||
void vp8_inverse_transform_mbuv(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 16; i < 24; i++)
|
||||
{
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 16);
|
||||
}
|
||||
for (i = 16; i < 24; i++) {
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_mb(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (x->mode_info_context->mbmi.mode != B_PRED &&
|
||||
x->mode_info_context->mbmi.mode != I8X8_PRED &&
|
||||
x->mode_info_context->mbmi.mode != SPLITMV)
|
||||
{
|
||||
/* do 2nd order transform on the dc block */
|
||||
|
||||
IDCT_INVOKE(rtcd, iwalsh16)(&x->block[24].dqcoeff[0], x->block[24].diff);
|
||||
recon_dcblock(x);
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 32);
|
||||
}
|
||||
|
||||
|
||||
for (i = 16; i < 24; i++)
|
||||
{
|
||||
vp8_inverse_transform_b(rtcd, &x->block[i], 16);
|
||||
}
|
||||
void vp8_inverse_transform_b_8x8(const vp8_idct_rtcd_vtable_t *rtcd, short *input_dqcoeff, short *output_coeff, int pitch) { // pay attention to use when 8x8
|
||||
// int b,i;
|
||||
// if (b->eob > 1)
|
||||
IDCT_INVOKE(rtcd, idct8)(input_dqcoeff, output_coeff, pitch);
|
||||
// else
|
||||
// IDCT_INVOKE(rtcd, idct8_1)(b->dqcoeff, b->diff, pitch);//pitch
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_b_8x8(const vp8_idct_rtcd_vtable_t *rtcd, short *input_dqcoeff, short *output_coeff, int pitch)//pay attention to use when 8x8
|
||||
{
|
||||
// int b,i;
|
||||
//if (b->eob > 1)
|
||||
IDCT_INVOKE(rtcd, idct8)(input_dqcoeff, output_coeff, pitch);
|
||||
//else
|
||||
//IDCT_INVOKE(rtcd, idct8_1)(b->dqcoeff, b->diff, pitch);//pitch
|
||||
void vp8_inverse_transform_mby_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
int i;
|
||||
|
||||
// do 2nd order transform on the dc block
|
||||
IDCT_INVOKE(rtcd, ihaar2)(x->block[24].dqcoeff, x->block[24].diff, 8);
|
||||
|
||||
recon_dcblock_8x8(x); // need to change for 8x8
|
||||
for (i = 0; i < 9; i += 8) {
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
for (i = 2; i < 11; i += 8) {
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i + 2].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
|
||||
}
|
||||
void vp8_inverse_transform_mbuv_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
int i;
|
||||
|
||||
for (i = 16; i < 24; i += 4) {
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_mby_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
int i;
|
||||
void vp8_inverse_transform_mb_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
int i;
|
||||
|
||||
if (x->mode_info_context->mbmi.mode != B_PRED &&
|
||||
x->mode_info_context->mbmi.mode != SPLITMV) {
|
||||
// do 2nd order transform on the dc block
|
||||
IDCT_INVOKE(rtcd, ihaar2)(x->block[24].dqcoeff, x->block[24].diff, 8);
|
||||
|
||||
recon_dcblock_8x8(x); //need to change for 8x8
|
||||
for (i = 0; i < 9; i += 8)
|
||||
{
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
for (i = 2; i < 11; i += 8)
|
||||
{
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i+2].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
IDCT_INVOKE(rtcd, ihaar2)(&x->block[24].dqcoeff[0], x->block[24].diff, 8);// dqcoeff[0]
|
||||
recon_dcblock_8x8(x); // need to change for 8x8
|
||||
|
||||
}
|
||||
void vp8_inverse_transform_mbuv_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
int i;
|
||||
}
|
||||
|
||||
for (i = 16; i < 24; i += 4)
|
||||
{
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_inverse_transform_mb_8x8(const vp8_idct_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (x->mode_info_context->mbmi.mode != B_PRED &&
|
||||
x->mode_info_context->mbmi.mode != SPLITMV)
|
||||
{
|
||||
// do 2nd order transform on the dc block
|
||||
|
||||
IDCT_INVOKE(rtcd, ihaar2)(&x->block[24].dqcoeff[0], x->block[24].diff, 8);//dqcoeff[0]
|
||||
recon_dcblock_8x8(x); //need to change for 8x8
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i += 8)
|
||||
{
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
for (i = 2; i < 11; i += 8)
|
||||
{
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i+2].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
|
||||
|
||||
for (i = 16; i < 24; i += 4)
|
||||
{
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 16);
|
||||
}
|
||||
for (i = 0; i < 9; i += 8) {
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
for (i = 2; i < 11; i += 8) {
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i + 2].dqcoeff[0], &x->block[i].diff[0], 32);
|
||||
}
|
||||
|
||||
|
||||
for (i = 16; i < 24; i += 4) {
|
||||
vp8_inverse_transform_b_8x8(rtcd, &x->block[i].dqcoeff[0], &x->block[i].diff[0], 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,10 +18,9 @@
|
||||
|
||||
#define MAX_LOOP_FILTER 63
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NORMAL_LOOPFILTER = 0,
|
||||
SIMPLE_LOOPFILTER = 1
|
||||
typedef enum {
|
||||
NORMAL_LOOPFILTER = 0,
|
||||
SIMPLE_LOOPFILTER = 1
|
||||
} LOOPFILTERTYPE;
|
||||
|
||||
#if ARCH_ARM
|
||||
@ -33,36 +32,34 @@ typedef enum
|
||||
/* Need to align this structure so when it is declared and
|
||||
* passed it can be loaded into vector registers.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
|
||||
unsigned char lvl[4][4][4];
|
||||
unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
|
||||
unsigned char mode_lf_lut[MB_MODE_COUNT];
|
||||
typedef struct {
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
|
||||
unsigned char lvl[4][4][4];
|
||||
unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
|
||||
unsigned char mode_lf_lut[MB_MODE_COUNT];
|
||||
} loop_filter_info_n;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const unsigned char * mblim;
|
||||
const unsigned char * blim;
|
||||
const unsigned char * lim;
|
||||
const unsigned char * hev_thr;
|
||||
typedef struct {
|
||||
const unsigned char *mblim;
|
||||
const unsigned char *blim;
|
||||
const unsigned char *lim;
|
||||
const unsigned char *hev_thr;
|
||||
} loop_filter_info;
|
||||
|
||||
|
||||
#define prototype_loopfilter(sym) \
|
||||
void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
|
||||
const unsigned char *limit, const unsigned char *thresh, int count)
|
||||
void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
|
||||
const unsigned char *limit, const unsigned char *thresh, int count)
|
||||
|
||||
#define prototype_loopfilter_block(sym) \
|
||||
void sym(unsigned char *y, unsigned char *u, unsigned char *v, \
|
||||
int ystride, int uv_stride, loop_filter_info *lfi)
|
||||
void sym(unsigned char *y, unsigned char *u, unsigned char *v, \
|
||||
int ystride, int uv_stride, loop_filter_info *lfi)
|
||||
|
||||
#define prototype_simple_loopfilter(sym) \
|
||||
void sym(unsigned char *y, int ystride, const unsigned char *blimit)
|
||||
void sym(unsigned char *y, int ystride, const unsigned char *blimit)
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#include "x86/loopfilter_x86.h"
|
||||
@ -115,16 +112,15 @@ extern prototype_simple_loopfilter(vp8_lf_simple_b_h);
|
||||
typedef prototype_loopfilter_block((*vp8_lf_block_fn_t));
|
||||
typedef prototype_simple_loopfilter((*vp8_slf_block_fn_t));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vp8_lf_block_fn_t normal_mb_v;
|
||||
vp8_lf_block_fn_t normal_b_v;
|
||||
vp8_lf_block_fn_t normal_mb_h;
|
||||
vp8_lf_block_fn_t normal_b_h;
|
||||
vp8_slf_block_fn_t simple_mb_v;
|
||||
vp8_slf_block_fn_t simple_b_v;
|
||||
vp8_slf_block_fn_t simple_mb_h;
|
||||
vp8_slf_block_fn_t simple_b_h;
|
||||
typedef struct {
|
||||
vp8_lf_block_fn_t normal_mb_v;
|
||||
vp8_lf_block_fn_t normal_b_v;
|
||||
vp8_lf_block_fn_t normal_mb_h;
|
||||
vp8_lf_block_fn_t normal_b_h;
|
||||
vp8_slf_block_fn_t simple_mb_v;
|
||||
vp8_slf_block_fn_t simple_b_v;
|
||||
vp8_slf_block_fn_t simple_mb_h;
|
||||
vp8_slf_block_fn_t simple_b_h;
|
||||
} vp8_loopfilter_rtcd_vtable_t;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
@ -135,12 +131,12 @@ typedef struct
|
||||
|
||||
typedef void loop_filter_uvfunction
|
||||
(
|
||||
unsigned char *u, /* source pointer */
|
||||
int p, /* pitch */
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
unsigned char *v
|
||||
unsigned char *u, /* source pointer */
|
||||
int p, /* pitch */
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
unsigned char *v
|
||||
);
|
||||
|
||||
/* assorted loopfilter functions which get used elsewhere */
|
||||
|
@ -16,44 +16,186 @@
|
||||
|
||||
typedef unsigned char uc;
|
||||
|
||||
static __inline signed char vp8_signed_char_clamp(int t)
|
||||
{
|
||||
t = (t < -128 ? -128 : t);
|
||||
t = (t > 127 ? 127 : t);
|
||||
return (signed char) t;
|
||||
static __inline signed char vp8_signed_char_clamp(int t) {
|
||||
t = (t < -128 ? -128 : t);
|
||||
t = (t > 127 ? 127 : t);
|
||||
return (signed char) t;
|
||||
}
|
||||
|
||||
|
||||
/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
|
||||
static __inline signed char vp8_filter_mask(uc limit, uc blimit,
|
||||
uc p3, uc p2, uc p1, uc p0,
|
||||
uc q0, uc q1, uc q2, uc q3)
|
||||
{
|
||||
signed char mask = 0;
|
||||
mask |= (abs(p3 - p2) > limit) * -1;
|
||||
mask |= (abs(p2 - p1) > limit) * -1;
|
||||
mask |= (abs(p1 - p0) > limit) * -1;
|
||||
mask |= (abs(q1 - q0) > limit) * -1;
|
||||
mask |= (abs(q2 - q1) > limit) * -1;
|
||||
mask |= (abs(q3 - q2) > limit) * -1;
|
||||
mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
|
||||
mask = ~mask;
|
||||
return mask;
|
||||
uc p3, uc p2, uc p1, uc p0,
|
||||
uc q0, uc q1, uc q2, uc q3) {
|
||||
signed char mask = 0;
|
||||
mask |= (abs(p3 - p2) > limit) * -1;
|
||||
mask |= (abs(p2 - p1) > limit) * -1;
|
||||
mask |= (abs(p1 - p0) > limit) * -1;
|
||||
mask |= (abs(q1 - q0) > limit) * -1;
|
||||
mask |= (abs(q2 - q1) > limit) * -1;
|
||||
mask |= (abs(q3 - q2) > limit) * -1;
|
||||
mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
|
||||
mask = ~mask;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* is there high variance internal edge ( 11111111 yes, 00000000 no) */
|
||||
static __inline signed char vp8_hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1)
|
||||
{
|
||||
signed char hev = 0;
|
||||
hev |= (abs(p1 - p0) > thresh) * -1;
|
||||
hev |= (abs(q1 - q0) > thresh) * -1;
|
||||
return hev;
|
||||
static __inline signed char vp8_hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1) {
|
||||
signed char hev = 0;
|
||||
hev |= (abs(p1 - p0) > thresh) * -1;
|
||||
hev |= (abs(q1 - q0) > thresh) * -1;
|
||||
return hev;
|
||||
}
|
||||
|
||||
static __inline void vp8_filter(signed char mask, uc hev, uc *op1,
|
||||
uc *op0, uc *oq0, uc *oq1)
|
||||
uc *op0, uc *oq0, uc *oq1)
|
||||
|
||||
{
|
||||
signed char ps0, qs0;
|
||||
signed char ps1, qs1;
|
||||
signed char vp8_filter, Filter1, Filter2;
|
||||
signed char u;
|
||||
|
||||
ps1 = (signed char) * op1 ^ 0x80;
|
||||
ps0 = (signed char) * op0 ^ 0x80;
|
||||
qs0 = (signed char) * oq0 ^ 0x80;
|
||||
qs1 = (signed char) * oq1 ^ 0x80;
|
||||
|
||||
/* add outer taps if we have high edge variance */
|
||||
vp8_filter = vp8_signed_char_clamp(ps1 - qs1);
|
||||
vp8_filter &= hev;
|
||||
|
||||
/* inner taps */
|
||||
vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0));
|
||||
vp8_filter &= mask;
|
||||
|
||||
/* save bottom 3 bits so that we round one side +4 and the other +3
|
||||
* if it equals 4 we'll set to adjust by -1 to account for the fact
|
||||
* we'd round 3 the other way
|
||||
*/
|
||||
Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
|
||||
Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
|
||||
Filter1 >>= 3;
|
||||
Filter2 >>= 3;
|
||||
u = vp8_signed_char_clamp(qs0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
u = vp8_signed_char_clamp(ps0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
vp8_filter = Filter1;
|
||||
|
||||
/* outer tap adjustments */
|
||||
vp8_filter += 1;
|
||||
vp8_filter >>= 1;
|
||||
vp8_filter &= ~hev;
|
||||
|
||||
u = vp8_signed_char_clamp(qs1 - vp8_filter);
|
||||
*oq1 = u ^ 0x80;
|
||||
u = vp8_signed_char_clamp(ps1 + vp8_filter);
|
||||
*op1 = u ^ 0x80;
|
||||
|
||||
}
|
||||
void vp8_loop_filter_horizontal_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p, /* pitch */
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
) {
|
||||
int hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
|
||||
/* loop filter designed to work using chars so that we can make maximum use
|
||||
* of 8 bit simd instructions.
|
||||
*/
|
||||
do {
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
|
||||
s[0 * p], s[1 * p], s[2 * p], s[3 * p]);
|
||||
|
||||
hev = vp8_hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
|
||||
|
||||
vp8_filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
|
||||
|
||||
++s;
|
||||
} while (++i < count * 8);
|
||||
}
|
||||
|
||||
void vp8_loop_filter_vertical_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
) {
|
||||
int hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
|
||||
/* loop filter designed to work using chars so that we can make maximum use
|
||||
* of 8 bit simd instructions.
|
||||
*/
|
||||
do {
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4], s[-3], s[-2], s[-1],
|
||||
s[0], s[1], s[2], s[3]);
|
||||
|
||||
hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
|
||||
|
||||
vp8_filter(mask, hev, s - 2, s - 1, s, s + 1);
|
||||
|
||||
s += p;
|
||||
} while (++i < count * 8);
|
||||
}
|
||||
static __inline signed char vp8_flatmask(uc thresh,
|
||||
uc p4, uc p3, uc p2, uc p1, uc p0,
|
||||
uc q0, uc q1, uc q2, uc q3, uc q4) {
|
||||
signed char flat = 0;
|
||||
flat |= (abs(p1 - p0) > 1) * -1;
|
||||
flat |= (abs(q1 - q0) > 1) * -1;
|
||||
flat |= (abs(p0 - p2) > 1) * -1;
|
||||
flat |= (abs(q0 - q2) > 1) * -1;
|
||||
flat |= (abs(p3 - p0) > 1) * -1;
|
||||
flat |= (abs(q3 - q0) > 1) * -1;
|
||||
flat |= (abs(p4 - p0) > 1) * -1;
|
||||
flat |= (abs(q4 - q0) > 1) * -1;
|
||||
flat = ~flat;
|
||||
return flat;
|
||||
}
|
||||
|
||||
static __inline void vp8_mbfilter(signed char mask, uc hev, uc flat,
|
||||
uc *op4, uc *op3, uc *op2, uc *op1, uc *op0,
|
||||
uc *oq0, uc *oq1, uc *oq2, uc *oq3, uc *oq4) {
|
||||
/* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
|
||||
if (flat && mask) {
|
||||
unsigned char p0, q0;
|
||||
unsigned char p1, q1;
|
||||
unsigned char p2, q2;
|
||||
unsigned char p3, q3;
|
||||
unsigned char p4, q4;
|
||||
|
||||
p4 = *op4;
|
||||
p3 = *op3;
|
||||
p2 = *op2;
|
||||
p1 = *op1;
|
||||
p0 = *op0;
|
||||
q0 = *oq0;
|
||||
q1 = *oq1;
|
||||
q2 = *oq2;
|
||||
q3 = *oq3;
|
||||
q4 = *oq4;
|
||||
|
||||
*op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
|
||||
*op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
|
||||
*op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
|
||||
*oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
|
||||
*oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3;
|
||||
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3;
|
||||
} else {
|
||||
signed char ps0, qs0;
|
||||
signed char ps1, qs1;
|
||||
signed char vp8_filter, Filter1, Filter2;
|
||||
@ -72,10 +214,6 @@ static __inline void vp8_filter(signed char mask, uc hev, uc *op1,
|
||||
vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0));
|
||||
vp8_filter &= mask;
|
||||
|
||||
/* save bottom 3 bits so that we round one side +4 and the other +3
|
||||
* if it equals 4 we'll set to adjust by -1 to account for the fact
|
||||
* we'd round 3 the other way
|
||||
*/
|
||||
Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
|
||||
Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
|
||||
Filter1 >>= 3;
|
||||
@ -95,315 +233,149 @@ static __inline void vp8_filter(signed char mask, uc hev, uc *op1,
|
||||
*oq1 = u ^ 0x80;
|
||||
u = vp8_signed_char_clamp(ps1 + vp8_filter);
|
||||
*op1 = u ^ 0x80;
|
||||
|
||||
}
|
||||
void vp8_loop_filter_horizontal_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p, /* pitch */
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
)
|
||||
{
|
||||
int hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
|
||||
/* loop filter designed to work using chars so that we can make maximum use
|
||||
* of 8 bit simd instructions.
|
||||
*/
|
||||
do
|
||||
{
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4*p], s[-3*p], s[-2*p], s[-1*p],
|
||||
s[0*p], s[1*p], s[2*p], s[3*p]);
|
||||
|
||||
hev = vp8_hevmask(thresh[0], s[-2*p], s[-1*p], s[0*p], s[1*p]);
|
||||
|
||||
vp8_filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
|
||||
|
||||
++s;
|
||||
}
|
||||
while (++i < count * 8);
|
||||
}
|
||||
|
||||
void vp8_loop_filter_vertical_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
)
|
||||
{
|
||||
int hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
|
||||
/* loop filter designed to work using chars so that we can make maximum use
|
||||
* of 8 bit simd instructions.
|
||||
*/
|
||||
do
|
||||
{
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4], s[-3], s[-2], s[-1],
|
||||
s[0], s[1], s[2], s[3]);
|
||||
|
||||
hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
|
||||
|
||||
vp8_filter(mask, hev, s - 2, s - 1, s, s + 1);
|
||||
|
||||
s += p;
|
||||
}
|
||||
while (++i < count * 8);
|
||||
}
|
||||
static __inline signed char vp8_flatmask(uc thresh,
|
||||
uc p4, uc p3, uc p2, uc p1, uc p0,
|
||||
uc q0, uc q1, uc q2, uc q3, uc q4)
|
||||
{
|
||||
signed char flat = 0;
|
||||
flat |= (abs(p1 - p0) > 1) * -1;
|
||||
flat |= (abs(q1 - q0) > 1) * -1;
|
||||
flat |= (abs(p0 - p2) > 1) * -1;
|
||||
flat |= (abs(q0 - q2) > 1) * -1;
|
||||
flat |= (abs(p3 - p0) > 1) * -1;
|
||||
flat |= (abs(q3 - q0) > 1) * -1;
|
||||
flat |= (abs(p4 - p0) > 1) * -1;
|
||||
flat |= (abs(q4 - q0) > 1) * -1;
|
||||
flat = ~flat;
|
||||
return flat;
|
||||
}
|
||||
|
||||
static __inline void vp8_mbfilter(signed char mask, uc hev, uc flat,
|
||||
uc *op4, uc *op3, uc *op2, uc *op1, uc *op0,
|
||||
uc *oq0, uc *oq1, uc *oq2, uc *oq3, uc *oq4)
|
||||
{
|
||||
/* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
|
||||
if(flat && mask)
|
||||
{
|
||||
unsigned char p0, q0;
|
||||
unsigned char p1, q1;
|
||||
unsigned char p2, q2;
|
||||
unsigned char p3, q3;
|
||||
unsigned char p4, q4;
|
||||
|
||||
p4 = *op4;
|
||||
p3 = *op3;
|
||||
p2 = *op2;
|
||||
p1 = *op1;
|
||||
p0 = *op0;
|
||||
q0 = *oq0;
|
||||
q1 = *oq1;
|
||||
q2 = *oq2;
|
||||
q3 = *oq3;
|
||||
q4 = *oq4;
|
||||
|
||||
*op2 = ( p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4)>>3;
|
||||
*op1 = ( p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4)>>3;
|
||||
*op0 = ( p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4)>>3;
|
||||
*oq0 = ( p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4)>>3;
|
||||
*oq1 = ( p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4)>>3;
|
||||
*oq2 = ( p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4)>>3;
|
||||
}
|
||||
else
|
||||
{
|
||||
signed char ps0, qs0;
|
||||
signed char ps1, qs1;
|
||||
signed char vp8_filter, Filter1, Filter2;
|
||||
signed char u;
|
||||
|
||||
ps1 = (signed char) * op1 ^ 0x80;
|
||||
ps0 = (signed char) * op0 ^ 0x80;
|
||||
qs0 = (signed char) * oq0 ^ 0x80;
|
||||
qs1 = (signed char) * oq1 ^ 0x80;
|
||||
|
||||
/* add outer taps if we have high edge variance */
|
||||
vp8_filter = vp8_signed_char_clamp(ps1 - qs1);
|
||||
vp8_filter &= hev;
|
||||
|
||||
/* inner taps */
|
||||
vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0));
|
||||
vp8_filter &= mask;
|
||||
|
||||
Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
|
||||
Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
|
||||
Filter1 >>= 3;
|
||||
Filter2 >>= 3;
|
||||
u = vp8_signed_char_clamp(qs0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
u = vp8_signed_char_clamp(ps0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
vp8_filter = Filter1;
|
||||
|
||||
/* outer tap adjustments */
|
||||
vp8_filter += 1;
|
||||
vp8_filter >>= 1;
|
||||
vp8_filter &= ~hev;
|
||||
|
||||
u = vp8_signed_char_clamp(qs1 - vp8_filter);
|
||||
*oq1 = u ^ 0x80;
|
||||
u = vp8_signed_char_clamp(ps1 + vp8_filter);
|
||||
*op1 = u ^ 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
void vp8_mbloop_filter_horizontal_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
)
|
||||
{
|
||||
signed char hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
signed char flat = 0;
|
||||
int i = 0;
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
) {
|
||||
signed char hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
signed char flat = 0;
|
||||
int i = 0;
|
||||
|
||||
/* loop filter designed to work using chars so that we can make maximum use
|
||||
* of 8 bit simd instructions.
|
||||
*/
|
||||
do
|
||||
{
|
||||
/* loop filter designed to work using chars so that we can make maximum use
|
||||
* of 8 bit simd instructions.
|
||||
*/
|
||||
do {
|
||||
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4*p], s[-3*p], s[-2*p], s[-1*p],
|
||||
s[ 0*p], s[ 1*p], s[ 2*p], s[ 3*p]);
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
|
||||
s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
|
||||
|
||||
hev = vp8_hevmask(thresh[0], s[-2*p], s[-1*p], s[0*p], s[1*p]);
|
||||
hev = vp8_hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
|
||||
|
||||
flat = vp8_flatmask(thresh[0],
|
||||
s[-5*p], s[-4*p], s[-3*p], s[-2*p], s[-1*p],
|
||||
s[ 0*p], s[ 1*p], s[ 2*p], s[ 3*p], s[ 4*p]);
|
||||
vp8_mbfilter(mask, hev, flat,
|
||||
s - 5*p, s - 4*p, s- 3*p, s - 2*p, s - 1*p,
|
||||
s, s + 1*p, s+ 2*p, s + 3*p, s + 4*p );
|
||||
flat = vp8_flatmask(thresh[0],
|
||||
s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
|
||||
s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]);
|
||||
vp8_mbfilter(mask, hev, flat,
|
||||
s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p);
|
||||
|
||||
++s;
|
||||
}
|
||||
while (++i < count * 8);
|
||||
++s;
|
||||
} while (++i < count * 8);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_mbloop_filter_vertical_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
)
|
||||
{
|
||||
signed char hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
signed char flat = 0;
|
||||
int i = 0;
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit,
|
||||
const unsigned char *limit,
|
||||
const unsigned char *thresh,
|
||||
int count
|
||||
) {
|
||||
signed char hev = 0; /* high edge variance */
|
||||
signed char mask = 0;
|
||||
signed char flat = 0;
|
||||
int i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4], s[-3], s[-2], s[-1],
|
||||
s[0], s[1], s[2], s[3]);
|
||||
mask = vp8_filter_mask(limit[0], blimit[0],
|
||||
s[-4], s[-3], s[-2], s[-1],
|
||||
s[0], s[1], s[2], s[3]);
|
||||
|
||||
hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
|
||||
flat = vp8_flatmask(thresh[0],
|
||||
s[-5],s[-4],s[-3],s[-2],s[-1],
|
||||
s[ 0],s[ 1],s[ 2],s[ 3],s[ 4]);
|
||||
vp8_mbfilter(mask, hev, flat,
|
||||
s - 5, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3, s + 4);
|
||||
s += p;
|
||||
}
|
||||
while (++i < count * 8);
|
||||
hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
|
||||
flat = vp8_flatmask(thresh[0],
|
||||
s[-5], s[-4], s[-3], s[-2], s[-1],
|
||||
s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
|
||||
vp8_mbfilter(mask, hev, flat,
|
||||
s - 5, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3, s + 4);
|
||||
s += p;
|
||||
} while (++i < count * 8);
|
||||
|
||||
}
|
||||
|
||||
/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
|
||||
static __inline signed char vp8_simple_filter_mask(uc blimit,
|
||||
uc p1, uc p0,
|
||||
uc q0, uc q1)
|
||||
{
|
||||
/* Why does this cause problems for win32?
|
||||
* error C2143: syntax error : missing ';' before 'type'
|
||||
* (void) limit;
|
||||
*/
|
||||
signed char mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1;
|
||||
return mask;
|
||||
uc q0, uc q1) {
|
||||
/* Why does this cause problems for win32?
|
||||
* error C2143: syntax error : missing ';' before 'type'
|
||||
* (void) limit;
|
||||
*/
|
||||
signed char mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1;
|
||||
return mask;
|
||||
}
|
||||
|
||||
static __inline void vp8_simple_filter(signed char mask,
|
||||
uc *op1, uc *op0,
|
||||
uc *oq0, uc *oq1)
|
||||
{
|
||||
signed char vp8_filter, Filter1, Filter2;
|
||||
signed char p1 = (signed char) * op1 ^ 0x80;
|
||||
signed char p0 = (signed char) * op0 ^ 0x80;
|
||||
signed char q0 = (signed char) * oq0 ^ 0x80;
|
||||
signed char q1 = (signed char) * oq1 ^ 0x80;
|
||||
signed char u;
|
||||
uc *oq0, uc *oq1) {
|
||||
signed char vp8_filter, Filter1, Filter2;
|
||||
signed char p1 = (signed char) * op1 ^ 0x80;
|
||||
signed char p0 = (signed char) * op0 ^ 0x80;
|
||||
signed char q0 = (signed char) * oq0 ^ 0x80;
|
||||
signed char q1 = (signed char) * oq1 ^ 0x80;
|
||||
signed char u;
|
||||
|
||||
vp8_filter = vp8_signed_char_clamp(p1 - q1);
|
||||
vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (q0 - p0));
|
||||
vp8_filter &= mask;
|
||||
vp8_filter = vp8_signed_char_clamp(p1 - q1);
|
||||
vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (q0 - p0));
|
||||
vp8_filter &= mask;
|
||||
|
||||
/* save bottom 3 bits so that we round one side +4 and the other +3 */
|
||||
Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
|
||||
Filter1 >>= 3;
|
||||
u = vp8_signed_char_clamp(q0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
/* save bottom 3 bits so that we round one side +4 and the other +3 */
|
||||
Filter1 = vp8_signed_char_clamp(vp8_filter + 4);
|
||||
Filter1 >>= 3;
|
||||
u = vp8_signed_char_clamp(q0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
|
||||
Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
|
||||
Filter2 >>= 3;
|
||||
u = vp8_signed_char_clamp(p0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
Filter2 = vp8_signed_char_clamp(vp8_filter + 3);
|
||||
Filter2 >>= 3;
|
||||
u = vp8_signed_char_clamp(p0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
}
|
||||
|
||||
void vp8_loop_filter_simple_horizontal_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit
|
||||
)
|
||||
{
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit
|
||||
) {
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
mask = vp8_simple_filter_mask(blimit[0],
|
||||
s[-2*p], s[-1*p],
|
||||
s[0*p], s[1*p]);
|
||||
vp8_simple_filter(mask,
|
||||
s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p);
|
||||
++s;
|
||||
}
|
||||
while (++i < 16);
|
||||
do {
|
||||
mask = vp8_simple_filter_mask(blimit[0],
|
||||
s[-2 * p], s[-1 * p],
|
||||
s[0 * p], s[1 * p]);
|
||||
vp8_simple_filter(mask,
|
||||
s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p);
|
||||
++s;
|
||||
} while (++i < 16);
|
||||
}
|
||||
|
||||
void vp8_loop_filter_simple_vertical_edge_c
|
||||
(
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit
|
||||
)
|
||||
{
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
unsigned char *s,
|
||||
int p,
|
||||
const unsigned char *blimit
|
||||
) {
|
||||
signed char mask = 0;
|
||||
int i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
mask = vp8_simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
|
||||
vp8_simple_filter(mask, s - 2, s - 1, s, s + 1);
|
||||
s += p;
|
||||
}
|
||||
while (++i < 16);
|
||||
do {
|
||||
mask = vp8_simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
|
||||
vp8_simple_filter(mask, s - 2, s - 1, s, s + 1);
|
||||
s += p;
|
||||
} while (++i < 16);
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,127 +11,107 @@
|
||||
|
||||
#include "blockd.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PRED = 0,
|
||||
DEST = 1
|
||||
typedef enum {
|
||||
PRED = 0,
|
||||
DEST = 1
|
||||
} BLOCKSET;
|
||||
|
||||
static void setup_block
|
||||
(
|
||||
BLOCKD *b,
|
||||
int mv_stride,
|
||||
unsigned char **base,
|
||||
unsigned char **base2,
|
||||
int Stride,
|
||||
int offset,
|
||||
BLOCKSET bs
|
||||
)
|
||||
{
|
||||
BLOCKD *b,
|
||||
int mv_stride,
|
||||
unsigned char **base,
|
||||
unsigned char **base2,
|
||||
int Stride,
|
||||
int offset,
|
||||
BLOCKSET bs
|
||||
) {
|
||||
|
||||
if (bs == DEST)
|
||||
{
|
||||
b->dst_stride = Stride;
|
||||
b->dst = offset;
|
||||
b->base_dst = base;
|
||||
}
|
||||
else
|
||||
{
|
||||
b->pre_stride = Stride;
|
||||
b->pre = offset;
|
||||
b->base_pre = base;
|
||||
b->base_second_pre = base2;
|
||||
}
|
||||
if (bs == DEST) {
|
||||
b->dst_stride = Stride;
|
||||
b->dst = offset;
|
||||
b->base_dst = base;
|
||||
} else {
|
||||
b->pre_stride = Stride;
|
||||
b->pre = offset;
|
||||
b->base_pre = base;
|
||||
b->base_second_pre = base2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs)
|
||||
{
|
||||
int block;
|
||||
static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs) {
|
||||
int block;
|
||||
|
||||
unsigned char **y, **u, **v;
|
||||
unsigned char **y2, **u2, **v2;
|
||||
unsigned char **y, **u, **v;
|
||||
unsigned char **y2, **u2, **v2;
|
||||
|
||||
if (bs == DEST)
|
||||
{
|
||||
y = &x->dst.y_buffer;
|
||||
u = &x->dst.u_buffer;
|
||||
v = &x->dst.v_buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = &x->pre.y_buffer;
|
||||
u = &x->pre.u_buffer;
|
||||
v = &x->pre.v_buffer;
|
||||
if (bs == DEST) {
|
||||
y = &x->dst.y_buffer;
|
||||
u = &x->dst.u_buffer;
|
||||
v = &x->dst.v_buffer;
|
||||
} else {
|
||||
y = &x->pre.y_buffer;
|
||||
u = &x->pre.u_buffer;
|
||||
v = &x->pre.v_buffer;
|
||||
|
||||
y2 = &x->second_pre.y_buffer;
|
||||
u2 = &x->second_pre.u_buffer;
|
||||
v2 = &x->second_pre.v_buffer;
|
||||
}
|
||||
y2 = &x->second_pre.y_buffer;
|
||||
u2 = &x->second_pre.u_buffer;
|
||||
v2 = &x->second_pre.v_buffer;
|
||||
}
|
||||
|
||||
for (block = 0; block < 16; block++) /* y blocks */
|
||||
{
|
||||
setup_block(&x->block[block], x->dst.y_stride, y, y2, x->dst.y_stride,
|
||||
(block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4, bs);
|
||||
}
|
||||
for (block = 0; block < 16; block++) { /* y blocks */
|
||||
setup_block(&x->block[block], x->dst.y_stride, y, y2, x->dst.y_stride,
|
||||
(block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4, bs);
|
||||
}
|
||||
|
||||
for (block = 16; block < 20; block++) /* U and V blocks */
|
||||
{
|
||||
setup_block(&x->block[block], x->dst.uv_stride, u, u2, x->dst.uv_stride,
|
||||
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
|
||||
for (block = 16; block < 20; block++) { /* U and V blocks */
|
||||
setup_block(&x->block[block], x->dst.uv_stride, u, u2, x->dst.uv_stride,
|
||||
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
|
||||
|
||||
setup_block(&x->block[block+4], x->dst.uv_stride, v, v2, x->dst.uv_stride,
|
||||
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
|
||||
}
|
||||
setup_block(&x->block[block + 4], x->dst.uv_stride, v, v2, x->dst.uv_stride,
|
||||
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_setup_block_dptrs(MACROBLOCKD *x)
|
||||
{
|
||||
int r, c;
|
||||
void vp8_setup_block_dptrs(MACROBLOCKD *x) {
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
x->block[r*4+c].diff = &x->diff[r * 4 * 16 + c * 4];
|
||||
x->block[r*4+c].predictor = x->predictor + r * 4 * 16 + c * 4;
|
||||
}
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
x->block[r * 4 + c].diff = &x->diff[r * 4 * 16 + c * 4];
|
||||
x->block[r * 4 + c].predictor = x->predictor + r * 4 * 16 + c * 4;
|
||||
}
|
||||
}
|
||||
|
||||
for (r = 0; r < 2; r++)
|
||||
{
|
||||
for (c = 0; c < 2; c++)
|
||||
{
|
||||
x->block[16+r*2+c].diff = &x->diff[256 + r * 4 * 8 + c * 4];
|
||||
x->block[16+r*2+c].predictor = x->predictor + 256 + r * 4 * 8 + c * 4;
|
||||
for (r = 0; r < 2; r++) {
|
||||
for (c = 0; c < 2; c++) {
|
||||
x->block[16 + r * 2 + c].diff = &x->diff[256 + r * 4 * 8 + c * 4];
|
||||
x->block[16 + r * 2 + c].predictor = x->predictor + 256 + r * 4 * 8 + c * 4;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (r = 0; r < 2; r++)
|
||||
{
|
||||
for (c = 0; c < 2; c++)
|
||||
{
|
||||
x->block[20+r*2+c].diff = &x->diff[320+ r * 4 * 8 + c * 4];
|
||||
x->block[20+r*2+c].predictor = x->predictor + 320 + r * 4 * 8 + c * 4;
|
||||
for (r = 0; r < 2; r++) {
|
||||
for (c = 0; c < 2; c++) {
|
||||
x->block[20 + r * 2 + c].diff = &x->diff[320 + r * 4 * 8 + c * 4];
|
||||
x->block[20 + r * 2 + c].predictor = x->predictor + 320 + r * 4 * 8 + c * 4;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x->block[24].diff = &x->diff[384];
|
||||
x->block[24].diff = &x->diff[384];
|
||||
|
||||
for (r = 0; r < 25; r++)
|
||||
{
|
||||
x->block[r].qcoeff = x->qcoeff + r * 16;
|
||||
x->block[r].dqcoeff = x->dqcoeff + r * 16;
|
||||
}
|
||||
for (r = 0; r < 25; r++) {
|
||||
x->block[r].qcoeff = x->qcoeff + r * 16;
|
||||
x->block[r].dqcoeff = x->dqcoeff + r * 16;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_build_block_doffsets(MACROBLOCKD *x)
|
||||
{
|
||||
void vp8_build_block_doffsets(MACROBLOCKD *x) {
|
||||
|
||||
/* handle the destination pitch features */
|
||||
setup_macroblock(x, DEST);
|
||||
setup_macroblock(x, PRED);
|
||||
/* handle the destination pitch features */
|
||||
setup_macroblock(x, DEST);
|
||||
setup_macroblock(x, PRED);
|
||||
}
|
||||
|
@ -10,33 +10,55 @@
|
||||
|
||||
|
||||
#include "entropy.h"
|
||||
const int default_vp8_mode_contexts[6][4] =
|
||||
{
|
||||
{ /* 0 */
|
||||
7, 1, 1, 183},
|
||||
{ /* 1 */
|
||||
14, 18, 14, 147},
|
||||
{/* 2 */
|
||||
135, 64, 57, 68},
|
||||
{ /* 3 */
|
||||
60, 56, 128, 65},
|
||||
{/* 4 */
|
||||
159, 134, 128, 34},
|
||||
{ /* 5 */
|
||||
234, 188, 128, 28},
|
||||
const int default_vp8_mode_contexts[6][4] = {
|
||||
{
|
||||
/* 0 */
|
||||
7, 1, 1, 183
|
||||
},
|
||||
{
|
||||
/* 1 */
|
||||
14, 18, 14, 147
|
||||
},
|
||||
{
|
||||
/* 2 */
|
||||
135, 64, 57, 68
|
||||
},
|
||||
{
|
||||
/* 3 */
|
||||
60, 56, 128, 65
|
||||
},
|
||||
{
|
||||
/* 4 */
|
||||
159, 134, 128, 34
|
||||
},
|
||||
{
|
||||
/* 5 */
|
||||
234, 188, 128, 28
|
||||
},
|
||||
};
|
||||
const int default_vp8_mode_contexts_a[6][4] =
|
||||
{
|
||||
{ /* 0 */
|
||||
4, 1, 1, 143},
|
||||
{ /* 1 */
|
||||
7, 9, 7, 107},
|
||||
{/* 2 */
|
||||
95, 34, 57, 68},
|
||||
{ /* 3 */
|
||||
95, 56, 128, 65},
|
||||
{/* 4 */
|
||||
159, 67, 128, 34},
|
||||
{ /* 5 */
|
||||
234, 94, 128, 28},
|
||||
const int default_vp8_mode_contexts_a[6][4] = {
|
||||
{
|
||||
/* 0 */
|
||||
4, 1, 1, 143
|
||||
},
|
||||
{
|
||||
/* 1 */
|
||||
7, 9, 7, 107
|
||||
},
|
||||
{
|
||||
/* 2 */
|
||||
95, 34, 57, 68
|
||||
},
|
||||
{
|
||||
/* 3 */
|
||||
95, 56, 128, 65
|
||||
},
|
||||
{
|
||||
/* 4 */
|
||||
159, 67, 128, 34
|
||||
},
|
||||
{
|
||||
/* 5 */
|
||||
234, 94, 128, 28
|
||||
},
|
||||
};
|
||||
|
@ -11,136 +11,135 @@
|
||||
|
||||
#include "entropymode.h"
|
||||
|
||||
const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES] =
|
||||
{
|
||||
{
|
||||
/*Above Mode : 0*/
|
||||
{ 43438, 2195, 470, 316, 615, 171, 217, 412, 124, 160, }, /* left_mode 0 */
|
||||
{ 5722, 2751, 296, 291, 81, 68, 80, 101, 100, 170, }, /* left_mode 1 */
|
||||
{ 1629, 201, 307, 25, 47, 16, 34, 72, 19, 28, }, /* left_mode 2 */
|
||||
{ 332, 266, 36, 500, 20, 65, 23, 14, 154, 106, }, /* left_mode 3 */
|
||||
{ 450, 97, 10, 24, 117, 10, 2, 12, 8, 71, }, /* left_mode 4 */
|
||||
{ 384, 49, 29, 44, 12, 162, 51, 5, 87, 42, }, /* left_mode 5 */
|
||||
{ 495, 53, 157, 27, 14, 57, 180, 17, 17, 34, }, /* left_mode 6 */
|
||||
{ 695, 64, 62, 9, 27, 5, 3, 147, 10, 26, }, /* left_mode 7 */
|
||||
{ 230, 54, 20, 124, 16, 125, 29, 12, 283, 37, }, /* left_mode 8 */
|
||||
{ 260, 87, 21, 120, 32, 16, 33, 16, 33, 203, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 1*/
|
||||
{ 3934, 2573, 355, 137, 128, 87, 133, 117, 37, 27, }, /* left_mode 0 */
|
||||
{ 1036, 1929, 278, 135, 27, 37, 48, 55, 41, 91, }, /* left_mode 1 */
|
||||
{ 223, 256, 253, 15, 13, 9, 28, 64, 3, 3, }, /* left_mode 2 */
|
||||
{ 120, 129, 17, 316, 15, 11, 9, 4, 53, 74, }, /* left_mode 3 */
|
||||
{ 129, 58, 6, 11, 38, 2, 0, 5, 2, 67, }, /* left_mode 4 */
|
||||
{ 53, 22, 11, 16, 8, 26, 14, 3, 19, 12, }, /* left_mode 5 */
|
||||
{ 59, 26, 61, 11, 4, 9, 35, 13, 8, 8, }, /* left_mode 6 */
|
||||
{ 101, 52, 40, 8, 5, 2, 8, 59, 2, 20, }, /* left_mode 7 */
|
||||
{ 48, 34, 10, 52, 8, 15, 6, 6, 63, 20, }, /* left_mode 8 */
|
||||
{ 96, 48, 22, 63, 11, 14, 5, 8, 9, 96, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 2*/
|
||||
{ 709, 461, 506, 36, 27, 33, 151, 98, 24, 6, }, /* left_mode 0 */
|
||||
{ 201, 375, 442, 27, 13, 8, 46, 58, 6, 19, }, /* left_mode 1 */
|
||||
{ 122, 140, 417, 4, 13, 3, 33, 59, 4, 2, }, /* left_mode 2 */
|
||||
{ 36, 17, 22, 16, 6, 8, 12, 17, 9, 21, }, /* left_mode 3 */
|
||||
{ 51, 15, 7, 1, 14, 0, 4, 5, 3, 22, }, /* left_mode 4 */
|
||||
{ 18, 11, 30, 9, 7, 20, 11, 5, 2, 6, }, /* left_mode 5 */
|
||||
{ 38, 21, 103, 9, 4, 12, 79, 13, 2, 5, }, /* left_mode 6 */
|
||||
{ 64, 17, 66, 2, 12, 4, 2, 65, 4, 5, }, /* left_mode 7 */
|
||||
{ 14, 7, 7, 16, 3, 11, 4, 13, 15, 16, }, /* left_mode 8 */
|
||||
{ 36, 8, 32, 9, 9, 4, 14, 7, 6, 24, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 3*/
|
||||
{ 1340, 173, 36, 119, 30, 10, 13, 10, 20, 26, }, /* left_mode 0 */
|
||||
{ 156, 293, 26, 108, 5, 16, 2, 4, 23, 30, }, /* left_mode 1 */
|
||||
{ 60, 34, 13, 7, 3, 3, 0, 8, 4, 5, }, /* left_mode 2 */
|
||||
{ 72, 64, 1, 235, 3, 9, 2, 7, 28, 38, }, /* left_mode 3 */
|
||||
{ 29, 14, 1, 3, 5, 0, 2, 2, 5, 13, }, /* left_mode 4 */
|
||||
{ 22, 7, 4, 11, 2, 5, 1, 2, 6, 4, }, /* left_mode 5 */
|
||||
{ 18, 14, 5, 6, 4, 3, 14, 0, 9, 2, }, /* left_mode 6 */
|
||||
{ 41, 10, 7, 1, 2, 0, 0, 10, 2, 1, }, /* left_mode 7 */
|
||||
{ 23, 19, 2, 33, 1, 5, 2, 0, 51, 8, }, /* left_mode 8 */
|
||||
{ 33, 26, 7, 53, 3, 9, 3, 3, 9, 19, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 4*/
|
||||
{ 410, 165, 43, 31, 66, 15, 30, 54, 8, 17, }, /* left_mode 0 */
|
||||
{ 115, 64, 27, 18, 30, 7, 11, 15, 4, 19, }, /* left_mode 1 */
|
||||
{ 31, 23, 25, 1, 7, 2, 2, 10, 0, 5, }, /* left_mode 2 */
|
||||
{ 17, 4, 1, 6, 8, 2, 7, 5, 5, 21, }, /* left_mode 3 */
|
||||
{ 120, 12, 1, 2, 83, 3, 0, 4, 1, 40, }, /* left_mode 4 */
|
||||
{ 4, 3, 1, 2, 1, 2, 5, 0, 3, 6, }, /* left_mode 5 */
|
||||
{ 10, 2, 13, 6, 6, 6, 8, 2, 4, 5, }, /* left_mode 6 */
|
||||
{ 58, 10, 5, 1, 28, 1, 1, 33, 1, 9, }, /* left_mode 7 */
|
||||
{ 8, 2, 1, 4, 2, 5, 1, 1, 2, 10, }, /* left_mode 8 */
|
||||
{ 76, 7, 5, 7, 18, 2, 2, 0, 5, 45, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 5*/
|
||||
{ 444, 46, 47, 20, 14, 110, 60, 14, 60, 7, }, /* left_mode 0 */
|
||||
{ 59, 57, 25, 18, 3, 17, 21, 6, 14, 6, }, /* left_mode 1 */
|
||||
{ 24, 17, 20, 6, 4, 13, 7, 2, 3, 2, }, /* left_mode 2 */
|
||||
{ 13, 11, 5, 14, 4, 9, 2, 4, 15, 7, }, /* left_mode 3 */
|
||||
{ 8, 5, 2, 1, 4, 0, 1, 1, 2, 12, }, /* left_mode 4 */
|
||||
{ 19, 5, 5, 7, 4, 40, 6, 3, 10, 4, }, /* left_mode 5 */
|
||||
{ 16, 5, 9, 1, 1, 16, 26, 2, 10, 4, }, /* left_mode 6 */
|
||||
{ 11, 4, 8, 1, 1, 4, 4, 5, 4, 1, }, /* left_mode 7 */
|
||||
{ 15, 1, 3, 7, 3, 21, 7, 1, 34, 5, }, /* left_mode 8 */
|
||||
{ 18, 5, 1, 3, 4, 3, 7, 1, 2, 9, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 6*/
|
||||
{ 476, 149, 94, 13, 14, 77, 291, 27, 23, 3, }, /* left_mode 0 */
|
||||
{ 79, 83, 42, 14, 2, 12, 63, 2, 4, 14, }, /* left_mode 1 */
|
||||
{ 43, 36, 55, 1, 3, 8, 42, 11, 5, 1, }, /* left_mode 2 */
|
||||
{ 9, 9, 6, 16, 1, 5, 6, 3, 11, 10, }, /* left_mode 3 */
|
||||
{ 10, 3, 1, 3, 10, 1, 0, 1, 1, 4, }, /* left_mode 4 */
|
||||
{ 14, 6, 15, 5, 1, 20, 25, 2, 5, 0, }, /* left_mode 5 */
|
||||
{ 28, 7, 51, 1, 0, 8, 127, 6, 2, 5, }, /* left_mode 6 */
|
||||
{ 13, 3, 3, 2, 3, 1, 2, 8, 1, 2, }, /* left_mode 7 */
|
||||
{ 10, 3, 3, 3, 3, 8, 2, 2, 9, 3, }, /* left_mode 8 */
|
||||
{ 13, 7, 11, 4, 0, 4, 6, 2, 5, 8, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 7*/
|
||||
{ 376, 135, 119, 6, 32, 8, 31, 224, 9, 3, }, /* left_mode 0 */
|
||||
{ 93, 60, 54, 6, 13, 7, 8, 92, 2, 12, }, /* left_mode 1 */
|
||||
{ 74, 36, 84, 0, 3, 2, 9, 67, 2, 1, }, /* left_mode 2 */
|
||||
{ 19, 4, 4, 8, 8, 2, 4, 7, 6, 16, }, /* left_mode 3 */
|
||||
{ 51, 7, 4, 1, 77, 3, 0, 14, 1, 15, }, /* left_mode 4 */
|
||||
{ 7, 7, 5, 7, 4, 7, 4, 5, 0, 3, }, /* left_mode 5 */
|
||||
{ 18, 2, 19, 2, 2, 4, 12, 11, 1, 2, }, /* left_mode 6 */
|
||||
{ 129, 6, 27, 1, 21, 3, 0, 189, 0, 6, }, /* left_mode 7 */
|
||||
{ 9, 1, 2, 8, 3, 7, 0, 5, 3, 3, }, /* left_mode 8 */
|
||||
{ 20, 4, 5, 10, 4, 2, 7, 17, 3, 16, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 8*/
|
||||
{ 617, 68, 34, 79, 11, 27, 25, 14, 75, 13, }, /* left_mode 0 */
|
||||
{ 51, 82, 21, 26, 6, 12, 13, 1, 26, 16, }, /* left_mode 1 */
|
||||
{ 29, 9, 12, 11, 3, 7, 1, 10, 2, 2, }, /* left_mode 2 */
|
||||
{ 17, 19, 11, 74, 4, 3, 2, 0, 58, 13, }, /* left_mode 3 */
|
||||
{ 10, 1, 1, 3, 4, 1, 0, 2, 1, 8, }, /* left_mode 4 */
|
||||
{ 14, 4, 5, 5, 1, 13, 2, 0, 27, 8, }, /* left_mode 5 */
|
||||
{ 10, 3, 5, 4, 1, 7, 6, 4, 5, 1, }, /* left_mode 6 */
|
||||
{ 10, 2, 6, 2, 1, 1, 1, 4, 2, 1, }, /* left_mode 7 */
|
||||
{ 14, 8, 5, 23, 2, 12, 6, 2, 117, 5, }, /* left_mode 8 */
|
||||
{ 9, 6, 2, 19, 1, 6, 3, 2, 9, 9, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 9*/
|
||||
{ 680, 73, 22, 38, 42, 5, 11, 9, 6, 28, }, /* left_mode 0 */
|
||||
{ 113, 112, 21, 22, 10, 2, 8, 4, 6, 42, }, /* left_mode 1 */
|
||||
{ 44, 20, 24, 6, 5, 4, 3, 3, 1, 2, }, /* left_mode 2 */
|
||||
{ 40, 23, 7, 71, 5, 2, 4, 1, 7, 22, }, /* left_mode 3 */
|
||||
{ 85, 9, 4, 4, 17, 2, 0, 3, 2, 23, }, /* left_mode 4 */
|
||||
{ 13, 4, 2, 6, 1, 7, 0, 1, 7, 6, }, /* left_mode 5 */
|
||||
{ 26, 6, 8, 3, 2, 3, 8, 1, 5, 4, }, /* left_mode 6 */
|
||||
{ 54, 8, 9, 6, 7, 0, 1, 11, 1, 3, }, /* left_mode 7 */
|
||||
{ 9, 10, 4, 13, 2, 5, 4, 2, 14, 8, }, /* left_mode 8 */
|
||||
{ 92, 9, 5, 19, 15, 3, 3, 1, 6, 58, }, /* left_mode 9 */
|
||||
},
|
||||
const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES] = {
|
||||
{
|
||||
/*Above Mode : 0*/
|
||||
{ 43438, 2195, 470, 316, 615, 171, 217, 412, 124, 160, }, /* left_mode 0 */
|
||||
{ 5722, 2751, 296, 291, 81, 68, 80, 101, 100, 170, }, /* left_mode 1 */
|
||||
{ 1629, 201, 307, 25, 47, 16, 34, 72, 19, 28, }, /* left_mode 2 */
|
||||
{ 332, 266, 36, 500, 20, 65, 23, 14, 154, 106, }, /* left_mode 3 */
|
||||
{ 450, 97, 10, 24, 117, 10, 2, 12, 8, 71, }, /* left_mode 4 */
|
||||
{ 384, 49, 29, 44, 12, 162, 51, 5, 87, 42, }, /* left_mode 5 */
|
||||
{ 495, 53, 157, 27, 14, 57, 180, 17, 17, 34, }, /* left_mode 6 */
|
||||
{ 695, 64, 62, 9, 27, 5, 3, 147, 10, 26, }, /* left_mode 7 */
|
||||
{ 230, 54, 20, 124, 16, 125, 29, 12, 283, 37, }, /* left_mode 8 */
|
||||
{ 260, 87, 21, 120, 32, 16, 33, 16, 33, 203, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 1*/
|
||||
{ 3934, 2573, 355, 137, 128, 87, 133, 117, 37, 27, }, /* left_mode 0 */
|
||||
{ 1036, 1929, 278, 135, 27, 37, 48, 55, 41, 91, }, /* left_mode 1 */
|
||||
{ 223, 256, 253, 15, 13, 9, 28, 64, 3, 3, }, /* left_mode 2 */
|
||||
{ 120, 129, 17, 316, 15, 11, 9, 4, 53, 74, }, /* left_mode 3 */
|
||||
{ 129, 58, 6, 11, 38, 2, 0, 5, 2, 67, }, /* left_mode 4 */
|
||||
{ 53, 22, 11, 16, 8, 26, 14, 3, 19, 12, }, /* left_mode 5 */
|
||||
{ 59, 26, 61, 11, 4, 9, 35, 13, 8, 8, }, /* left_mode 6 */
|
||||
{ 101, 52, 40, 8, 5, 2, 8, 59, 2, 20, }, /* left_mode 7 */
|
||||
{ 48, 34, 10, 52, 8, 15, 6, 6, 63, 20, }, /* left_mode 8 */
|
||||
{ 96, 48, 22, 63, 11, 14, 5, 8, 9, 96, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 2*/
|
||||
{ 709, 461, 506, 36, 27, 33, 151, 98, 24, 6, }, /* left_mode 0 */
|
||||
{ 201, 375, 442, 27, 13, 8, 46, 58, 6, 19, }, /* left_mode 1 */
|
||||
{ 122, 140, 417, 4, 13, 3, 33, 59, 4, 2, }, /* left_mode 2 */
|
||||
{ 36, 17, 22, 16, 6, 8, 12, 17, 9, 21, }, /* left_mode 3 */
|
||||
{ 51, 15, 7, 1, 14, 0, 4, 5, 3, 22, }, /* left_mode 4 */
|
||||
{ 18, 11, 30, 9, 7, 20, 11, 5, 2, 6, }, /* left_mode 5 */
|
||||
{ 38, 21, 103, 9, 4, 12, 79, 13, 2, 5, }, /* left_mode 6 */
|
||||
{ 64, 17, 66, 2, 12, 4, 2, 65, 4, 5, }, /* left_mode 7 */
|
||||
{ 14, 7, 7, 16, 3, 11, 4, 13, 15, 16, }, /* left_mode 8 */
|
||||
{ 36, 8, 32, 9, 9, 4, 14, 7, 6, 24, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 3*/
|
||||
{ 1340, 173, 36, 119, 30, 10, 13, 10, 20, 26, }, /* left_mode 0 */
|
||||
{ 156, 293, 26, 108, 5, 16, 2, 4, 23, 30, }, /* left_mode 1 */
|
||||
{ 60, 34, 13, 7, 3, 3, 0, 8, 4, 5, }, /* left_mode 2 */
|
||||
{ 72, 64, 1, 235, 3, 9, 2, 7, 28, 38, }, /* left_mode 3 */
|
||||
{ 29, 14, 1, 3, 5, 0, 2, 2, 5, 13, }, /* left_mode 4 */
|
||||
{ 22, 7, 4, 11, 2, 5, 1, 2, 6, 4, }, /* left_mode 5 */
|
||||
{ 18, 14, 5, 6, 4, 3, 14, 0, 9, 2, }, /* left_mode 6 */
|
||||
{ 41, 10, 7, 1, 2, 0, 0, 10, 2, 1, }, /* left_mode 7 */
|
||||
{ 23, 19, 2, 33, 1, 5, 2, 0, 51, 8, }, /* left_mode 8 */
|
||||
{ 33, 26, 7, 53, 3, 9, 3, 3, 9, 19, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 4*/
|
||||
{ 410, 165, 43, 31, 66, 15, 30, 54, 8, 17, }, /* left_mode 0 */
|
||||
{ 115, 64, 27, 18, 30, 7, 11, 15, 4, 19, }, /* left_mode 1 */
|
||||
{ 31, 23, 25, 1, 7, 2, 2, 10, 0, 5, }, /* left_mode 2 */
|
||||
{ 17, 4, 1, 6, 8, 2, 7, 5, 5, 21, }, /* left_mode 3 */
|
||||
{ 120, 12, 1, 2, 83, 3, 0, 4, 1, 40, }, /* left_mode 4 */
|
||||
{ 4, 3, 1, 2, 1, 2, 5, 0, 3, 6, }, /* left_mode 5 */
|
||||
{ 10, 2, 13, 6, 6, 6, 8, 2, 4, 5, }, /* left_mode 6 */
|
||||
{ 58, 10, 5, 1, 28, 1, 1, 33, 1, 9, }, /* left_mode 7 */
|
||||
{ 8, 2, 1, 4, 2, 5, 1, 1, 2, 10, }, /* left_mode 8 */
|
||||
{ 76, 7, 5, 7, 18, 2, 2, 0, 5, 45, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 5*/
|
||||
{ 444, 46, 47, 20, 14, 110, 60, 14, 60, 7, }, /* left_mode 0 */
|
||||
{ 59, 57, 25, 18, 3, 17, 21, 6, 14, 6, }, /* left_mode 1 */
|
||||
{ 24, 17, 20, 6, 4, 13, 7, 2, 3, 2, }, /* left_mode 2 */
|
||||
{ 13, 11, 5, 14, 4, 9, 2, 4, 15, 7, }, /* left_mode 3 */
|
||||
{ 8, 5, 2, 1, 4, 0, 1, 1, 2, 12, }, /* left_mode 4 */
|
||||
{ 19, 5, 5, 7, 4, 40, 6, 3, 10, 4, }, /* left_mode 5 */
|
||||
{ 16, 5, 9, 1, 1, 16, 26, 2, 10, 4, }, /* left_mode 6 */
|
||||
{ 11, 4, 8, 1, 1, 4, 4, 5, 4, 1, }, /* left_mode 7 */
|
||||
{ 15, 1, 3, 7, 3, 21, 7, 1, 34, 5, }, /* left_mode 8 */
|
||||
{ 18, 5, 1, 3, 4, 3, 7, 1, 2, 9, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 6*/
|
||||
{ 476, 149, 94, 13, 14, 77, 291, 27, 23, 3, }, /* left_mode 0 */
|
||||
{ 79, 83, 42, 14, 2, 12, 63, 2, 4, 14, }, /* left_mode 1 */
|
||||
{ 43, 36, 55, 1, 3, 8, 42, 11, 5, 1, }, /* left_mode 2 */
|
||||
{ 9, 9, 6, 16, 1, 5, 6, 3, 11, 10, }, /* left_mode 3 */
|
||||
{ 10, 3, 1, 3, 10, 1, 0, 1, 1, 4, }, /* left_mode 4 */
|
||||
{ 14, 6, 15, 5, 1, 20, 25, 2, 5, 0, }, /* left_mode 5 */
|
||||
{ 28, 7, 51, 1, 0, 8, 127, 6, 2, 5, }, /* left_mode 6 */
|
||||
{ 13, 3, 3, 2, 3, 1, 2, 8, 1, 2, }, /* left_mode 7 */
|
||||
{ 10, 3, 3, 3, 3, 8, 2, 2, 9, 3, }, /* left_mode 8 */
|
||||
{ 13, 7, 11, 4, 0, 4, 6, 2, 5, 8, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 7*/
|
||||
{ 376, 135, 119, 6, 32, 8, 31, 224, 9, 3, }, /* left_mode 0 */
|
||||
{ 93, 60, 54, 6, 13, 7, 8, 92, 2, 12, }, /* left_mode 1 */
|
||||
{ 74, 36, 84, 0, 3, 2, 9, 67, 2, 1, }, /* left_mode 2 */
|
||||
{ 19, 4, 4, 8, 8, 2, 4, 7, 6, 16, }, /* left_mode 3 */
|
||||
{ 51, 7, 4, 1, 77, 3, 0, 14, 1, 15, }, /* left_mode 4 */
|
||||
{ 7, 7, 5, 7, 4, 7, 4, 5, 0, 3, }, /* left_mode 5 */
|
||||
{ 18, 2, 19, 2, 2, 4, 12, 11, 1, 2, }, /* left_mode 6 */
|
||||
{ 129, 6, 27, 1, 21, 3, 0, 189, 0, 6, }, /* left_mode 7 */
|
||||
{ 9, 1, 2, 8, 3, 7, 0, 5, 3, 3, }, /* left_mode 8 */
|
||||
{ 20, 4, 5, 10, 4, 2, 7, 17, 3, 16, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 8*/
|
||||
{ 617, 68, 34, 79, 11, 27, 25, 14, 75, 13, }, /* left_mode 0 */
|
||||
{ 51, 82, 21, 26, 6, 12, 13, 1, 26, 16, }, /* left_mode 1 */
|
||||
{ 29, 9, 12, 11, 3, 7, 1, 10, 2, 2, }, /* left_mode 2 */
|
||||
{ 17, 19, 11, 74, 4, 3, 2, 0, 58, 13, }, /* left_mode 3 */
|
||||
{ 10, 1, 1, 3, 4, 1, 0, 2, 1, 8, }, /* left_mode 4 */
|
||||
{ 14, 4, 5, 5, 1, 13, 2, 0, 27, 8, }, /* left_mode 5 */
|
||||
{ 10, 3, 5, 4, 1, 7, 6, 4, 5, 1, }, /* left_mode 6 */
|
||||
{ 10, 2, 6, 2, 1, 1, 1, 4, 2, 1, }, /* left_mode 7 */
|
||||
{ 14, 8, 5, 23, 2, 12, 6, 2, 117, 5, }, /* left_mode 8 */
|
||||
{ 9, 6, 2, 19, 1, 6, 3, 2, 9, 9, }, /* left_mode 9 */
|
||||
},
|
||||
{
|
||||
/*Above Mode : 9*/
|
||||
{ 680, 73, 22, 38, 42, 5, 11, 9, 6, 28, }, /* left_mode 0 */
|
||||
{ 113, 112, 21, 22, 10, 2, 8, 4, 6, 42, }, /* left_mode 1 */
|
||||
{ 44, 20, 24, 6, 5, 4, 3, 3, 1, 2, }, /* left_mode 2 */
|
||||
{ 40, 23, 7, 71, 5, 2, 4, 1, 7, 22, }, /* left_mode 3 */
|
||||
{ 85, 9, 4, 4, 17, 2, 0, 3, 2, 23, }, /* left_mode 4 */
|
||||
{ 13, 4, 2, 6, 1, 7, 0, 1, 7, 6, }, /* left_mode 5 */
|
||||
{ 26, 6, 8, 3, 2, 3, 8, 1, 5, 4, }, /* left_mode 6 */
|
||||
{ 54, 8, 9, 6, 7, 0, 1, 11, 1, 3, }, /* left_mode 7 */
|
||||
{ 9, 10, 4, 13, 2, 5, 4, 2, 14, 8, }, /* left_mode 8 */
|
||||
{ 92, 9, 5, 19, 15, 3, 3, 1, 6, 58, }, /* left_mode 9 */
|
||||
},
|
||||
};
|
||||
|
@ -13,16 +13,14 @@
|
||||
#define __INC_MV_H
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short row;
|
||||
short col;
|
||||
typedef struct {
|
||||
short row;
|
||||
short col;
|
||||
} MV;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t as_int;
|
||||
MV as_mv;
|
||||
typedef union {
|
||||
uint32_t as_int;
|
||||
MV as_mv;
|
||||
} int_mv; /* facilitates faster equality tests and copies */
|
||||
|
||||
#endif
|
||||
|
@ -22,187 +22,179 @@ extern "C"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "type_aliases.h"
|
||||
#include "ppflags.h"
|
||||
typedef int *VP8_PTR;
|
||||
typedef int *VP8_PTR;
|
||||
|
||||
/* Create/destroy static data structures. */
|
||||
/* Create/destroy static data structures. */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NORMAL = 0,
|
||||
FOURFIVE = 1,
|
||||
THREEFIVE = 2,
|
||||
ONETWO = 3
|
||||
typedef enum {
|
||||
NORMAL = 0,
|
||||
FOURFIVE = 1,
|
||||
THREEFIVE = 2,
|
||||
ONETWO = 3
|
||||
|
||||
} VPX_SCALING;
|
||||
} VPX_SCALING;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VP8_LAST_FLAG = 1,
|
||||
VP8_GOLD_FLAG = 2,
|
||||
VP8_ALT_FLAG = 4
|
||||
} VP8_REFFRAME;
|
||||
typedef enum {
|
||||
VP8_LAST_FLAG = 1,
|
||||
VP8_GOLD_FLAG = 2,
|
||||
VP8_ALT_FLAG = 4
|
||||
} VP8_REFFRAME;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
USAGE_STREAM_FROM_SERVER = 0x0,
|
||||
USAGE_LOCAL_FILE_PLAYBACK = 0x1,
|
||||
USAGE_CONSTRAINED_QUALITY = 0x2
|
||||
} END_USAGE;
|
||||
typedef enum {
|
||||
USAGE_STREAM_FROM_SERVER = 0x0,
|
||||
USAGE_LOCAL_FILE_PLAYBACK = 0x1,
|
||||
USAGE_CONSTRAINED_QUALITY = 0x2
|
||||
} END_USAGE;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MODE_GOODQUALITY = 0x1,
|
||||
MODE_BESTQUALITY = 0x2,
|
||||
MODE_FIRSTPASS = 0x3,
|
||||
MODE_SECONDPASS = 0x4,
|
||||
MODE_SECONDPASS_BEST = 0x5,
|
||||
} MODE;
|
||||
typedef enum {
|
||||
MODE_GOODQUALITY = 0x1,
|
||||
MODE_BESTQUALITY = 0x2,
|
||||
MODE_FIRSTPASS = 0x3,
|
||||
MODE_SECONDPASS = 0x4,
|
||||
MODE_SECONDPASS_BEST = 0x5,
|
||||
} MODE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FRAMEFLAGS_KEY = 1,
|
||||
FRAMEFLAGS_GOLDEN = 2,
|
||||
FRAMEFLAGS_ALTREF = 4,
|
||||
} FRAMETYPE_FLAGS;
|
||||
typedef enum {
|
||||
FRAMEFLAGS_KEY = 1,
|
||||
FRAMEFLAGS_GOLDEN = 2,
|
||||
FRAMEFLAGS_ALTREF = 4,
|
||||
} FRAMETYPE_FLAGS;
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
static __inline void Scale2Ratio(int mode, int *hr, int *hs)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case NORMAL:
|
||||
*hr = 1;
|
||||
*hs = 1;
|
||||
break;
|
||||
case FOURFIVE:
|
||||
*hr = 4;
|
||||
*hs = 5;
|
||||
break;
|
||||
case THREEFIVE:
|
||||
*hr = 3;
|
||||
*hs = 5;
|
||||
break;
|
||||
case ONETWO:
|
||||
*hr = 1;
|
||||
*hs = 2;
|
||||
break;
|
||||
default:
|
||||
*hr = 1;
|
||||
*hs = 1;
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
static __inline void Scale2Ratio(int mode, int *hr, int *hs) {
|
||||
switch (mode) {
|
||||
case NORMAL:
|
||||
*hr = 1;
|
||||
*hs = 1;
|
||||
break;
|
||||
case FOURFIVE:
|
||||
*hr = 4;
|
||||
*hs = 5;
|
||||
break;
|
||||
case THREEFIVE:
|
||||
*hr = 3;
|
||||
*hs = 5;
|
||||
break;
|
||||
case ONETWO:
|
||||
*hr = 1;
|
||||
*hs = 2;
|
||||
break;
|
||||
default:
|
||||
*hr = 1;
|
||||
*hs = 1;
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int Version; // 4 versions of bitstream defined 0 best quality/slowest decode, 3 lowest quality/fastest decode
|
||||
int Width; // width of data passed to the compressor
|
||||
int Height; // height of data passed to the compressor
|
||||
double frame_rate; // set to passed in framerate
|
||||
int target_bandwidth; // bandwidth to be used in kilobits per second
|
||||
typedef struct {
|
||||
int Version; // 4 versions of bitstream defined 0 best quality/slowest decode, 3 lowest quality/fastest decode
|
||||
int Width; // width of data passed to the compressor
|
||||
int Height; // height of data passed to the compressor
|
||||
double frame_rate; // set to passed in framerate
|
||||
int target_bandwidth; // bandwidth to be used in kilobits per second
|
||||
|
||||
int noise_sensitivity; // parameter used for applying pre processing blur: recommendation 0
|
||||
int Sharpness; // parameter used for sharpening output: recommendation 0:
|
||||
int cpu_used;
|
||||
unsigned int rc_max_intra_bitrate_pct;
|
||||
int noise_sensitivity; // parameter used for applying pre processing blur: recommendation 0
|
||||
int Sharpness; // parameter used for sharpening output: recommendation 0:
|
||||
int cpu_used;
|
||||
unsigned int rc_max_intra_bitrate_pct;
|
||||
|
||||
// mode ->
|
||||
//(0)=Realtime/Live Encoding. This mode is optimized for realtim encoding (for example, capturing
|
||||
// a television signal or feed from a live camera). ( speed setting controls how fast )
|
||||
//(1)=Good Quality Fast Encoding. The encoder balances quality with the amount of time it takes to
|
||||
// encode the output. ( speed setting controls how fast )
|
||||
//(2)=One Pass - Best Quality. The encoder places priority on the quality of the output over encoding
|
||||
// speed. The output is compressed at the highest possible quality. This option takes the longest
|
||||
// amount of time to encode. ( speed setting ignored )
|
||||
//(3)=Two Pass - First Pass. The encoder generates a file of statistics for use in the second encoding
|
||||
// pass. ( speed setting controls how fast )
|
||||
//(4)=Two Pass - Second Pass. The encoder uses the statistics that were generated in the first encoding
|
||||
// pass to create the compressed output. ( speed setting controls how fast )
|
||||
//(5)=Two Pass - Second Pass Best. The encoder uses the statistics that were generated in the first
|
||||
// encoding pass to create the compressed output using the highest possible quality, and taking a
|
||||
// longer amount of time to encode.. ( speed setting ignored )
|
||||
int Mode; //
|
||||
// mode ->
|
||||
// (0)=Realtime/Live Encoding. This mode is optimized for realtim encoding (for example, capturing
|
||||
// a television signal or feed from a live camera). ( speed setting controls how fast )
|
||||
// (1)=Good Quality Fast Encoding. The encoder balances quality with the amount of time it takes to
|
||||
// encode the output. ( speed setting controls how fast )
|
||||
// (2)=One Pass - Best Quality. The encoder places priority on the quality of the output over encoding
|
||||
// speed. The output is compressed at the highest possible quality. This option takes the longest
|
||||
// amount of time to encode. ( speed setting ignored )
|
||||
// (3)=Two Pass - First Pass. The encoder generates a file of statistics for use in the second encoding
|
||||
// pass. ( speed setting controls how fast )
|
||||
// (4)=Two Pass - Second Pass. The encoder uses the statistics that were generated in the first encoding
|
||||
// pass to create the compressed output. ( speed setting controls how fast )
|
||||
// (5)=Two Pass - Second Pass Best. The encoder uses the statistics that were generated in the first
|
||||
// encoding pass to create the compressed output using the highest possible quality, and taking a
|
||||
// longer amount of time to encode.. ( speed setting ignored )
|
||||
int Mode; //
|
||||
|
||||
// Key Framing Operations
|
||||
int auto_key; // automatically detect cut scenes and set the keyframes
|
||||
int key_freq; // maximum distance to key frame.
|
||||
// Key Framing Operations
|
||||
int auto_key; // automatically detect cut scenes and set the keyframes
|
||||
int key_freq; // maximum distance to key frame.
|
||||
|
||||
int allow_lag; // allow lagged compression (if 0 lagin frames is ignored)
|
||||
int lag_in_frames; // how many frames lag before we start encoding
|
||||
int allow_lag; // allow lagged compression (if 0 lagin frames is ignored)
|
||||
int lag_in_frames; // how many frames lag before we start encoding
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// DATARATE CONTROL OPTIONS
|
||||
// ----------------------------------------------------------------
|
||||
// DATARATE CONTROL OPTIONS
|
||||
|
||||
int end_usage; // vbr or cbr
|
||||
int end_usage; // vbr or cbr
|
||||
|
||||
// buffer targeting aggressiveness
|
||||
int under_shoot_pct;
|
||||
int over_shoot_pct;
|
||||
// buffer targeting aggressiveness
|
||||
int under_shoot_pct;
|
||||
int over_shoot_pct;
|
||||
|
||||
// buffering parameters
|
||||
int starting_buffer_level; // in seconds
|
||||
int optimal_buffer_level;
|
||||
int maximum_buffer_size;
|
||||
// buffering parameters
|
||||
int starting_buffer_level; // in seconds
|
||||
int optimal_buffer_level;
|
||||
int maximum_buffer_size;
|
||||
|
||||
// controlling quality
|
||||
int fixed_q;
|
||||
int worst_allowed_q;
|
||||
int best_allowed_q;
|
||||
int cq_level;
|
||||
int lossless;
|
||||
// controlling quality
|
||||
int fixed_q;
|
||||
int worst_allowed_q;
|
||||
int best_allowed_q;
|
||||
int cq_level;
|
||||
int lossless;
|
||||
|
||||
// two pass datarate control
|
||||
int two_pass_vbrbias; // two pass datarate control tweaks
|
||||
int two_pass_vbrmin_section;
|
||||
int two_pass_vbrmax_section;
|
||||
// END DATARATE CONTROL OPTIONS
|
||||
//----------------------------------------------------------------
|
||||
// two pass datarate control
|
||||
int two_pass_vbrbias; // two pass datarate control tweaks
|
||||
int two_pass_vbrmin_section;
|
||||
int two_pass_vbrmax_section;
|
||||
// END DATARATE CONTROL OPTIONS
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
|
||||
// these parameters aren't to be used in final build don't use!!!
|
||||
int play_alternate;
|
||||
int alt_freq;
|
||||
// these parameters aren't to be used in final build don't use!!!
|
||||
int play_alternate;
|
||||
int alt_freq;
|
||||
|
||||
int encode_breakout; // early breakout encode threshold : for video conf recommend 800
|
||||
int encode_breakout; // early breakout encode threshold : for video conf recommend 800
|
||||
|
||||
int arnr_max_frames;
|
||||
int arnr_strength ;
|
||||
int arnr_type ;
|
||||
int arnr_max_frames;
|
||||
int arnr_strength;
|
||||
int arnr_type;
|
||||
|
||||
struct vpx_fixed_buf two_pass_stats_in;
|
||||
struct vpx_codec_pkt_list *output_pkt_list;
|
||||
struct vpx_fixed_buf two_pass_stats_in;
|
||||
struct vpx_codec_pkt_list *output_pkt_list;
|
||||
|
||||
vp8e_tuning tuning;
|
||||
} VP8_CONFIG;
|
||||
vp8e_tuning tuning;
|
||||
} VP8_CONFIG;
|
||||
|
||||
|
||||
void vp8_initialize();
|
||||
void vp8_initialize();
|
||||
|
||||
VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf);
|
||||
void vp8_remove_compressor(VP8_PTR *comp);
|
||||
VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf);
|
||||
void vp8_remove_compressor(VP8_PTR *comp);
|
||||
|
||||
void vp8_init_config(VP8_PTR onyx, VP8_CONFIG *oxcf);
|
||||
void vp8_change_config(VP8_PTR onyx, VP8_CONFIG *oxcf);
|
||||
void vp8_init_config(VP8_PTR onyx, VP8_CONFIG *oxcf);
|
||||
void vp8_change_config(VP8_PTR onyx, VP8_CONFIG *oxcf);
|
||||
|
||||
// receive a frames worth of data caller can assume that a copy of this frame is made
|
||||
// and not just a copy of the pointer..
|
||||
int vp8_receive_raw_frame(VP8_PTR comp, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp);
|
||||
int vp8_get_compressed_data(VP8_PTR comp, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, int64_t *time_stamp, int64_t *time_end, int flush);
|
||||
int vp8_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags);
|
||||
int vp8_receive_raw_frame(VP8_PTR comp, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp);
|
||||
int vp8_get_compressed_data(VP8_PTR comp, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, int64_t *time_stamp, int64_t *time_end, int flush);
|
||||
int vp8_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags);
|
||||
|
||||
int vp8_use_as_reference(VP8_PTR comp, int ref_frame_flags);
|
||||
int vp8_update_reference(VP8_PTR comp, int ref_frame_flags);
|
||||
int vp8_get_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
int vp8_set_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
int vp8_update_entropy(VP8_PTR comp, int update);
|
||||
int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]);
|
||||
int vp8_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols);
|
||||
int vp8_set_internal_size(VP8_PTR comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
|
||||
int vp8_get_quantizer(VP8_PTR c);
|
||||
int vp8_use_as_reference(VP8_PTR comp, int ref_frame_flags);
|
||||
int vp8_update_reference(VP8_PTR comp, int ref_frame_flags);
|
||||
int vp8_get_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
int vp8_set_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
int vp8_update_entropy(VP8_PTR comp, int update);
|
||||
int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]);
|
||||
int vp8_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols);
|
||||
int vp8_set_internal_size(VP8_PTR comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
|
||||
int vp8_get_quantizer(VP8_PTR c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -42,258 +42,251 @@ void vp8_initialize_common(void);
|
||||
|
||||
#define COMP_PRED_CONTEXTS 2
|
||||
|
||||
typedef struct frame_contexts
|
||||
{
|
||||
vp8_prob bmode_prob [VP8_BINTRAMODES-1];
|
||||
vp8_prob ymode_prob [VP8_YMODES-1]; /* interframe intra mode probs */
|
||||
vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
|
||||
vp8_prob i8x8_mode_prob [VP8_I8X8_MODES-1];
|
||||
vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS-1];
|
||||
vp8_prob mbsplit_prob [VP8_NUMMBSPLITS-1];
|
||||
vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
MV_CONTEXT mvc[2];
|
||||
typedef struct frame_contexts {
|
||||
vp8_prob bmode_prob [VP8_BINTRAMODES - 1];
|
||||
vp8_prob ymode_prob [VP8_YMODES - 1]; /* interframe intra mode probs */
|
||||
vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES - 1];
|
||||
vp8_prob i8x8_mode_prob [VP8_I8X8_MODES - 1];
|
||||
vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
|
||||
vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1];
|
||||
vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
MV_CONTEXT mvc[2];
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
MV_CONTEXT_HP mvc_hp[2];
|
||||
MV_CONTEXT_HP mvc_hp[2];
|
||||
#endif
|
||||
#if CONFIG_ADAPTIVE_ENTROPY
|
||||
MV_CONTEXT pre_mvc[2];
|
||||
MV_CONTEXT pre_mvc[2];
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
MV_CONTEXT_HP pre_mvc_hp[2];
|
||||
MV_CONTEXT_HP pre_mvc_hp[2];
|
||||
#endif
|
||||
vp8_prob pre_bmode_prob [VP8_BINTRAMODES-1];
|
||||
vp8_prob pre_ymode_prob [VP8_YMODES-1]; /* interframe intra mode probs */
|
||||
vp8_prob pre_uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
|
||||
vp8_prob pre_i8x8_mode_prob [VP8_I8X8_MODES-1];
|
||||
vp8_prob pre_sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS-1];
|
||||
vp8_prob pre_mbsplit_prob [VP8_NUMMBSPLITS-1];
|
||||
unsigned int bmode_counts [VP8_BINTRAMODES];
|
||||
unsigned int ymode_counts [VP8_YMODES]; /* interframe intra mode probs */
|
||||
unsigned int uv_mode_counts [VP8_YMODES][VP8_UV_MODES];
|
||||
unsigned int i8x8_mode_counts [VP8_I8X8_MODES]; /* interframe intra mode probs */
|
||||
unsigned int sub_mv_ref_counts [SUBMVREF_COUNT][VP8_SUBMVREFS];
|
||||
unsigned int mbsplit_counts [VP8_NUMMBSPLITS];
|
||||
vp8_prob pre_bmode_prob [VP8_BINTRAMODES - 1];
|
||||
vp8_prob pre_ymode_prob [VP8_YMODES - 1]; /* interframe intra mode probs */
|
||||
vp8_prob pre_uv_mode_prob [VP8_YMODES][VP8_UV_MODES - 1];
|
||||
vp8_prob pre_i8x8_mode_prob [VP8_I8X8_MODES - 1];
|
||||
vp8_prob pre_sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
|
||||
vp8_prob pre_mbsplit_prob [VP8_NUMMBSPLITS - 1];
|
||||
unsigned int bmode_counts [VP8_BINTRAMODES];
|
||||
unsigned int ymode_counts [VP8_YMODES]; /* interframe intra mode probs */
|
||||
unsigned int uv_mode_counts [VP8_YMODES][VP8_UV_MODES];
|
||||
unsigned int i8x8_mode_counts [VP8_I8X8_MODES]; /* interframe intra mode probs */
|
||||
unsigned int sub_mv_ref_counts [SUBMVREF_COUNT][VP8_SUBMVREFS];
|
||||
unsigned int mbsplit_counts [VP8_NUMMBSPLITS];
|
||||
|
||||
vp8_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp8_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
unsigned int MVcount [2] [MVvals];
|
||||
vp8_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp8_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
unsigned int MVcount [2] [MVvals];
|
||||
#if CONFIG_HIGH_PRECISION_MV
|
||||
unsigned int MVcount_hp [2] [MVvals_hp];
|
||||
unsigned int MVcount_hp [2] [MVvals_hp];
|
||||
#endif
|
||||
#endif /* CONFIG_ADAPTIVE_ENTROPY */
|
||||
int mode_context[6][4];
|
||||
int mode_context_a[6][4];
|
||||
int vp8_mode_contexts[6][4];
|
||||
int mv_ref_ct[6][4][2];
|
||||
int mv_ref_ct_a[6][4][2];
|
||||
int mode_context[6][4];
|
||||
int mode_context_a[6][4];
|
||||
int vp8_mode_contexts[6][4];
|
||||
int mv_ref_ct[6][4][2];
|
||||
int mv_ref_ct_a[6][4][2];
|
||||
} FRAME_CONTEXT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RECON_CLAMP_REQUIRED = 0,
|
||||
RECON_CLAMP_NOTREQUIRED = 1
|
||||
typedef enum {
|
||||
RECON_CLAMP_REQUIRED = 0,
|
||||
RECON_CLAMP_NOTREQUIRED = 1
|
||||
} CLAMP_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SIXTAP = 0,
|
||||
BILINEAR = 1,
|
||||
typedef enum {
|
||||
SIXTAP = 0,
|
||||
BILINEAR = 1,
|
||||
#if CONFIG_ENHANCED_INTERP
|
||||
EIGHTTAP = 2,
|
||||
EIGHTTAP_SHARP = 3,
|
||||
EIGHTTAP = 2,
|
||||
EIGHTTAP_SHARP = 3,
|
||||
#endif
|
||||
} INTERPOLATIONFILTERTYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SINGLE_PREDICTION_ONLY = 0,
|
||||
COMP_PREDICTION_ONLY = 1,
|
||||
HYBRID_PREDICTION = 2,
|
||||
NB_PREDICTION_TYPES = 3,
|
||||
typedef enum {
|
||||
SINGLE_PREDICTION_ONLY = 0,
|
||||
COMP_PREDICTION_ONLY = 1,
|
||||
HYBRID_PREDICTION = 2,
|
||||
NB_PREDICTION_TYPES = 3,
|
||||
} COMPPREDMODE_TYPE;
|
||||
|
||||
/* TODO: allows larger transform */
|
||||
typedef enum
|
||||
{
|
||||
ONLY_4X4 = 0,
|
||||
ALLOW_8X8 = 1
|
||||
typedef enum {
|
||||
ONLY_4X4 = 0,
|
||||
ALLOW_8X8 = 1
|
||||
} TXFM_MODE;
|
||||
|
||||
typedef struct VP8_COMMON_RTCD
|
||||
{
|
||||
typedef struct VP8_COMMON_RTCD {
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
vp8_idct_rtcd_vtable_t idct;
|
||||
vp8_recon_rtcd_vtable_t recon;
|
||||
vp8_subpix_rtcd_vtable_t subpix;
|
||||
vp8_loopfilter_rtcd_vtable_t loopfilter;
|
||||
vp8_idct_rtcd_vtable_t idct;
|
||||
vp8_recon_rtcd_vtable_t recon;
|
||||
vp8_subpix_rtcd_vtable_t subpix;
|
||||
vp8_loopfilter_rtcd_vtable_t loopfilter;
|
||||
#if CONFIG_POSTPROC
|
||||
vp8_postproc_rtcd_vtable_t postproc;
|
||||
vp8_postproc_rtcd_vtable_t postproc;
|
||||
#endif
|
||||
int flags;
|
||||
int flags;
|
||||
#else
|
||||
int unused;
|
||||
int unused;
|
||||
#endif
|
||||
} VP8_COMMON_RTCD;
|
||||
|
||||
typedef struct VP8Common
|
||||
{
|
||||
struct vpx_internal_error_info error;
|
||||
typedef struct VP8Common {
|
||||
struct vpx_internal_error_info error;
|
||||
|
||||
DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][16]);
|
||||
|
||||
int Width;
|
||||
int Height;
|
||||
int horiz_scale;
|
||||
int vert_scale;
|
||||
int Width;
|
||||
int Height;
|
||||
int horiz_scale;
|
||||
int vert_scale;
|
||||
|
||||
YUV_TYPE clr_type;
|
||||
CLAMP_TYPE clamp_type;
|
||||
YUV_TYPE clr_type;
|
||||
CLAMP_TYPE clamp_type;
|
||||
|
||||
YV12_BUFFER_CONFIG *frame_to_show;
|
||||
YV12_BUFFER_CONFIG *frame_to_show;
|
||||
|
||||
YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
|
||||
int fb_idx_ref_cnt[NUM_YV12_BUFFERS];
|
||||
int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx;
|
||||
YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
|
||||
int fb_idx_ref_cnt[NUM_YV12_BUFFERS];
|
||||
int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx;
|
||||
|
||||
YV12_BUFFER_CONFIG post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG temp_scale_frame;
|
||||
YV12_BUFFER_CONFIG post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG temp_scale_frame;
|
||||
|
||||
|
||||
FRAME_TYPE last_frame_type; /* Save last frame's frame type for motion search. */
|
||||
FRAME_TYPE frame_type;
|
||||
FRAME_TYPE last_frame_type; /* Save last frame's frame type for motion search. */
|
||||
FRAME_TYPE frame_type;
|
||||
|
||||
int show_frame;
|
||||
int show_frame;
|
||||
|
||||
int frame_flags;
|
||||
int MBs;
|
||||
int mb_rows;
|
||||
int mb_cols;
|
||||
int mode_info_stride;
|
||||
int frame_flags;
|
||||
int MBs;
|
||||
int mb_rows;
|
||||
int mb_cols;
|
||||
int mode_info_stride;
|
||||
|
||||
/* profile settings */
|
||||
int experimental;
|
||||
int mb_no_coeff_skip;
|
||||
TXFM_MODE txfm_mode;
|
||||
COMPPREDMODE_TYPE comp_pred_mode;
|
||||
int no_lpf;
|
||||
int use_bilinear_mc_filter;
|
||||
int full_pixel;
|
||||
/* profile settings */
|
||||
int experimental;
|
||||
int mb_no_coeff_skip;
|
||||
TXFM_MODE txfm_mode;
|
||||
COMPPREDMODE_TYPE comp_pred_mode;
|
||||
int no_lpf;
|
||||
int use_bilinear_mc_filter;
|
||||
int full_pixel;
|
||||
|
||||
int base_qindex;
|
||||
int last_kf_gf_q; /* Q used on the last GF or KF */
|
||||
int base_qindex;
|
||||
int last_kf_gf_q; /* Q used on the last GF or KF */
|
||||
|
||||
int y1dc_delta_q;
|
||||
int y2dc_delta_q;
|
||||
int y2ac_delta_q;
|
||||
int uvdc_delta_q;
|
||||
int uvac_delta_q;
|
||||
int y1dc_delta_q;
|
||||
int y2dc_delta_q;
|
||||
int y2ac_delta_q;
|
||||
int uvdc_delta_q;
|
||||
int uvac_delta_q;
|
||||
|
||||
unsigned int frames_since_golden;
|
||||
unsigned int frames_till_alt_ref_frame;
|
||||
unsigned int frames_since_golden;
|
||||
unsigned int frames_till_alt_ref_frame;
|
||||
|
||||
/* We allocate a MODE_INFO struct for each macroblock, together with
|
||||
an extra row on top and column on the left to simplify prediction. */
|
||||
/* We allocate a MODE_INFO struct for each macroblock, together with
|
||||
an extra row on top and column on the left to simplify prediction. */
|
||||
|
||||
MODE_INFO *mip; /* Base of allocated array */
|
||||
MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
|
||||
MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
|
||||
MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
|
||||
MODE_INFO *mip; /* Base of allocated array */
|
||||
MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
|
||||
MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
|
||||
MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
|
||||
|
||||
|
||||
// Persistent mb segment id map used in prediction.
|
||||
unsigned char * last_frame_seg_map;
|
||||
// Persistent mb segment id map used in prediction.
|
||||
unsigned char *last_frame_seg_map;
|
||||
|
||||
INTERPOLATIONFILTERTYPE mcomp_filter_type;
|
||||
LOOPFILTERTYPE filter_type;
|
||||
INTERPOLATIONFILTERTYPE mcomp_filter_type;
|
||||
LOOPFILTERTYPE filter_type;
|
||||
|
||||
loop_filter_info_n lf_info;
|
||||
loop_filter_info_n lf_info;
|
||||
|
||||
int filter_level;
|
||||
int last_sharpness_level;
|
||||
int sharpness_level;
|
||||
int filter_level;
|
||||
int last_sharpness_level;
|
||||
int sharpness_level;
|
||||
|
||||
int refresh_last_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_golden_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_alt_ref_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_last_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_golden_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_alt_ref_frame; /* Two state 0 = NO, 1 = YES */
|
||||
|
||||
int copy_buffer_to_gf; /* 0 none, 1 Last to GF, 2 ARF to GF */
|
||||
int copy_buffer_to_arf; /* 0 none, 1 Last to ARF, 2 GF to ARF */
|
||||
int copy_buffer_to_gf; /* 0 none, 1 Last to GF, 2 ARF to GF */
|
||||
int copy_buffer_to_arf; /* 0 none, 1 Last to ARF, 2 GF to ARF */
|
||||
|
||||
int refresh_entropy_probs; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_entropy_probs; /* Two state 0 = NO, 1 = YES */
|
||||
|
||||
int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
|
||||
int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
|
||||
|
||||
/* Y,U,V,Y2 */
|
||||
ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */
|
||||
ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */
|
||||
/* Y,U,V,Y2 */
|
||||
ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */
|
||||
ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */
|
||||
|
||||
/* keyframe block modes are predicted by their above, left neighbors */
|
||||
/* keyframe block modes are predicted by their above, left neighbors */
|
||||
|
||||
vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1];
|
||||
vp8_prob kf_ymode_prob[8][VP8_YMODES-1]; /* keyframe "" */
|
||||
int kf_ymode_probs_index;
|
||||
int kf_ymode_probs_update;
|
||||
vp8_prob kf_uv_mode_prob[VP8_YMODES] [VP8_UV_MODES-1];
|
||||
vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES - 1];
|
||||
vp8_prob kf_ymode_prob[8][VP8_YMODES - 1]; /* keyframe "" */
|
||||
int kf_ymode_probs_index;
|
||||
int kf_ymode_probs_update;
|
||||
vp8_prob kf_uv_mode_prob[VP8_YMODES] [VP8_UV_MODES - 1];
|
||||
|
||||
vp8_prob prob_intra_coded;
|
||||
vp8_prob prob_last_coded;
|
||||
vp8_prob prob_gf_coded;
|
||||
vp8_prob prob_intra_coded;
|
||||
vp8_prob prob_last_coded;
|
||||
vp8_prob prob_gf_coded;
|
||||
|
||||
// Context probabilities when using predictive coding of segment id
|
||||
vp8_prob segment_pred_probs[PREDICTION_PROBS];
|
||||
unsigned char temporal_update;
|
||||
// Context probabilities when using predictive coding of segment id
|
||||
vp8_prob segment_pred_probs[PREDICTION_PROBS];
|
||||
unsigned char temporal_update;
|
||||
|
||||
// Context probabilities for reference frame prediction
|
||||
unsigned char ref_scores[MAX_REF_FRAMES];
|
||||
vp8_prob ref_pred_probs[PREDICTION_PROBS];
|
||||
vp8_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
|
||||
// Context probabilities for reference frame prediction
|
||||
unsigned char ref_scores[MAX_REF_FRAMES];
|
||||
vp8_prob ref_pred_probs[PREDICTION_PROBS];
|
||||
vp8_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
|
||||
|
||||
vp8_prob prob_comppred[COMP_PRED_CONTEXTS];
|
||||
vp8_prob prob_comppred[COMP_PRED_CONTEXTS];
|
||||
|
||||
#if CONFIG_NEWENTROPY
|
||||
vp8_prob mbskip_pred_probs[MBSKIP_CONTEXTS];
|
||||
vp8_prob mbskip_pred_probs[MBSKIP_CONTEXTS];
|
||||
#endif
|
||||
|
||||
FRAME_CONTEXT lfc_a; /* last alt ref entropy */
|
||||
FRAME_CONTEXT lfc; /* last frame entropy */
|
||||
FRAME_CONTEXT fc; /* this frame entropy */
|
||||
FRAME_CONTEXT lfc_a; /* last alt ref entropy */
|
||||
FRAME_CONTEXT lfc; /* last frame entropy */
|
||||
FRAME_CONTEXT fc; /* this frame entropy */
|
||||
|
||||
//int mv_ref_ct[6][4][2];
|
||||
//int mv_ref_ct_a[6][4][2];
|
||||
//int mode_context[6][4];
|
||||
//int mode_context_a[6][4];
|
||||
//int vp8_mode_contexts[6][4];
|
||||
// int mv_ref_ct[6][4][2];
|
||||
// int mv_ref_ct_a[6][4][2];
|
||||
// int mode_context[6][4];
|
||||
// int mode_context_a[6][4];
|
||||
// int vp8_mode_contexts[6][4];
|
||||
|
||||
unsigned int current_video_frame;
|
||||
int near_boffset[3];
|
||||
int version;
|
||||
unsigned int current_video_frame;
|
||||
int near_boffset[3];
|
||||
int version;
|
||||
|
||||
#ifdef PACKET_TESTING
|
||||
VP8_HEADER oh;
|
||||
VP8_HEADER oh;
|
||||
#endif
|
||||
double bitrate;
|
||||
double framerate;
|
||||
double bitrate;
|
||||
double framerate;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
VP8_COMMON_RTCD rtcd;
|
||||
VP8_COMMON_RTCD rtcd;
|
||||
#endif
|
||||
|
||||
#if CONFIG_POSTPROC
|
||||
struct postproc_state postproc_state;
|
||||
struct postproc_state postproc_state;
|
||||
#endif
|
||||
|
||||
#if CONFIG_PRED_FILTER
|
||||
/* Prediction filter variables */
|
||||
int pred_filter_mode; // 0=disabled at the frame level (no MB filtered)
|
||||
// 1=enabled at the frame level (all MB filtered)
|
||||
// 2=specified per MB (1=filtered, 0=non-filtered)
|
||||
vp8_prob prob_pred_filter_off;
|
||||
/* Prediction filter variables */
|
||||
int pred_filter_mode; // 0=disabled at the frame level (no MB filtered)
|
||||
// 1=enabled at the frame level (all MB filtered)
|
||||
// 2=specified per MB (1=filtered, 0=non-filtered)
|
||||
vp8_prob prob_pred_filter_off;
|
||||
#endif
|
||||
|
||||
} VP8_COMMON;
|
||||
|
@ -24,43 +24,40 @@ extern "C"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
|
||||
typedef void *VP8D_PTR;
|
||||
typedef struct
|
||||
{
|
||||
int Width;
|
||||
int Height;
|
||||
int Version;
|
||||
int postprocess;
|
||||
int max_threads;
|
||||
int input_partition;
|
||||
} VP8D_CONFIG;
|
||||
typedef enum
|
||||
{
|
||||
VP8_LAST_FLAG = 1,
|
||||
VP8_GOLD_FLAG = 2,
|
||||
VP8_ALT_FLAG = 4
|
||||
} VP8_REFFRAME;
|
||||
typedef void *VP8D_PTR;
|
||||
typedef struct {
|
||||
int Width;
|
||||
int Height;
|
||||
int Version;
|
||||
int postprocess;
|
||||
int max_threads;
|
||||
int input_partition;
|
||||
} VP8D_CONFIG;
|
||||
typedef enum {
|
||||
VP8_LAST_FLAG = 1,
|
||||
VP8_GOLD_FLAG = 2,
|
||||
VP8_ALT_FLAG = 4
|
||||
} VP8_REFFRAME;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VP8D_OK = 0
|
||||
} VP8D_SETTING;
|
||||
typedef enum {
|
||||
VP8D_OK = 0
|
||||
} VP8D_SETTING;
|
||||
|
||||
void vp8dx_initialize(void);
|
||||
void vp8dx_initialize(void);
|
||||
|
||||
void vp8dx_set_setting(VP8D_PTR comp, VP8D_SETTING oxst, int x);
|
||||
void vp8dx_set_setting(VP8D_PTR comp, VP8D_SETTING oxst, int x);
|
||||
|
||||
int vp8dx_get_setting(VP8D_PTR comp, VP8D_SETTING oxst);
|
||||
int vp8dx_get_setting(VP8D_PTR comp, VP8D_SETTING oxst);
|
||||
|
||||
int vp8dx_receive_compressed_data(VP8D_PTR comp, unsigned long size, const unsigned char *dest, int64_t time_stamp);
|
||||
int vp8dx_get_raw_frame(VP8D_PTR comp, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags);
|
||||
int vp8dx_receive_compressed_data(VP8D_PTR comp, unsigned long size, const unsigned char *dest, int64_t time_stamp);
|
||||
int vp8dx_get_raw_frame(VP8D_PTR comp, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags);
|
||||
|
||||
vpx_codec_err_t vp8dx_get_reference(VP8D_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
vpx_codec_err_t vp8dx_set_reference(VP8D_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
vpx_codec_err_t vp8dx_get_reference(VP8D_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
vpx_codec_err_t vp8dx_set_reference(VP8D_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf);
|
||||
VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf);
|
||||
|
||||
void vp8dx_remove_decompressor(VP8D_PTR comp);
|
||||
void vp8dx_remove_decompressor(VP8D_PTR comp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,28 +13,28 @@
|
||||
#define POSTPROC_H
|
||||
|
||||
#define prototype_postproc_inplace(sym)\
|
||||
void sym (unsigned char *dst, int pitch, int rows, int cols,int flimit)
|
||||
void sym (unsigned char *dst, int pitch, int rows, int cols,int flimit)
|
||||
|
||||
#define prototype_postproc(sym)\
|
||||
void sym (unsigned char *src, unsigned char *dst, int src_pitch,\
|
||||
int dst_pitch, int rows, int cols, int flimit)
|
||||
void sym (unsigned char *src, unsigned char *dst, int src_pitch,\
|
||||
int dst_pitch, int rows, int cols, int flimit)
|
||||
|
||||
#define prototype_postproc_addnoise(sym) \
|
||||
void sym (unsigned char *s, char *noise, char blackclamp[16],\
|
||||
char whiteclamp[16], char bothclamp[16],\
|
||||
unsigned int w, unsigned int h, int pitch)
|
||||
void sym (unsigned char *s, char *noise, char blackclamp[16],\
|
||||
char whiteclamp[16], char bothclamp[16],\
|
||||
unsigned int w, unsigned int h, int pitch)
|
||||
|
||||
#define prototype_postproc_blend_mb_inner(sym)\
|
||||
void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
|
||||
int y1, int u1, int v1, int alpha, int stride)
|
||||
void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
|
||||
int y1, int u1, int v1, int alpha, int stride)
|
||||
|
||||
#define prototype_postproc_blend_mb_outer(sym)\
|
||||
void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
|
||||
int y1, int u1, int v1, int alpha, int stride)
|
||||
void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
|
||||
int y1, int u1, int v1, int alpha, int stride)
|
||||
|
||||
#define prototype_postproc_blend_b(sym)\
|
||||
void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
|
||||
int y1, int u1, int v1, int alpha, int stride)
|
||||
void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
|
||||
int y1, int u1, int v1, int alpha, int stride)
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#include "x86/postproc_x86.h"
|
||||
@ -81,15 +81,14 @@ typedef prototype_postproc_addnoise((*vp8_postproc_addnoise_fn_t));
|
||||
typedef prototype_postproc_blend_mb_inner((*vp8_postproc_blend_mb_inner_fn_t));
|
||||
typedef prototype_postproc_blend_mb_outer((*vp8_postproc_blend_mb_outer_fn_t));
|
||||
typedef prototype_postproc_blend_b((*vp8_postproc_blend_b_fn_t));
|
||||
typedef struct
|
||||
{
|
||||
vp8_postproc_inplace_fn_t down;
|
||||
vp8_postproc_inplace_fn_t across;
|
||||
vp8_postproc_fn_t downacross;
|
||||
vp8_postproc_addnoise_fn_t addnoise;
|
||||
vp8_postproc_blend_mb_inner_fn_t blend_mb_inner;
|
||||
vp8_postproc_blend_mb_outer_fn_t blend_mb_outer;
|
||||
vp8_postproc_blend_b_fn_t blend_b;
|
||||
typedef struct {
|
||||
vp8_postproc_inplace_fn_t down;
|
||||
vp8_postproc_inplace_fn_t across;
|
||||
vp8_postproc_fn_t downacross;
|
||||
vp8_postproc_addnoise_fn_t addnoise;
|
||||
vp8_postproc_blend_mb_inner_fn_t blend_mb_inner;
|
||||
vp8_postproc_blend_mb_outer_fn_t blend_mb_outer;
|
||||
vp8_postproc_blend_b_fn_t blend_b;
|
||||
} vp8_postproc_rtcd_vtable_t;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
@ -99,14 +98,13 @@ typedef struct
|
||||
#endif
|
||||
|
||||
#include "vpx_ports/mem.h"
|
||||
struct postproc_state
|
||||
{
|
||||
int last_q;
|
||||
int last_noise;
|
||||
char noise[3072];
|
||||
DECLARE_ALIGNED(16, char, blackclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, whiteclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, bothclamp[16]);
|
||||
struct postproc_state {
|
||||
int last_q;
|
||||
int last_noise;
|
||||
char noise[3072];
|
||||
DECLARE_ALIGNED(16, char, blackclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, whiteclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, bothclamp[16]);
|
||||
};
|
||||
#include "onyxc_int.h"
|
||||
#include "ppflags.h"
|
||||
|
@ -14,28 +14,28 @@
|
||||
|
||||
typedef void loop_filter_function_y_ppc
|
||||
(
|
||||
unsigned char *s, // source pointer
|
||||
int p, // pitch
|
||||
const signed char *flimit,
|
||||
const signed char *limit,
|
||||
const signed char *thresh
|
||||
unsigned char *s, // source pointer
|
||||
int p, // pitch
|
||||
const signed char *flimit,
|
||||
const signed char *limit,
|
||||
const signed char *thresh
|
||||
);
|
||||
|
||||
typedef void loop_filter_function_uv_ppc
|
||||
(
|
||||
unsigned char *u, // source pointer
|
||||
unsigned char *v, // source pointer
|
||||
int p, // pitch
|
||||
const signed char *flimit,
|
||||
const signed char *limit,
|
||||
const signed char *thresh
|
||||
unsigned char *u, // source pointer
|
||||
unsigned char *v, // source pointer
|
||||
int p, // pitch
|
||||
const signed char *flimit,
|
||||
const signed char *limit,
|
||||
const signed char *thresh
|
||||
);
|
||||
|
||||
typedef void loop_filter_function_s_ppc
|
||||
(
|
||||
unsigned char *s, // source pointer
|
||||
int p, // pitch
|
||||
const signed char *flimit
|
||||
unsigned char *s, // source pointer
|
||||
int p, // pitch
|
||||
const signed char *flimit
|
||||
);
|
||||
|
||||
loop_filter_function_y_ppc mbloop_filter_horizontal_edge_y_ppc;
|
||||
@ -53,83 +53,75 @@ loop_filter_function_s_ppc loop_filter_simple_vertical_edge_ppc;
|
||||
|
||||
// Horizontal MB filtering
|
||||
void loop_filter_mbh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
mbloop_filter_horizontal_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
mbloop_filter_horizontal_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
|
||||
if (u_ptr)
|
||||
mbloop_filter_horizontal_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
if (u_ptr)
|
||||
mbloop_filter_horizontal_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
}
|
||||
|
||||
void loop_filter_mbhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr, y_stride, lfi->mbflim);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr, y_stride, lfi->mbflim);
|
||||
}
|
||||
|
||||
// Vertical MB Filtering
|
||||
void loop_filter_mbv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
mbloop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
mbloop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
|
||||
if (u_ptr)
|
||||
mbloop_filter_vertical_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
if (u_ptr)
|
||||
mbloop_filter_vertical_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
|
||||
}
|
||||
|
||||
void loop_filter_mbvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr, y_stride, lfi->mbflim);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr, y_stride, lfi->mbflim);
|
||||
}
|
||||
|
||||
// Horizontal B Filtering
|
||||
void loop_filter_bh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
// These should all be done at once with one call, instead of 3
|
||||
loop_filter_horizontal_edge_y_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
loop_filter_horizontal_edge_y_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
loop_filter_horizontal_edge_y_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
// These should all be done at once with one call, instead of 3
|
||||
loop_filter_horizontal_edge_y_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
loop_filter_horizontal_edge_y_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
loop_filter_horizontal_edge_y_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
|
||||
if (u_ptr)
|
||||
loop_filter_horizontal_edge_uv_ppc(u_ptr + 4 * uv_stride, v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
if (u_ptr)
|
||||
loop_filter_horizontal_edge_uv_ppc(u_ptr + 4 * uv_stride, v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
}
|
||||
|
||||
void loop_filter_bhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim);
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim);
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim);
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim);
|
||||
loop_filter_simple_horizontal_edge_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim);
|
||||
}
|
||||
|
||||
// Vertical B Filtering
|
||||
void loop_filter_bv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
loop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
loop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
|
||||
if (u_ptr)
|
||||
loop_filter_vertical_edge_uv_ppc(u_ptr + 4, v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
if (u_ptr)
|
||||
loop_filter_vertical_edge_uv_ppc(u_ptr + 4, v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr);
|
||||
}
|
||||
|
||||
void loop_filter_bvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr + 4, y_stride, lfi->flim);
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr + 8, y_stride, lfi->flim);
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr + 12, y_stride, lfi->flim);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
(void)u_ptr;
|
||||
(void)v_ptr;
|
||||
(void)uv_stride;
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr + 4, y_stride, lfi->flim);
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr + 8, y_stride, lfi->flim);
|
||||
loop_filter_simple_vertical_edge_ppc(y_ptr + 12, y_stride, lfi->flim);
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ void (*vp8_short_idct4x4_1)(short *input, short *output, int pitch);
|
||||
void (*vp8_dc_only_idct)(short input_dc, short *output, int pitch);
|
||||
|
||||
extern void (*vp8_post_proc_down_and_across)(
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit
|
||||
);
|
||||
|
||||
extern void (*vp8_mbpost_proc_down)(unsigned char *dst, int pitch, int rows, int cols, int flimit);
|
||||
@ -37,13 +37,13 @@ extern void vp8_mbpost_proc_across_ip_c(unsigned char *src, int pitch, int rows,
|
||||
|
||||
extern void vp8_post_proc_down_and_across_c
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit
|
||||
unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit
|
||||
);
|
||||
void vp8_plane_add_noise_c(unsigned char *Start, unsigned int Width, unsigned int Height, int Pitch, int q, int a);
|
||||
|
||||
@ -123,49 +123,47 @@ extern loop_filter_block_function *vp8_lf_mbhsimple;
|
||||
extern loop_filter_block_function *vp8_lf_bvsimple;
|
||||
extern loop_filter_block_function *vp8_lf_bhsimple;
|
||||
|
||||
void vp8_clear_c(void)
|
||||
{
|
||||
void vp8_clear_c(void) {
|
||||
}
|
||||
|
||||
void vp8_machine_specific_config(void)
|
||||
{
|
||||
// Pure C:
|
||||
vp8_clear_system_state = vp8_clear_c;
|
||||
vp8_recon_b = vp8_recon_b_c;
|
||||
vp8_recon4b = vp8_recon4b_c;
|
||||
vp8_recon2b = vp8_recon2b_c;
|
||||
void vp8_machine_specific_config(void) {
|
||||
// Pure C:
|
||||
vp8_clear_system_state = vp8_clear_c;
|
||||
vp8_recon_b = vp8_recon_b_c;
|
||||
vp8_recon4b = vp8_recon4b_c;
|
||||
vp8_recon2b = vp8_recon2b_c;
|
||||
|
||||
vp8_bilinear_predict16x16 = bilinear_predict16x16_ppc;
|
||||
vp8_bilinear_predict8x8 = bilinear_predict8x8_ppc;
|
||||
vp8_bilinear_predict8x4 = bilinear_predict8x4_ppc;
|
||||
vp8_bilinear_predict = bilinear_predict4x4_ppc;
|
||||
vp8_bilinear_predict16x16 = bilinear_predict16x16_ppc;
|
||||
vp8_bilinear_predict8x8 = bilinear_predict8x8_ppc;
|
||||
vp8_bilinear_predict8x4 = bilinear_predict8x4_ppc;
|
||||
vp8_bilinear_predict = bilinear_predict4x4_ppc;
|
||||
|
||||
vp8_sixtap_predict16x16 = sixtap_predict16x16_ppc;
|
||||
vp8_sixtap_predict8x8 = sixtap_predict8x8_ppc;
|
||||
vp8_sixtap_predict8x4 = sixtap_predict8x4_ppc;
|
||||
vp8_sixtap_predict = sixtap_predict_ppc;
|
||||
vp8_sixtap_predict16x16 = sixtap_predict16x16_ppc;
|
||||
vp8_sixtap_predict8x8 = sixtap_predict8x8_ppc;
|
||||
vp8_sixtap_predict8x4 = sixtap_predict8x4_ppc;
|
||||
vp8_sixtap_predict = sixtap_predict_ppc;
|
||||
|
||||
vp8_short_idct4x4_1 = vp8_short_idct4x4llm_1_c;
|
||||
vp8_short_idct4x4 = short_idct4x4llm_ppc;
|
||||
vp8_dc_only_idct = vp8_dc_only_idct_c;
|
||||
vp8_short_idct4x4_1 = vp8_short_idct4x4llm_1_c;
|
||||
vp8_short_idct4x4 = short_idct4x4llm_ppc;
|
||||
vp8_dc_only_idct = vp8_dc_only_idct_c;
|
||||
|
||||
vp8_lf_mbvfull = loop_filter_mbv_ppc;
|
||||
vp8_lf_bvfull = loop_filter_bv_ppc;
|
||||
vp8_lf_mbhfull = loop_filter_mbh_ppc;
|
||||
vp8_lf_bhfull = loop_filter_bh_ppc;
|
||||
vp8_lf_mbvfull = loop_filter_mbv_ppc;
|
||||
vp8_lf_bvfull = loop_filter_bv_ppc;
|
||||
vp8_lf_mbhfull = loop_filter_mbh_ppc;
|
||||
vp8_lf_bhfull = loop_filter_bh_ppc;
|
||||
|
||||
vp8_lf_mbvsimple = loop_filter_mbvs_ppc;
|
||||
vp8_lf_bvsimple = loop_filter_bvs_ppc;
|
||||
vp8_lf_mbhsimple = loop_filter_mbhs_ppc;
|
||||
vp8_lf_bhsimple = loop_filter_bhs_ppc;
|
||||
vp8_lf_mbvsimple = loop_filter_mbvs_ppc;
|
||||
vp8_lf_bvsimple = loop_filter_bvs_ppc;
|
||||
vp8_lf_mbhsimple = loop_filter_mbhs_ppc;
|
||||
vp8_lf_bhsimple = loop_filter_bhs_ppc;
|
||||
|
||||
vp8_post_proc_down_and_across = vp8_post_proc_down_and_across_c;
|
||||
vp8_mbpost_proc_down = vp8_mbpost_proc_down_c;
|
||||
vp8_mbpost_proc_across_ip = vp8_mbpost_proc_across_ip_c;
|
||||
vp8_plane_add_noise = vp8_plane_add_noise_c;
|
||||
vp8_post_proc_down_and_across = vp8_post_proc_down_and_across_c;
|
||||
vp8_mbpost_proc_down = vp8_mbpost_proc_down_c;
|
||||
vp8_mbpost_proc_across_ip = vp8_mbpost_proc_across_ip_c;
|
||||
vp8_plane_add_noise = vp8_plane_add_noise_c;
|
||||
|
||||
vp8_copy_mem16x16 = copy_mem16x16_ppc;
|
||||
vp8_copy_mem8x8 = vp8_copy_mem8x8_c;
|
||||
vp8_copy_mem8x4 = vp8_copy_mem8x4_c;
|
||||
vp8_copy_mem16x16 = copy_mem16x16_ppc;
|
||||
vp8_copy_mem8x8 = vp8_copy_mem8x8_c;
|
||||
vp8_copy_mem8x4 = vp8_copy_mem8x4_c;
|
||||
|
||||
}
|
||||
|
@ -11,30 +11,28 @@
|
||||
|
||||
#ifndef __INC_PPFLAGS_H
|
||||
#define __INC_PPFLAGS_H
|
||||
enum
|
||||
{
|
||||
VP8D_NOFILTERING = 0,
|
||||
VP8D_DEBLOCK = 1<<0,
|
||||
VP8D_DEMACROBLOCK = 1<<1,
|
||||
VP8D_ADDNOISE = 1<<2,
|
||||
VP8D_DEBUG_TXT_FRAME_INFO = 1<<3,
|
||||
VP8D_DEBUG_TXT_MBLK_MODES = 1<<4,
|
||||
VP8D_DEBUG_TXT_DC_DIFF = 1<<5,
|
||||
VP8D_DEBUG_TXT_RATE_INFO = 1<<6,
|
||||
VP8D_DEBUG_DRAW_MV = 1<<7,
|
||||
VP8D_DEBUG_CLR_BLK_MODES = 1<<8,
|
||||
VP8D_DEBUG_CLR_FRM_REF_BLKS = 1<<9
|
||||
enum {
|
||||
VP8D_NOFILTERING = 0,
|
||||
VP8D_DEBLOCK = 1 << 0,
|
||||
VP8D_DEMACROBLOCK = 1 << 1,
|
||||
VP8D_ADDNOISE = 1 << 2,
|
||||
VP8D_DEBUG_TXT_FRAME_INFO = 1 << 3,
|
||||
VP8D_DEBUG_TXT_MBLK_MODES = 1 << 4,
|
||||
VP8D_DEBUG_TXT_DC_DIFF = 1 << 5,
|
||||
VP8D_DEBUG_TXT_RATE_INFO = 1 << 6,
|
||||
VP8D_DEBUG_DRAW_MV = 1 << 7,
|
||||
VP8D_DEBUG_CLR_BLK_MODES = 1 << 8,
|
||||
VP8D_DEBUG_CLR_FRM_REF_BLKS = 1 << 9
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int post_proc_flag;
|
||||
int deblocking_level;
|
||||
int noise_level;
|
||||
int display_ref_frame_flag;
|
||||
int display_mb_modes_flag;
|
||||
int display_b_modes_flag;
|
||||
int display_mv_flag;
|
||||
typedef struct {
|
||||
int post_proc_flag;
|
||||
int deblocking_level;
|
||||
int noise_level;
|
||||
int display_ref_frame_flag;
|
||||
int display_mb_modes_flag;
|
||||
int display_b_modes_flag;
|
||||
int display_mv_flag;
|
||||
} vp8_ppflags_t;
|
||||
|
||||
#endif
|
||||
|
@ -14,169 +14,161 @@
|
||||
// TBD prediction functions for various bitstream signals
|
||||
|
||||
// Returns a context number for the given MB prediction signal
|
||||
unsigned char get_pred_context( VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id )
|
||||
{
|
||||
int pred_context;
|
||||
MODE_INFO *m = xd->mode_info_context;
|
||||
unsigned char get_pred_context(VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id) {
|
||||
int pred_context;
|
||||
MODE_INFO *m = xd->mode_info_context;
|
||||
|
||||
// Note:
|
||||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries correpsonding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
switch (pred_id)
|
||||
{
|
||||
// Note:
|
||||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries correpsonding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_context = (m - 1)->mbmi.seg_id_predicted +
|
||||
(m - cm->mode_info_stride)->mbmi.seg_id_predicted;
|
||||
break;
|
||||
pred_context = (m - 1)->mbmi.seg_id_predicted +
|
||||
(m - cm->mode_info_stride)->mbmi.seg_id_predicted;
|
||||
break;
|
||||
|
||||
|
||||
case PRED_REF:
|
||||
pred_context = (m - 1)->mbmi.ref_predicted +
|
||||
(m - cm->mode_info_stride)->mbmi.ref_predicted;
|
||||
break;
|
||||
pred_context = (m - 1)->mbmi.ref_predicted +
|
||||
(m - cm->mode_info_stride)->mbmi.ref_predicted;
|
||||
break;
|
||||
|
||||
case PRED_COMP:
|
||||
// Context based on use of comp pred flag by neighbours
|
||||
//pred_context =
|
||||
// ((m - 1)->mbmi.second_ref_frame != INTRA_FRAME) +
|
||||
// ((m - cm->mode_info_stride)->mbmi.second_ref_frame != INTRA_FRAME);
|
||||
// Context based on use of comp pred flag by neighbours
|
||||
// pred_context =
|
||||
// ((m - 1)->mbmi.second_ref_frame != INTRA_FRAME) +
|
||||
// ((m - cm->mode_info_stride)->mbmi.second_ref_frame != INTRA_FRAME);
|
||||
|
||||
// Context based on mode and reference frame
|
||||
//if ( m->mbmi.ref_frame == LAST_FRAME )
|
||||
// pred_context = 0 + (m->mbmi.mode != ZEROMV);
|
||||
//else if ( m->mbmi.ref_frame == GOLDEN_FRAME )
|
||||
// pred_context = 2 + (m->mbmi.mode != ZEROMV);
|
||||
//else
|
||||
// pred_context = 4 + (m->mbmi.mode != ZEROMV);
|
||||
// Context based on mode and reference frame
|
||||
// if ( m->mbmi.ref_frame == LAST_FRAME )
|
||||
// pred_context = 0 + (m->mbmi.mode != ZEROMV);
|
||||
// else if ( m->mbmi.ref_frame == GOLDEN_FRAME )
|
||||
// pred_context = 2 + (m->mbmi.mode != ZEROMV);
|
||||
// else
|
||||
// pred_context = 4 + (m->mbmi.mode != ZEROMV);
|
||||
|
||||
if ( m->mbmi.ref_frame == LAST_FRAME )
|
||||
pred_context = 0;
|
||||
else
|
||||
pred_context = 1;
|
||||
if (m->mbmi.ref_frame == LAST_FRAME)
|
||||
pred_context = 0;
|
||||
else
|
||||
pred_context = 1;
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
#if CONFIG_NEWENTROPY
|
||||
case PRED_MBSKIP:
|
||||
pred_context = (m - 1)->mbmi.mb_skip_coeff +
|
||||
(m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
|
||||
break;
|
||||
pred_context = (m - 1)->mbmi.mb_skip_coeff +
|
||||
(m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_context = 0;
|
||||
break;
|
||||
}
|
||||
// TODO *** add error trap code.
|
||||
pred_context = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return pred_context;
|
||||
return pred_context;
|
||||
}
|
||||
|
||||
// This function returns a context probability for coding a given
|
||||
// prediction signal
|
||||
vp8_prob get_pred_prob( VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id )
|
||||
{
|
||||
vp8_prob pred_probability;
|
||||
int pred_context;
|
||||
vp8_prob get_pred_prob(VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id) {
|
||||
vp8_prob pred_probability;
|
||||
int pred_context;
|
||||
|
||||
// Get the appropriate prediction context
|
||||
pred_context = get_pred_context( cm, xd, pred_id );
|
||||
// Get the appropriate prediction context
|
||||
pred_context = get_pred_context(cm, xd, pred_id);
|
||||
|
||||
switch (pred_id)
|
||||
{
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_probability = cm->segment_pred_probs[pred_context];
|
||||
break;
|
||||
pred_probability = cm->segment_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
case PRED_REF:
|
||||
pred_probability = cm->ref_pred_probs[pred_context];
|
||||
break;
|
||||
pred_probability = cm->ref_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
case PRED_COMP:
|
||||
// In keeping with convention elsewhre the probability returned is
|
||||
// the probability of a "0" outcome which in this case means the
|
||||
// probability of comp pred off.
|
||||
pred_probability = cm->prob_comppred[pred_context];
|
||||
break;
|
||||
// In keeping with convention elsewhre the probability returned is
|
||||
// the probability of a "0" outcome which in this case means the
|
||||
// probability of comp pred off.
|
||||
pred_probability = cm->prob_comppred[pred_context];
|
||||
break;
|
||||
|
||||
#if CONFIG_NEWENTROPY
|
||||
case PRED_MBSKIP:
|
||||
pred_probability = cm->mbskip_pred_probs[pred_context];
|
||||
break;
|
||||
pred_probability = cm->mbskip_pred_probs[pred_context];
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_probability = 128;
|
||||
break;
|
||||
}
|
||||
// TODO *** add error trap code.
|
||||
pred_probability = 128;
|
||||
break;
|
||||
}
|
||||
|
||||
return pred_probability;
|
||||
return pred_probability;
|
||||
}
|
||||
|
||||
// This function returns the status of the given prediction signal.
|
||||
// I.e. is the predicted value for the given signal correct.
|
||||
unsigned char get_pred_flag( MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id )
|
||||
{
|
||||
unsigned char pred_flag = 0;
|
||||
unsigned char get_pred_flag(MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id) {
|
||||
unsigned char pred_flag = 0;
|
||||
|
||||
switch (pred_id)
|
||||
{
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
|
||||
break;
|
||||
pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
|
||||
break;
|
||||
|
||||
case PRED_REF:
|
||||
pred_flag = xd->mode_info_context->mbmi.ref_predicted;
|
||||
break;
|
||||
pred_flag = xd->mode_info_context->mbmi.ref_predicted;
|
||||
break;
|
||||
|
||||
#if CONFIG_NEWENTROPY
|
||||
case PRED_MBSKIP:
|
||||
pred_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
|
||||
break;
|
||||
pred_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_flag = 0;
|
||||
break;
|
||||
}
|
||||
// TODO *** add error trap code.
|
||||
pred_flag = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return pred_flag;
|
||||
return pred_flag;
|
||||
}
|
||||
|
||||
// This function sets the status of the given prediction signal.
|
||||
// I.e. is the predicted value for the given signal correct.
|
||||
void set_pred_flag( MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id,
|
||||
unsigned char pred_flag)
|
||||
{
|
||||
switch (pred_id)
|
||||
{
|
||||
void set_pred_flag(MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id,
|
||||
unsigned char pred_flag) {
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
xd->mode_info_context->mbmi.seg_id_predicted = pred_flag;
|
||||
break;
|
||||
xd->mode_info_context->mbmi.seg_id_predicted = pred_flag;
|
||||
break;
|
||||
|
||||
case PRED_REF:
|
||||
xd->mode_info_context->mbmi.ref_predicted = pred_flag;
|
||||
break;
|
||||
xd->mode_info_context->mbmi.ref_predicted = pred_flag;
|
||||
break;
|
||||
|
||||
#if CONFIG_NEWENTROPY
|
||||
case PRED_MBSKIP:
|
||||
xd->mode_info_context->mbmi.mb_skip_coeff = pred_flag;
|
||||
break;
|
||||
xd->mode_info_context->mbmi.mb_skip_coeff = pred_flag;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
break;
|
||||
}
|
||||
// TODO *** add error trap code.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -184,123 +176,107 @@ void set_pred_flag( MACROBLOCKD *const xd,
|
||||
// peredict various bitstream signals.
|
||||
|
||||
// Macroblock segment id prediction function
|
||||
unsigned char get_pred_mb_segid( VP8_COMMON *const cm, int MbIndex )
|
||||
{
|
||||
// Currently the prediction for the macroblock segment ID is
|
||||
// the value stored for this macroblock in the previous frame.
|
||||
return cm->last_frame_seg_map[MbIndex];
|
||||
unsigned char get_pred_mb_segid(VP8_COMMON *const cm, int MbIndex) {
|
||||
// Currently the prediction for the macroblock segment ID is
|
||||
// the value stored for this macroblock in the previous frame.
|
||||
return cm->last_frame_seg_map[MbIndex];
|
||||
}
|
||||
|
||||
MV_REFERENCE_FRAME get_pred_ref( VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd )
|
||||
{
|
||||
MODE_INFO *m = xd->mode_info_context;
|
||||
MV_REFERENCE_FRAME get_pred_ref(VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd) {
|
||||
MODE_INFO *m = xd->mode_info_context;
|
||||
|
||||
MV_REFERENCE_FRAME left;
|
||||
MV_REFERENCE_FRAME above;
|
||||
MV_REFERENCE_FRAME above_left;
|
||||
MV_REFERENCE_FRAME pred_ref = LAST_FRAME;
|
||||
MV_REFERENCE_FRAME left;
|
||||
MV_REFERENCE_FRAME above;
|
||||
MV_REFERENCE_FRAME above_left;
|
||||
MV_REFERENCE_FRAME pred_ref = LAST_FRAME;
|
||||
|
||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||
int seg_ref_active;
|
||||
int i;
|
||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||
int seg_ref_active;
|
||||
int i;
|
||||
|
||||
unsigned char frame_allowed[MAX_REF_FRAMES] = {1,1,1,1};
|
||||
unsigned char ref_score[MAX_REF_FRAMES];
|
||||
unsigned char best_score = 0;
|
||||
unsigned char left_in_image;
|
||||
unsigned char above_in_image;
|
||||
unsigned char above_left_in_image;
|
||||
unsigned char frame_allowed[MAX_REF_FRAMES] = {1, 1, 1, 1};
|
||||
unsigned char ref_score[MAX_REF_FRAMES];
|
||||
unsigned char best_score = 0;
|
||||
unsigned char left_in_image;
|
||||
unsigned char above_in_image;
|
||||
unsigned char above_left_in_image;
|
||||
|
||||
// Is segment coding ennabled
|
||||
seg_ref_active = segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME );
|
||||
// Is segment coding ennabled
|
||||
seg_ref_active = segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
|
||||
|
||||
// Special case treatment if segment coding is enabled.
|
||||
// Dont allow prediction of a reference frame that the segment
|
||||
// does not allow
|
||||
if ( seg_ref_active )
|
||||
{
|
||||
for ( i = 0; i < MAX_REF_FRAMES; i++ )
|
||||
{
|
||||
frame_allowed[i] =
|
||||
check_segref( xd, segment_id, i );
|
||||
// Special case treatment if segment coding is enabled.
|
||||
// Dont allow prediction of a reference frame that the segment
|
||||
// does not allow
|
||||
if (seg_ref_active) {
|
||||
for (i = 0; i < MAX_REF_FRAMES; i++) {
|
||||
frame_allowed[i] =
|
||||
check_segref(xd, segment_id, i);
|
||||
|
||||
// Score set to 0 if ref frame not allowed
|
||||
ref_score[i] = cm->ref_scores[i] * frame_allowed[i];
|
||||
}
|
||||
// Score set to 0 if ref frame not allowed
|
||||
ref_score[i] = cm->ref_scores[i] * frame_allowed[i];
|
||||
}
|
||||
else
|
||||
vpx_memcpy( ref_score, cm->ref_scores, sizeof(ref_score) );
|
||||
} else
|
||||
vpx_memcpy(ref_score, cm->ref_scores, sizeof(ref_score));
|
||||
|
||||
// Reference frames used by neighbours
|
||||
left = (m - 1)->mbmi.ref_frame;
|
||||
above = (m - cm->mode_info_stride)->mbmi.ref_frame;
|
||||
above_left = (m - 1 - cm->mode_info_stride)->mbmi.ref_frame;
|
||||
// Reference frames used by neighbours
|
||||
left = (m - 1)->mbmi.ref_frame;
|
||||
above = (m - cm->mode_info_stride)->mbmi.ref_frame;
|
||||
above_left = (m - 1 - cm->mode_info_stride)->mbmi.ref_frame;
|
||||
|
||||
// Are neighbours in image
|
||||
left_in_image = (m - 1)->mbmi.mb_in_image;
|
||||
above_in_image = (m - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
above_left_in_image = (m - 1 - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
// Are neighbours in image
|
||||
left_in_image = (m - 1)->mbmi.mb_in_image;
|
||||
above_in_image = (m - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
above_left_in_image = (m - 1 - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
|
||||
// Adjust scores for candidate reference frames based on neigbours
|
||||
if ( frame_allowed[left] && left_in_image )
|
||||
{
|
||||
ref_score[left] += 16;
|
||||
if ( above_left_in_image && (left == above_left) )
|
||||
ref_score[left] += 4;
|
||||
}
|
||||
if ( frame_allowed[above] && above_in_image )
|
||||
{
|
||||
ref_score[above] += 16;
|
||||
if ( above_left_in_image && (above == above_left) )
|
||||
ref_score[above] += 4;
|
||||
// Adjust scores for candidate reference frames based on neigbours
|
||||
if (frame_allowed[left] && left_in_image) {
|
||||
ref_score[left] += 16;
|
||||
if (above_left_in_image && (left == above_left))
|
||||
ref_score[left] += 4;
|
||||
}
|
||||
if (frame_allowed[above] && above_in_image) {
|
||||
ref_score[above] += 16;
|
||||
if (above_left_in_image && (above == above_left))
|
||||
ref_score[above] += 4;
|
||||
}
|
||||
|
||||
// Now choose the candidate with the highest score
|
||||
for (i = 0; i < MAX_REF_FRAMES; i++) {
|
||||
if (ref_score[i] > best_score) {
|
||||
pred_ref = i;
|
||||
best_score = ref_score[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Now choose the candidate with the highest score
|
||||
for ( i = 0; i < MAX_REF_FRAMES; i++ )
|
||||
{
|
||||
if ( ref_score[i] > best_score )
|
||||
{
|
||||
pred_ref = i;
|
||||
best_score = ref_score[i];
|
||||
}
|
||||
}
|
||||
|
||||
return pred_ref;
|
||||
return pred_ref;
|
||||
}
|
||||
|
||||
// Functions to computes a set of modified reference frame probabilities
|
||||
// to use when the prediction of the reference frame value fails
|
||||
void calc_ref_probs( int * count, vp8_prob * probs )
|
||||
{
|
||||
int tot_count;
|
||||
void calc_ref_probs(int *count, vp8_prob *probs) {
|
||||
int tot_count;
|
||||
|
||||
tot_count = count[0] + count[1] + count[2] + count[3];
|
||||
if ( tot_count )
|
||||
{
|
||||
probs[0] = (vp8_prob)((count[0] * 255 + (tot_count >> 1)) / tot_count);
|
||||
probs[0] += !probs[0];
|
||||
}
|
||||
else
|
||||
probs[0] = 128;
|
||||
tot_count = count[0] + count[1] + count[2] + count[3];
|
||||
if (tot_count) {
|
||||
probs[0] = (vp8_prob)((count[0] * 255 + (tot_count >> 1)) / tot_count);
|
||||
probs[0] += !probs[0];
|
||||
} else
|
||||
probs[0] = 128;
|
||||
|
||||
tot_count -= count[0];
|
||||
if ( tot_count )
|
||||
{
|
||||
probs[1] = (vp8_prob)((count[1] * 255 + (tot_count >> 1)) / tot_count);
|
||||
probs[1] += !probs[1];
|
||||
}
|
||||
else
|
||||
probs[1] = 128;
|
||||
tot_count -= count[0];
|
||||
if (tot_count) {
|
||||
probs[1] = (vp8_prob)((count[1] * 255 + (tot_count >> 1)) / tot_count);
|
||||
probs[1] += !probs[1];
|
||||
} else
|
||||
probs[1] = 128;
|
||||
|
||||
tot_count -= count[1];
|
||||
if ( tot_count )
|
||||
{
|
||||
probs[2] = (vp8_prob)((count[2] * 255 + (tot_count >> 1)) / tot_count);
|
||||
probs[2] += !probs[2];
|
||||
}
|
||||
else
|
||||
probs[2] = 128;
|
||||
tot_count -= count[1];
|
||||
if (tot_count) {
|
||||
probs[2] = (vp8_prob)((count[2] * 255 + (tot_count >> 1)) / tot_count);
|
||||
probs[2] += !probs[2];
|
||||
} else
|
||||
probs[2] = 128;
|
||||
|
||||
}
|
||||
|
||||
@ -308,58 +284,57 @@ void calc_ref_probs( int * count, vp8_prob * probs )
|
||||
// Values willbe set to 0 for reference frame options that are not possible
|
||||
// because wither they were predicted and prediction has failed or because
|
||||
// they are not allowed for a given segment.
|
||||
void compute_mod_refprobs( VP8_COMMON *const cm )
|
||||
{
|
||||
int norm_cnt[MAX_REF_FRAMES];
|
||||
int intra_count;
|
||||
int inter_count;
|
||||
int last_count;
|
||||
int gfarf_count;
|
||||
int gf_count;
|
||||
int arf_count;
|
||||
void compute_mod_refprobs(VP8_COMMON *const cm) {
|
||||
int norm_cnt[MAX_REF_FRAMES];
|
||||
int intra_count;
|
||||
int inter_count;
|
||||
int last_count;
|
||||
int gfarf_count;
|
||||
int gf_count;
|
||||
int arf_count;
|
||||
|
||||
intra_count = cm->prob_intra_coded;
|
||||
inter_count = (255 - intra_count);
|
||||
last_count = (inter_count * cm->prob_last_coded)/255;
|
||||
gfarf_count = inter_count - last_count;
|
||||
gf_count = (gfarf_count * cm->prob_gf_coded)/255;
|
||||
arf_count = gfarf_count - gf_count;
|
||||
intra_count = cm->prob_intra_coded;
|
||||
inter_count = (255 - intra_count);
|
||||
last_count = (inter_count * cm->prob_last_coded) / 255;
|
||||
gfarf_count = inter_count - last_count;
|
||||
gf_count = (gfarf_count * cm->prob_gf_coded) / 255;
|
||||
arf_count = gfarf_count - gf_count;
|
||||
|
||||
// Work out modified reference frame probabilities to use where prediction
|
||||
// of the reference frame fails
|
||||
norm_cnt[0] = 0;
|
||||
norm_cnt[1] = last_count;
|
||||
norm_cnt[2] = gf_count;
|
||||
norm_cnt[3] = arf_count;
|
||||
calc_ref_probs( norm_cnt, cm->mod_refprobs[INTRA_FRAME] );
|
||||
cm->mod_refprobs[INTRA_FRAME][0] = 0; // This branch implicit
|
||||
// Work out modified reference frame probabilities to use where prediction
|
||||
// of the reference frame fails
|
||||
norm_cnt[0] = 0;
|
||||
norm_cnt[1] = last_count;
|
||||
norm_cnt[2] = gf_count;
|
||||
norm_cnt[3] = arf_count;
|
||||
calc_ref_probs(norm_cnt, cm->mod_refprobs[INTRA_FRAME]);
|
||||
cm->mod_refprobs[INTRA_FRAME][0] = 0; // This branch implicit
|
||||
|
||||
norm_cnt[0] = intra_count;
|
||||
norm_cnt[1] = 0;
|
||||
norm_cnt[2] = gf_count;
|
||||
norm_cnt[3] = arf_count;
|
||||
calc_ref_probs( norm_cnt, cm->mod_refprobs[LAST_FRAME]);
|
||||
cm->mod_refprobs[LAST_FRAME][1] = 0; // This branch implicit
|
||||
norm_cnt[0] = intra_count;
|
||||
norm_cnt[1] = 0;
|
||||
norm_cnt[2] = gf_count;
|
||||
norm_cnt[3] = arf_count;
|
||||
calc_ref_probs(norm_cnt, cm->mod_refprobs[LAST_FRAME]);
|
||||
cm->mod_refprobs[LAST_FRAME][1] = 0; // This branch implicit
|
||||
|
||||
norm_cnt[0] = intra_count;
|
||||
norm_cnt[1] = last_count;
|
||||
norm_cnt[2] = 0;
|
||||
norm_cnt[3] = arf_count;
|
||||
calc_ref_probs( norm_cnt, cm->mod_refprobs[GOLDEN_FRAME] );
|
||||
cm->mod_refprobs[GOLDEN_FRAME][2] = 0; // This branch implicit
|
||||
norm_cnt[0] = intra_count;
|
||||
norm_cnt[1] = last_count;
|
||||
norm_cnt[2] = 0;
|
||||
norm_cnt[3] = arf_count;
|
||||
calc_ref_probs(norm_cnt, cm->mod_refprobs[GOLDEN_FRAME]);
|
||||
cm->mod_refprobs[GOLDEN_FRAME][2] = 0; // This branch implicit
|
||||
|
||||
norm_cnt[0] = intra_count;
|
||||
norm_cnt[1] = last_count;
|
||||
norm_cnt[2] = gf_count;
|
||||
norm_cnt[3] = 0;
|
||||
calc_ref_probs( norm_cnt, cm->mod_refprobs[ALTREF_FRAME] );
|
||||
cm->mod_refprobs[ALTREF_FRAME][2] = 0; // This branch implicit
|
||||
norm_cnt[0] = intra_count;
|
||||
norm_cnt[1] = last_count;
|
||||
norm_cnt[2] = gf_count;
|
||||
norm_cnt[3] = 0;
|
||||
calc_ref_probs(norm_cnt, cm->mod_refprobs[ALTREF_FRAME]);
|
||||
cm->mod_refprobs[ALTREF_FRAME][2] = 0; // This branch implicit
|
||||
|
||||
// Score the reference frames based on overal frequency.
|
||||
// These scores contribute to the prediction choices.
|
||||
// Max score 17 min 1
|
||||
cm->ref_scores[INTRA_FRAME] = 1 + (intra_count * 16 / 255);
|
||||
cm->ref_scores[LAST_FRAME] = 1 + (last_count * 16 / 255);
|
||||
cm->ref_scores[GOLDEN_FRAME] = 1 + (gf_count * 16 / 255);
|
||||
cm->ref_scores[ALTREF_FRAME] = 1 + (arf_count * 16 / 255);
|
||||
// Score the reference frames based on overal frequency.
|
||||
// These scores contribute to the prediction choices.
|
||||
// Max score 17 min 1
|
||||
cm->ref_scores[INTRA_FRAME] = 1 + (intra_count * 16 / 255);
|
||||
cm->ref_scores[LAST_FRAME] = 1 + (last_count * 16 / 255);
|
||||
cm->ref_scores[GOLDEN_FRAME] = 1 + (gf_count * 16 / 255);
|
||||
cm->ref_scores[ALTREF_FRAME] = 1 + (arf_count * 16 / 255);
|
||||
}
|
||||
|
@ -17,38 +17,37 @@
|
||||
|
||||
|
||||
// Predicted items
|
||||
typedef enum
|
||||
{
|
||||
PRED_SEG_ID = 0, // Segment identifier
|
||||
PRED_REF = 1,
|
||||
PRED_COMP = 2,
|
||||
typedef enum {
|
||||
PRED_SEG_ID = 0, // Segment identifier
|
||||
PRED_REF = 1,
|
||||
PRED_COMP = 2,
|
||||
#if CONFIG_NEWENTROPY
|
||||
PRED_MBSKIP = 3,
|
||||
PRED_MBSKIP = 3,
|
||||
#endif
|
||||
|
||||
} PRED_ID;
|
||||
|
||||
|
||||
extern unsigned char get_pred_context( VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id );
|
||||
extern unsigned char get_pred_context(VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern vp8_prob get_pred_prob( VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id );
|
||||
extern vp8_prob get_pred_prob(VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern unsigned char get_pred_flag( MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id );
|
||||
extern unsigned char get_pred_flag(MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern void set_pred_flag( MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id,
|
||||
unsigned char pred_flag);
|
||||
extern void set_pred_flag(MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id,
|
||||
unsigned char pred_flag);
|
||||
|
||||
|
||||
extern unsigned char get_pred_mb_segid( VP8_COMMON *const cm, int MbIndex );
|
||||
extern unsigned char get_pred_mb_segid(VP8_COMMON *const cm, int MbIndex);
|
||||
|
||||
extern MV_REFERENCE_FRAME get_pred_ref( VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd );
|
||||
extern void compute_mod_refprobs( VP8_COMMON *const cm );
|
||||
extern MV_REFERENCE_FRAME get_pred_ref(VP8_COMMON *const cm,
|
||||
MACROBLOCKD *const xd);
|
||||
extern void compute_mod_refprobs(VP8_COMMON *const cm);
|
||||
|
||||
#endif /* __INC_PRED_COMMON_H__ */
|
||||
|
@ -9,74 +9,61 @@
|
||||
*/
|
||||
|
||||
#if CONFIG_ROTATION
|
||||
typedef struct
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
unsigned long t;
|
||||
typedef struct {
|
||||
int y;
|
||||
int x;
|
||||
unsigned long t;
|
||||
} tap;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tap pt[4];
|
||||
typedef struct {
|
||||
tap pt[4];
|
||||
} point_taps;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
point_taps pt[256];
|
||||
typedef struct {
|
||||
point_taps pt[256];
|
||||
} mb_taps;
|
||||
|
||||
mb_taps mt_8x8[] =
|
||||
{
|
||||
#include "rotate2.h"
|
||||
mb_taps mt_8x8[] = {
|
||||
#include "rotate2.h"
|
||||
};
|
||||
|
||||
mb_taps mt[] =
|
||||
{
|
||||
#include "rotate.h"
|
||||
mb_taps mt[] = {
|
||||
#include "rotate.h"
|
||||
};
|
||||
|
||||
void predict_rotated_16x16(int rotation_index, unsigned char *src, int sp,
|
||||
unsigned char *dst, int dp)
|
||||
{
|
||||
int i, j, k, p = 0;
|
||||
unsigned char *dst, int dp) {
|
||||
int i, j, k, p = 0;
|
||||
|
||||
for (i = 0; i < 16; i++, dst += dp)
|
||||
{
|
||||
for (j = 0; j < 16; j++, p++)
|
||||
{
|
||||
unsigned int sum = 32768;
|
||||
for (i = 0; i < 16; i++, dst += dp) {
|
||||
for (j = 0; j < 16; j++, p++) {
|
||||
unsigned int sum = 32768;
|
||||
|
||||
for (k = 0; k < 4; k++)
|
||||
{
|
||||
tap *tp = &mt[rotation_index].pt[p].pt[k];
|
||||
sum += src[tp->y * sp + tp->x] * tp->t;
|
||||
}
|
||||
sum >>= 16;
|
||||
dst[j] = sum;
|
||||
}
|
||||
for (k = 0; k < 4; k++) {
|
||||
tap *tp = &mt[rotation_index].pt[p].pt[k];
|
||||
sum += src[tp->y * sp + tp->x] * tp->t;
|
||||
}
|
||||
sum >>= 16;
|
||||
dst[j] = sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
void predict_rotated_8x8(int rotation_index, unsigned char *src, int sp,
|
||||
unsigned char *dst, int dp)
|
||||
{
|
||||
int i, j, k, p = 0;
|
||||
unsigned char *dst, int dp) {
|
||||
int i, j, k, p = 0;
|
||||
|
||||
for (i = 0; i < 8; i++, dst += dp)
|
||||
{
|
||||
for (j = 0; j < 8; j++, p++)
|
||||
{
|
||||
unsigned int sum = 32768;
|
||||
for (i = 0; i < 8; i++, dst += dp) {
|
||||
for (j = 0; j < 8; j++, p++) {
|
||||
unsigned int sum = 32768;
|
||||
|
||||
for (k = 0; k < 4; k++)
|
||||
{
|
||||
tap *tp = &mt_8x8[rotation_index].pt[p].pt[k];
|
||||
sum += src[tp->y * sp + tp->x] * tp->t;
|
||||
}
|
||||
sum >>= 16;
|
||||
dst[j] = sum;
|
||||
}
|
||||
for (k = 0; k < 4; k++) {
|
||||
tap *tp = &mt_8x8[rotation_index].pt[p].pt[k];
|
||||
sum += src[tp->y * sp + tp->x] * tp->t;
|
||||
}
|
||||
sum >>= 16;
|
||||
dst[j] = sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -16,118 +16,110 @@ static int ac_qlookup[QINDEX_RANGE];
|
||||
|
||||
#define ACDC_MIN 4
|
||||
|
||||
void vp8_init_quant_tables()
|
||||
{
|
||||
int i;
|
||||
int current_val = 4;
|
||||
int last_val = 4;
|
||||
int ac_val;
|
||||
void vp8_init_quant_tables() {
|
||||
int i;
|
||||
int current_val = 4;
|
||||
int last_val = 4;
|
||||
int ac_val;
|
||||
|
||||
for ( i = 0; i < QINDEX_RANGE; i++ )
|
||||
{
|
||||
ac_qlookup[i] = current_val;
|
||||
current_val = (int)((double)current_val * 1.02);
|
||||
if ( current_val == last_val )
|
||||
current_val++;
|
||||
last_val = current_val;
|
||||
for (i = 0; i < QINDEX_RANGE; i++) {
|
||||
ac_qlookup[i] = current_val;
|
||||
current_val = (int)((double)current_val * 1.02);
|
||||
if (current_val == last_val)
|
||||
current_val++;
|
||||
last_val = current_val;
|
||||
|
||||
ac_val = ac_qlookup[i];
|
||||
dc_qlookup[i] = (0.000000305 * ac_val * ac_val * ac_val) +
|
||||
(-0.00065 * ac_val * ac_val) +
|
||||
(0.9 * ac_val) + 0.5;
|
||||
if ( dc_qlookup[i] < ACDC_MIN )
|
||||
dc_qlookup[i] = ACDC_MIN;
|
||||
}
|
||||
ac_val = ac_qlookup[i];
|
||||
dc_qlookup[i] = (0.000000305 * ac_val * ac_val * ac_val) +
|
||||
(-0.00065 * ac_val * ac_val) +
|
||||
(0.9 * ac_val) + 0.5;
|
||||
if (dc_qlookup[i] < ACDC_MIN)
|
||||
dc_qlookup[i] = ACDC_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
int vp8_dc_quant(int QIndex, int Delta)
|
||||
{
|
||||
int retval;
|
||||
int vp8_dc_quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
return retval;
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
return retval;
|
||||
}
|
||||
|
||||
int vp8_dc2quant(int QIndex, int Delta)
|
||||
{
|
||||
int retval;
|
||||
int vp8_dc2quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
|
||||
}
|
||||
int vp8_dc_uv_quant(int QIndex, int Delta)
|
||||
{
|
||||
int retval;
|
||||
int vp8_dc_uv_quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int vp8_ac_yquant(int QIndex)
|
||||
{
|
||||
int retval;
|
||||
int vp8_ac_yquant(int QIndex) {
|
||||
int retval;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = ac_qlookup[ QIndex ];
|
||||
return retval;
|
||||
retval = ac_qlookup[ QIndex ];
|
||||
return retval;
|
||||
}
|
||||
|
||||
int vp8_ac2quant(int QIndex, int Delta)
|
||||
{
|
||||
int retval;
|
||||
int vp8_ac2quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = (ac_qlookup[ QIndex ] * 775) / 1000;
|
||||
if (retval < 4)
|
||||
retval = 4;
|
||||
retval = (ac_qlookup[ QIndex ] * 775) / 1000;
|
||||
if (retval < 4)
|
||||
retval = 4;
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
int vp8_ac_uv_quant(int QIndex, int Delta)
|
||||
{
|
||||
int retval;
|
||||
int vp8_ac_uv_quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = ac_qlookup[ QIndex ];
|
||||
return retval;
|
||||
retval = ac_qlookup[ QIndex ];
|
||||
return retval;
|
||||
}
|
||||
|
@ -15,197 +15,180 @@
|
||||
|
||||
void vp8_recon_b_c
|
||||
(
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
)
|
||||
{
|
||||
int r, c;
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
) {
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred_ptr[c] ;
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred_ptr[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 16;
|
||||
pred_ptr += 16;
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 16;
|
||||
pred_ptr += 16;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_recon_uv_b_c
|
||||
(
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
)
|
||||
{
|
||||
int r, c;
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
) {
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred_ptr[c] ;
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred_ptr[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 8;
|
||||
pred_ptr += 8;
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 8;
|
||||
pred_ptr += 8;
|
||||
}
|
||||
}
|
||||
void vp8_recon4b_c
|
||||
(
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
)
|
||||
{
|
||||
int r, c;
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
) {
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred_ptr[c] ;
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 16; c++) {
|
||||
int a = diff_ptr[c] + pred_ptr[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 16;
|
||||
pred_ptr += 16;
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 16;
|
||||
pred_ptr += 16;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_recon2b_c
|
||||
(
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
)
|
||||
{
|
||||
int r, c;
|
||||
unsigned char *pred_ptr,
|
||||
short *diff_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int stride
|
||||
) {
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred_ptr[c] ;
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 8; c++) {
|
||||
int a = diff_ptr[c] + pred_ptr[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dst_ptr[c] = (unsigned char) a ;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 8;
|
||||
pred_ptr += 8;
|
||||
dst_ptr[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dst_ptr += stride;
|
||||
diff_ptr += 8;
|
||||
pred_ptr += 8;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_recon_mby_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
void vp8_recon_mby_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
#if ARCH_ARM
|
||||
BLOCKD *b = &x->block[0];
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
BLOCKD *b = &x->block[0];
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
|
||||
/*b = &x->block[4];*/
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
/*b = &x->block[4];*/
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
|
||||
/*b = &x->block[8];*/
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
/*b = &x->block[8];*/
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
|
||||
/*b = &x->block[12];*/
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
/*b = &x->block[12];*/
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
#else
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i += 4)
|
||||
{
|
||||
BLOCKD *b = &x->block[i];
|
||||
for (i = 0; i < 16; i += 4) {
|
||||
BLOCKD *b = &x->block[i];
|
||||
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
}
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
||||
{
|
||||
void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x) {
|
||||
#if ARCH_ARM
|
||||
BLOCKD *b = &x->block[0];
|
||||
BLOCKD *b = &x->block[0];
|
||||
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b += 4;
|
||||
|
||||
/*b = &x->block[16];*/
|
||||
/*b = &x->block[16];*/
|
||||
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b++;
|
||||
b++;
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b++;
|
||||
b++;
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b++;
|
||||
b++;
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b++;
|
||||
b++;
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b++;
|
||||
b++;
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
b++;
|
||||
b++;
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
#else
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i += 4)
|
||||
{
|
||||
BLOCKD *b = &x->block[i];
|
||||
for (i = 0; i < 16; i += 4) {
|
||||
BLOCKD *b = &x->block[i];
|
||||
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
}
|
||||
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
}
|
||||
|
||||
for (i = 16; i < 24; i += 2)
|
||||
{
|
||||
BLOCKD *b = &x->block[i];
|
||||
for (i = 16; i < 24; i += 2) {
|
||||
BLOCKD *b = &x->block[i];
|
||||
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
}
|
||||
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -15,23 +15,23 @@
|
||||
#include "blockd.h"
|
||||
|
||||
#define prototype_copy_block(sym) \
|
||||
void sym(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch)
|
||||
void sym(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch)
|
||||
|
||||
#define prototype_recon_block(sym) \
|
||||
void sym(unsigned char *pred, short *diff, unsigned char *dst, int pitch)
|
||||
void sym(unsigned char *pred, short *diff, unsigned char *dst, int pitch)
|
||||
|
||||
#define prototype_recon_macroblock(sym) \
|
||||
void sym(const struct vp8_recon_rtcd_vtable *rtcd, MACROBLOCKD *x)
|
||||
void sym(const struct vp8_recon_rtcd_vtable *rtcd, MACROBLOCKD *x)
|
||||
|
||||
#define prototype_build_intra_predictors(sym) \
|
||||
void sym(MACROBLOCKD *x)
|
||||
void sym(MACROBLOCKD *x)
|
||||
|
||||
#define prototype_intra4x4_predict(sym) \
|
||||
void sym(BLOCKD *x, int b_mode, unsigned char *predictor)
|
||||
void sym(BLOCKD *x, int b_mode, unsigned char *predictor)
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
#define prototype_comp_intra4x4_predict(sym) \
|
||||
void sym(BLOCKD *x, int b_mode, int mode2, unsigned char *predictor)
|
||||
void sym(BLOCKD *x, int b_mode, int mode2, unsigned char *predictor)
|
||||
#endif
|
||||
|
||||
struct vp8_recon_rtcd_vtable;
|
||||
@ -104,94 +104,94 @@ extern prototype_recon_macroblock(vp8_recon_recon_mby);
|
||||
#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_intra_predictors_mby);
|
||||
(vp8_recon_build_intra_predictors_mby);
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
#ifndef vp8_recon_build_comp_intra_predictors_mby
|
||||
#define vp8_recon_build_comp_intra_predictors_mby vp8_build_comp_intra_predictors_mby
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_comp_intra_predictors_mby);
|
||||
(vp8_recon_build_comp_intra_predictors_mby);
|
||||
#endif
|
||||
|
||||
#ifndef vp8_recon_build_intra8x8_predictors_mby
|
||||
#define vp8_recon_build_intra8x8_predictors_mby vp8_build_intra8x8_predictors_mby
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_intra8x8_predictors_mby);
|
||||
(vp8_recon_build_intra8x8_predictors_mby);
|
||||
|
||||
#ifndef vp8_recon_build_intra_predictors_mby_s
|
||||
#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_intra_predictors_mby_s);
|
||||
(vp8_recon_build_intra_predictors_mby_s);
|
||||
|
||||
#ifndef vp8_recon_build_intra_predictors_mbuv
|
||||
#define vp8_recon_build_intra_predictors_mbuv vp8_build_intra_predictors_mbuv
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_intra_predictors_mbuv);
|
||||
(vp8_recon_build_intra_predictors_mbuv);
|
||||
|
||||
#ifndef vp8_recon_build_intra8x8_predictors_mbuv
|
||||
#define vp8_recon_build_intra8x8_predictors_mbuv vp8_build_intra8x8_predictors_mbuv
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_intra8x8_predictors_mbuv);
|
||||
(vp8_recon_build_intra8x8_predictors_mbuv);
|
||||
|
||||
#ifndef vp8_recon_build_intra_predictors_mbuv_s
|
||||
#define vp8_recon_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_intra_predictors_mbuv_s);
|
||||
(vp8_recon_build_intra_predictors_mbuv_s);
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
#ifndef vp8_recon_build_comp_intra_predictors_mbuv
|
||||
#define vp8_recon_build_comp_intra_predictors_mbuv vp8_build_comp_intra_predictors_mbuv
|
||||
#endif
|
||||
extern prototype_build_intra_predictors\
|
||||
(vp8_recon_build_comp_intra_predictors_mbuv);
|
||||
(vp8_recon_build_comp_intra_predictors_mbuv);
|
||||
#endif
|
||||
|
||||
#ifndef vp8_recon_intra4x4_predict
|
||||
#define vp8_recon_intra4x4_predict vp8_intra4x4_predict
|
||||
#endif
|
||||
extern prototype_intra4x4_predict\
|
||||
(vp8_recon_intra4x4_predict);
|
||||
(vp8_recon_intra4x4_predict);
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
#ifndef vp8_recon_comp_intra4x4_predict
|
||||
#define vp8_recon_comp_intra4x4_predict vp8_comp_intra4x4_predict
|
||||
#endif
|
||||
extern prototype_comp_intra4x4_predict\
|
||||
(vp8_recon_comp_intra4x4_predict);
|
||||
(vp8_recon_comp_intra4x4_predict);
|
||||
#endif
|
||||
|
||||
#ifndef vp8_recon_intra8x8_predict
|
||||
#define vp8_recon_intra8x8_predict vp8_intra8x8_predict
|
||||
#endif
|
||||
extern prototype_intra4x4_predict\
|
||||
(vp8_recon_intra8x8_predict);
|
||||
(vp8_recon_intra8x8_predict);
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
#ifndef vp8_recon_comp_intra8x8_predict
|
||||
#define vp8_recon_comp_intra8x8_predict vp8_comp_intra8x8_predict
|
||||
#endif
|
||||
extern prototype_comp_intra4x4_predict\
|
||||
(vp8_recon_comp_intra8x8_predict);
|
||||
(vp8_recon_comp_intra8x8_predict);
|
||||
#endif
|
||||
|
||||
#ifndef vp8_recon_intra_uv4x4_predict
|
||||
#define vp8_recon_intra_uv4x4_predict vp8_intra_uv4x4_predict
|
||||
#endif
|
||||
extern prototype_intra4x4_predict\
|
||||
(vp8_recon_intra_uv4x4_predict);
|
||||
(vp8_recon_intra_uv4x4_predict);
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
#ifndef vp8_recon_comp_intra_uv4x4_predict
|
||||
#define vp8_recon_comp_intra_uv4x4_predict vp8_comp_intra_uv4x4_predict
|
||||
#endif
|
||||
extern prototype_comp_intra4x4_predict\
|
||||
(vp8_recon_comp_intra_uv4x4_predict);
|
||||
(vp8_recon_comp_intra_uv4x4_predict);
|
||||
#endif
|
||||
|
||||
typedef prototype_copy_block((*vp8_copy_block_fn_t));
|
||||
@ -202,40 +202,39 @@ typedef prototype_intra4x4_predict((*vp8_intra4x4_pred_fn_t));
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
typedef prototype_comp_intra4x4_predict((*vp8_comp_intra4x4_pred_fn_t));
|
||||
#endif
|
||||
typedef struct vp8_recon_rtcd_vtable
|
||||
{
|
||||
vp8_copy_block_fn_t copy16x16;
|
||||
vp8_copy_block_fn_t copy8x8;
|
||||
vp8_copy_block_fn_t avg16x16;
|
||||
vp8_copy_block_fn_t avg8x8;
|
||||
vp8_copy_block_fn_t copy8x4;
|
||||
vp8_recon_fn_t recon;
|
||||
vp8_recon_fn_t recon_uv;
|
||||
vp8_recon_fn_t recon2;
|
||||
vp8_recon_fn_t recon4;
|
||||
vp8_recon_mb_fn_t recon_mb;
|
||||
vp8_recon_mb_fn_t recon_mby;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mby_s;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mby;
|
||||
typedef struct vp8_recon_rtcd_vtable {
|
||||
vp8_copy_block_fn_t copy16x16;
|
||||
vp8_copy_block_fn_t copy8x8;
|
||||
vp8_copy_block_fn_t avg16x16;
|
||||
vp8_copy_block_fn_t avg8x8;
|
||||
vp8_copy_block_fn_t copy8x4;
|
||||
vp8_recon_fn_t recon;
|
||||
vp8_recon_fn_t recon_uv;
|
||||
vp8_recon_fn_t recon2;
|
||||
vp8_recon_fn_t recon4;
|
||||
vp8_recon_mb_fn_t recon_mb;
|
||||
vp8_recon_mb_fn_t recon_mby;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mby_s;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mby;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
vp8_build_intra_pred_fn_t build_comp_intra_predictors_mby;
|
||||
vp8_build_intra_pred_fn_t build_comp_intra_predictors_mby;
|
||||
#endif
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mbuv_s;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mbuv;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mbuv_s;
|
||||
vp8_build_intra_pred_fn_t build_intra_predictors_mbuv;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
vp8_build_intra_pred_fn_t build_comp_intra_predictors_mbuv;
|
||||
vp8_build_intra_pred_fn_t build_comp_intra_predictors_mbuv;
|
||||
#endif
|
||||
vp8_intra4x4_pred_fn_t intra4x4_predict;
|
||||
vp8_intra4x4_pred_fn_t intra4x4_predict;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
vp8_comp_intra4x4_pred_fn_t comp_intra4x4_predict;
|
||||
vp8_comp_intra4x4_pred_fn_t comp_intra4x4_predict;
|
||||
#endif
|
||||
vp8_intra4x4_pred_fn_t intra8x8_predict;
|
||||
vp8_intra4x4_pred_fn_t intra8x8_predict;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
vp8_comp_intra4x4_pred_fn_t comp_intra8x8_predict;
|
||||
vp8_comp_intra4x4_pred_fn_t comp_intra8x8_predict;
|
||||
#endif
|
||||
vp8_intra4x4_pred_fn_t intra_uv4x4_predict;
|
||||
vp8_intra4x4_pred_fn_t intra_uv4x4_predict;
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
vp8_comp_intra4x4_pred_fn_t comp_intra_uv4x4_predict;
|
||||
vp8_comp_intra4x4_pred_fn_t comp_intra_uv4x4_predict;
|
||||
#endif
|
||||
} vp8_recon_rtcd_vtable_t;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -16,322 +16,297 @@
|
||||
|
||||
void vp8_intra4x4_predict(BLOCKD *x,
|
||||
int b_mode,
|
||||
unsigned char *predictor)
|
||||
{
|
||||
int i, r, c;
|
||||
unsigned char *predictor) {
|
||||
int i, r, c;
|
||||
|
||||
unsigned char *Above = *(x->base_dst) + x->dst - x->dst_stride;
|
||||
unsigned char Left[4];
|
||||
unsigned char top_left = Above[-1];
|
||||
unsigned char *Above = *(x->base_dst) + x->dst - x->dst_stride;
|
||||
unsigned char Left[4];
|
||||
unsigned char top_left = Above[-1];
|
||||
|
||||
Left[0] = (*(x->base_dst))[x->dst - 1];
|
||||
Left[1] = (*(x->base_dst))[x->dst - 1 + x->dst_stride];
|
||||
Left[2] = (*(x->base_dst))[x->dst - 1 + 2 * x->dst_stride];
|
||||
Left[3] = (*(x->base_dst))[x->dst - 1 + 3 * x->dst_stride];
|
||||
Left[0] = (*(x->base_dst))[x->dst - 1];
|
||||
Left[1] = (*(x->base_dst))[x->dst - 1 + x->dst_stride];
|
||||
Left[2] = (*(x->base_dst))[x->dst - 1 + 2 * x->dst_stride];
|
||||
Left[3] = (*(x->base_dst))[x->dst - 1 + 3 * x->dst_stride];
|
||||
|
||||
switch (b_mode)
|
||||
{
|
||||
case B_DC_PRED:
|
||||
{
|
||||
int expected_dc = 0;
|
||||
switch (b_mode) {
|
||||
case B_DC_PRED: {
|
||||
int expected_dc = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
expected_dc += Above[i];
|
||||
expected_dc += Left[i];
|
||||
for (i = 0; i < 4; i++) {
|
||||
expected_dc += Above[i];
|
||||
expected_dc += Left[i];
|
||||
}
|
||||
|
||||
expected_dc = (expected_dc + 4) >> 3;
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
predictor[c] = expected_dc;
|
||||
}
|
||||
|
||||
expected_dc = (expected_dc + 4) >> 3;
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
predictor[c] = expected_dc;
|
||||
}
|
||||
|
||||
predictor += 16;
|
||||
}
|
||||
predictor += 16;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_TM_PRED:
|
||||
{
|
||||
/* prediction similar to true_motion prediction */
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int pred = Above[c] - top_left + Left[r];
|
||||
case B_TM_PRED: {
|
||||
/* prediction similar to true_motion prediction */
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int pred = Above[c] - top_left + Left[r];
|
||||
|
||||
if (pred < 0)
|
||||
pred = 0;
|
||||
if (pred < 0)
|
||||
pred = 0;
|
||||
|
||||
if (pred > 255)
|
||||
pred = 255;
|
||||
if (pred > 255)
|
||||
pred = 255;
|
||||
|
||||
predictor[c] = pred;
|
||||
}
|
||||
|
||||
predictor += 16;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case B_VE_PRED:
|
||||
{
|
||||
|
||||
unsigned int ap[4];
|
||||
ap[0] = Above[0];
|
||||
ap[1] = Above[1];
|
||||
ap[2] = Above[2];
|
||||
ap[3] = Above[3];
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
|
||||
predictor[c] = ap[c];
|
||||
}
|
||||
|
||||
predictor += 16;
|
||||
predictor[c] = pred;
|
||||
}
|
||||
|
||||
predictor += 16;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case B_VE_PRED: {
|
||||
|
||||
case B_HE_PRED:
|
||||
{
|
||||
unsigned int ap[4];
|
||||
ap[0] = Above[0];
|
||||
ap[1] = Above[1];
|
||||
ap[2] = Above[2];
|
||||
ap[3] = Above[3];
|
||||
|
||||
unsigned int lp[4];
|
||||
lp[0] = Left[0];
|
||||
lp[1] = Left[1];
|
||||
lp[2] = Left[2];
|
||||
lp[3] = Left[3];
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
predictor[c] = lp[r];
|
||||
}
|
||||
|
||||
predictor += 16;
|
||||
predictor[c] = ap[c];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_LD_PRED:
|
||||
{
|
||||
unsigned char *ptr = Above;
|
||||
predictor[0 * 16 + 0] = (ptr[0] + ptr[1] * 2 + ptr[2] + 2) >> 2;
|
||||
predictor[0 * 16 + 1] =
|
||||
predictor[1 * 16 + 0] = (ptr[1] + ptr[2] * 2 + ptr[3] + 2) >> 2;
|
||||
predictor[0 * 16 + 2] =
|
||||
predictor[1 * 16 + 1] =
|
||||
predictor[2 * 16 + 0] = (ptr[2] + ptr[3] * 2 + ptr[4] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] =
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[3 * 16 + 0] = (ptr[3] + ptr[4] * 2 + ptr[5] + 2) >> 2;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[3 * 16 + 1] = (ptr[4] + ptr[5] * 2 + ptr[6] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[3 * 16 + 2] = (ptr[5] + ptr[6] * 2 + ptr[7] + 2) >> 2;
|
||||
predictor[3 * 16 + 3] = (ptr[6] + ptr[7] * 2 + ptr[7] + 2) >> 2;
|
||||
|
||||
predictor += 16;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case B_RD_PRED:
|
||||
{
|
||||
|
||||
unsigned char pp[9];
|
||||
|
||||
pp[0] = Left[3];
|
||||
pp[1] = Left[2];
|
||||
pp[2] = Left[1];
|
||||
pp[3] = Left[0];
|
||||
pp[4] = top_left;
|
||||
pp[5] = Above[0];
|
||||
pp[6] = Above[1];
|
||||
pp[7] = Above[2];
|
||||
pp[8] = Above[3];
|
||||
case B_HE_PRED: {
|
||||
|
||||
predictor[3 * 16 + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[2 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[3 * 16 + 2] =
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[1 * 16 + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[3 * 16 + 3] =
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[1 * 16 + 1] =
|
||||
predictor[0 * 16 + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[0 * 16 + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[0 * 16 + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
|
||||
unsigned int lp[4];
|
||||
lp[0] = Left[0];
|
||||
lp[1] = Left[1];
|
||||
lp[2] = Left[2];
|
||||
lp[3] = Left[3];
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
predictor[c] = lp[r];
|
||||
}
|
||||
|
||||
predictor += 16;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_VR_PRED:
|
||||
{
|
||||
|
||||
unsigned char pp[9];
|
||||
|
||||
pp[0] = Left[3];
|
||||
pp[1] = Left[2];
|
||||
pp[2] = Left[1];
|
||||
pp[3] = Left[0];
|
||||
pp[4] = top_left;
|
||||
pp[5] = Above[0];
|
||||
pp[6] = Above[1];
|
||||
pp[7] = Above[2];
|
||||
pp[8] = Above[3];
|
||||
|
||||
|
||||
predictor[3 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[1 * 16 + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[0 * 16 + 0] = (pp[4] + pp[5] + 1) >> 1;
|
||||
predictor[3 * 16 + 2] =
|
||||
predictor[1 * 16 + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[0 * 16 + 1] = (pp[5] + pp[6] + 1) >> 1;
|
||||
predictor[3 * 16 + 3] =
|
||||
predictor[1 * 16 + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[0 * 16 + 2] = (pp[6] + pp[7] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] = (pp[7] + pp[8] + 1) >> 1;
|
||||
|
||||
}
|
||||
break;
|
||||
case B_VL_PRED:
|
||||
{
|
||||
|
||||
unsigned char *pp = Above;
|
||||
|
||||
predictor[0 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
|
||||
predictor[1 * 16 + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] =
|
||||
predictor[0 * 16 + 1] = (pp[1] + pp[2] + 1) >> 1;
|
||||
case B_LD_PRED: {
|
||||
unsigned char *ptr = Above;
|
||||
predictor[0 * 16 + 0] = (ptr[0] + ptr[1] * 2 + ptr[2] + 2) >> 2;
|
||||
predictor[0 * 16 + 1] =
|
||||
predictor[1 * 16 + 0] = (ptr[1] + ptr[2] * 2 + ptr[3] + 2) >> 2;
|
||||
predictor[0 * 16 + 2] =
|
||||
predictor[1 * 16 + 1] =
|
||||
predictor[3 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] = (ptr[2] + ptr[3] * 2 + ptr[4] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] =
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[3 * 16 + 0] = (ptr[3] + ptr[4] * 2 + ptr[5] + 2) >> 2;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[3 * 16 + 1] = (ptr[4] + ptr[5] * 2 + ptr[6] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[3 * 16 + 2] = (ptr[5] + ptr[6] * 2 + ptr[7] + 2) >> 2;
|
||||
predictor[3 * 16 + 3] = (ptr[6] + ptr[7] * 2 + ptr[7] + 2) >> 2;
|
||||
|
||||
}
|
||||
break;
|
||||
case B_RD_PRED: {
|
||||
|
||||
unsigned char pp[9];
|
||||
|
||||
pp[0] = Left[3];
|
||||
pp[1] = Left[2];
|
||||
pp[2] = Left[1];
|
||||
pp[3] = Left[0];
|
||||
pp[4] = top_left;
|
||||
pp[5] = Above[0];
|
||||
pp[6] = Above[1];
|
||||
pp[7] = Above[2];
|
||||
pp[8] = Above[3];
|
||||
|
||||
predictor[3 * 16 + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[2 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[3 * 16 + 2] =
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[0 * 16 + 2] = (pp[2] + pp[3] + 1) >> 1;
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[1 * 16 + 2] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] =
|
||||
predictor[2 * 16 + 2] = (pp[3] + pp[4] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[3 * 16 + 2] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[3 * 16 + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
predictor[1 * 16 + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[3 * 16 + 3] =
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[1 * 16 + 1] =
|
||||
predictor[0 * 16 + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[0 * 16 + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[0 * 16 + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
|
||||
|
||||
}
|
||||
break;
|
||||
case B_VR_PRED: {
|
||||
|
||||
unsigned char pp[9];
|
||||
|
||||
pp[0] = Left[3];
|
||||
pp[1] = Left[2];
|
||||
pp[2] = Left[1];
|
||||
pp[3] = Left[0];
|
||||
pp[4] = top_left;
|
||||
pp[5] = Above[0];
|
||||
pp[6] = Above[1];
|
||||
pp[7] = Above[2];
|
||||
pp[8] = Above[3];
|
||||
|
||||
|
||||
predictor[3 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[1 * 16 + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[0 * 16 + 0] = (pp[4] + pp[5] + 1) >> 1;
|
||||
predictor[3 * 16 + 2] =
|
||||
predictor[1 * 16 + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[0 * 16 + 1] = (pp[5] + pp[6] + 1) >> 1;
|
||||
predictor[3 * 16 + 3] =
|
||||
predictor[1 * 16 + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[0 * 16 + 2] = (pp[6] + pp[7] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] = (pp[7] + pp[8] + 1) >> 1;
|
||||
|
||||
}
|
||||
break;
|
||||
case B_VL_PRED: {
|
||||
|
||||
unsigned char *pp = Above;
|
||||
|
||||
predictor[0 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
|
||||
predictor[1 * 16 + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] =
|
||||
predictor[0 * 16 + 1] = (pp[1] + pp[2] + 1) >> 1;
|
||||
predictor[1 * 16 + 1] =
|
||||
predictor[3 * 16 + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[0 * 16 + 2] = (pp[2] + pp[3] + 1) >> 1;
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[1 * 16 + 2] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] =
|
||||
predictor[2 * 16 + 2] = (pp[3] + pp[4] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[3 * 16 + 2] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[2 * 16 + 3] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[3 * 16 + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case B_HD_PRED:
|
||||
{
|
||||
unsigned char pp[9];
|
||||
pp[0] = Left[3];
|
||||
pp[1] = Left[2];
|
||||
pp[2] = Left[1];
|
||||
pp[3] = Left[0];
|
||||
pp[4] = top_left;
|
||||
pp[5] = Above[0];
|
||||
pp[6] = Above[1];
|
||||
pp[7] = Above[2];
|
||||
pp[8] = Above[3];
|
||||
case B_HD_PRED: {
|
||||
unsigned char pp[9];
|
||||
pp[0] = Left[3];
|
||||
pp[1] = Left[2];
|
||||
pp[2] = Left[1];
|
||||
pp[3] = Left[0];
|
||||
pp[4] = top_left;
|
||||
pp[5] = Above[0];
|
||||
pp[6] = Above[1];
|
||||
pp[7] = Above[2];
|
||||
pp[8] = Above[3];
|
||||
|
||||
|
||||
predictor[3 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
|
||||
predictor[3 * 16 + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] =
|
||||
predictor[3 * 16 + 2] = (pp[1] + pp[2] + 1) >> 1;
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[3 * 16 + 3] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[1 * 16 + 0] = (pp[2] + pp[3] + 1) >> 1;
|
||||
predictor[3 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
|
||||
predictor[3 * 16 + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[2 * 16 + 0] =
|
||||
predictor[3 * 16 + 2] = (pp[1] + pp[2] + 1) >> 1;
|
||||
predictor[2 * 16 + 1] =
|
||||
predictor[3 * 16 + 3] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[1 * 16 + 0] = (pp[2] + pp[3] + 1) >> 1;
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[1 * 16 + 1] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[0 * 16 + 0] = (pp[3] + pp[4] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[0 * 16 + 1] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[0 * 16 + 2] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case B_HU_PRED: {
|
||||
unsigned char *pp = Left;
|
||||
predictor[0 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
|
||||
predictor[0 * 16 + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[0 * 16 + 2] =
|
||||
predictor[1 * 16 + 0] = (pp[1] + pp[2] + 1) >> 1;
|
||||
predictor[0 * 16 + 3] =
|
||||
predictor[1 * 16 + 1] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[2 * 16 + 0] = (pp[2] + pp[3] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[2 * 16 + 1] = (pp[2] + pp[3] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[1 * 16 + 1] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[0 * 16 + 0] = (pp[3] + pp[4] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[0 * 16 + 1] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
|
||||
predictor[0 * 16 + 2] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
|
||||
predictor[0 * 16 + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
|
||||
predictor[3 * 16 + 0] =
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[3 * 16 + 2] =
|
||||
predictor[3 * 16 + 3] = pp[3];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case B_HU_PRED:
|
||||
{
|
||||
unsigned char *pp = Left;
|
||||
predictor[0 * 16 + 0] = (pp[0] + pp[1] + 1) >> 1;
|
||||
predictor[0 * 16 + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
|
||||
predictor[0 * 16 + 2] =
|
||||
predictor[1 * 16 + 0] = (pp[1] + pp[2] + 1) >> 1;
|
||||
predictor[0 * 16 + 3] =
|
||||
predictor[1 * 16 + 1] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[1 * 16 + 2] =
|
||||
predictor[2 * 16 + 0] = (pp[2] + pp[3] + 1) >> 1;
|
||||
predictor[1 * 16 + 3] =
|
||||
predictor[2 * 16 + 1] = (pp[2] + pp[3] * 2 + pp[3] + 2) >> 2;
|
||||
predictor[2 * 16 + 2] =
|
||||
predictor[2 * 16 + 3] =
|
||||
predictor[3 * 16 + 0] =
|
||||
predictor[3 * 16 + 1] =
|
||||
predictor[3 * 16 + 2] =
|
||||
predictor[3 * 16 + 3] = pp[3];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_COMP_INTRA_PRED
|
||||
void vp8_comp_intra4x4_predict(BLOCKD *x,
|
||||
int b_mode, int b_mode2,
|
||||
unsigned char *out_predictor)
|
||||
{
|
||||
unsigned char predictor[2][4*16];
|
||||
int i, j;
|
||||
unsigned char *out_predictor) {
|
||||
unsigned char predictor[2][4 * 16];
|
||||
int i, j;
|
||||
|
||||
vp8_intra4x4_predict(x, b_mode, predictor[0]);
|
||||
vp8_intra4x4_predict(x, b_mode2, predictor[1]);
|
||||
vp8_intra4x4_predict(x, b_mode, predictor[0]);
|
||||
vp8_intra4x4_predict(x, b_mode2, predictor[1]);
|
||||
|
||||
for (i = 0; i < 16*4; i += 16)
|
||||
{
|
||||
for (j = i; j < i + 4; j++)
|
||||
{
|
||||
out_predictor[j] = (predictor[0][j] + predictor[1][j] + 1) >> 1;
|
||||
}
|
||||
for (i = 0; i < 16 * 4; i += 16) {
|
||||
for (j = i; j < i + 4; j++) {
|
||||
out_predictor[j] = (predictor[0][j] + predictor[1][j] + 1) >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* copy 4 bytes from the above right down so that the 4x4 prediction modes using pixels above and
|
||||
* to the right prediction have filled in pixels to use.
|
||||
*/
|
||||
void vp8_intra_prediction_down_copy(MACROBLOCKD *x)
|
||||
{
|
||||
unsigned char *above_right = *(x->block[0].base_dst) + x->block[0].dst - x->block[0].dst_stride + 16;
|
||||
void vp8_intra_prediction_down_copy(MACROBLOCKD *x) {
|
||||
unsigned char *above_right = *(x->block[0].base_dst) + x->block[0].dst - x->block[0].dst_stride + 16;
|
||||
|
||||
unsigned int *src_ptr = (unsigned int *)above_right;
|
||||
unsigned int *dst_ptr0 = (unsigned int *)(above_right + 4 * x->block[0].dst_stride);
|
||||
unsigned int *dst_ptr1 = (unsigned int *)(above_right + 8 * x->block[0].dst_stride);
|
||||
unsigned int *dst_ptr2 = (unsigned int *)(above_right + 12 * x->block[0].dst_stride);
|
||||
unsigned int *src_ptr = (unsigned int *)above_right;
|
||||
unsigned int *dst_ptr0 = (unsigned int *)(above_right + 4 * x->block[0].dst_stride);
|
||||
unsigned int *dst_ptr1 = (unsigned int *)(above_right + 8 * x->block[0].dst_stride);
|
||||
unsigned int *dst_ptr2 = (unsigned int *)(above_right + 12 * x->block[0].dst_stride);
|
||||
|
||||
*dst_ptr0 = *src_ptr;
|
||||
*dst_ptr1 = *src_ptr;
|
||||
*dst_ptr2 = *src_ptr;
|
||||
*dst_ptr0 = *src_ptr;
|
||||
*dst_ptr1 = *src_ptr;
|
||||
*dst_ptr2 = *src_ptr;
|
||||
}
|
||||
|
||||
|
||||
|
5654
vp8/common/rotate.h
5654
vp8/common/rotate.h
File diff suppressed because it is too large
Load Diff
5654
vp8/common/rotate2.h
5654
vp8/common/rotate2.h
File diff suppressed because it is too large
Load Diff
@ -12,156 +12,136 @@
|
||||
|
||||
const int segfeaturedata_signed[SEG_LVL_MAX] = {1, 1, 0, 0, 0, 0};
|
||||
const int vp8_seg_feature_data_bits[SEG_LVL_MAX] =
|
||||
{QINDEX_BITS, 6, 4, 4, 6, 2};
|
||||
{QINDEX_BITS, 6, 4, 4, 6, 2};
|
||||
|
||||
// These functions provide access to new segment level features.
|
||||
// Eventually these function may be "optimized out" but for the moment,
|
||||
// the coding mechanism is still subject to change so these provide a
|
||||
// convenient single point of change.
|
||||
|
||||
int segfeature_active( MACROBLOCKD *xd,
|
||||
int segfeature_active(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
// Return true if mask bit set and segmentation enabled.
|
||||
return (xd->segmentation_enabled &&
|
||||
(xd->segment_feature_mask[segment_id] &
|
||||
(0x01 << feature_id)));
|
||||
}
|
||||
|
||||
void clearall_segfeatures(MACROBLOCKD *xd) {
|
||||
vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
|
||||
vpx_memset(xd->segment_feature_mask, 0, sizeof(xd->segment_feature_mask));
|
||||
}
|
||||
|
||||
void enable_segfeature(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
// Return true if mask bit set and segmentation enabled.
|
||||
return ( xd->segmentation_enabled &&
|
||||
( xd->segment_feature_mask[segment_id] &
|
||||
(0x01 << feature_id) ) );
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
xd->segment_feature_mask[segment_id] |= (0x01 << feature_id);
|
||||
}
|
||||
|
||||
void clearall_segfeatures( MACROBLOCKD *xd )
|
||||
{
|
||||
vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
|
||||
vpx_memset(xd->segment_feature_mask, 0, sizeof(xd->segment_feature_mask));
|
||||
}
|
||||
|
||||
void enable_segfeature( MACROBLOCKD *xd,
|
||||
void disable_segfeature(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
xd->segment_feature_mask[segment_id] |= (0x01 << feature_id);
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
xd->segment_feature_mask[segment_id] &= ~(1 << feature_id);
|
||||
}
|
||||
|
||||
void disable_segfeature( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
xd->segment_feature_mask[segment_id] &= ~(1 << feature_id);
|
||||
int seg_feature_data_bits(SEG_LVL_FEATURES feature_id) {
|
||||
return vp8_seg_feature_data_bits[feature_id];
|
||||
}
|
||||
|
||||
int seg_feature_data_bits( SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
return vp8_seg_feature_data_bits[feature_id];
|
||||
int is_segfeature_signed(SEG_LVL_FEATURES feature_id) {
|
||||
return (segfeaturedata_signed[feature_id]);
|
||||
}
|
||||
|
||||
int is_segfeature_signed( SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
return ( segfeaturedata_signed[feature_id] );
|
||||
void clear_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
xd->segment_feature_data[segment_id][feature_id] = 0;
|
||||
}
|
||||
|
||||
void clear_segdata( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id)
|
||||
{
|
||||
xd->segment_feature_data[segment_id][feature_id] = 0;
|
||||
}
|
||||
|
||||
void set_segdata( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id,
|
||||
int seg_data )
|
||||
{
|
||||
xd->segment_feature_data[segment_id][feature_id] = seg_data;
|
||||
}
|
||||
|
||||
int get_segdata( MACROBLOCKD *xd,
|
||||
void set_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
return xd->segment_feature_data[segment_id][feature_id];
|
||||
SEG_LVL_FEATURES feature_id,
|
||||
int seg_data) {
|
||||
xd->segment_feature_data[segment_id][feature_id] = seg_data;
|
||||
}
|
||||
|
||||
int get_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
return xd->segment_feature_data[segment_id][feature_id];
|
||||
}
|
||||
#if CONFIG_FEATUREUPDATES
|
||||
int old_segfeature_active( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
// Return true if mask bit set and segmentation enabled.
|
||||
return ( xd->segmentation_enabled &&
|
||||
( xd->old_segment_feature_mask[segment_id] &
|
||||
(0x01 << feature_id) ) );
|
||||
int old_segfeature_active(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
// Return true if mask bit set and segmentation enabled.
|
||||
return (xd->segmentation_enabled &&
|
||||
(xd->old_segment_feature_mask[segment_id] &
|
||||
(0x01 << feature_id)));
|
||||
}
|
||||
|
||||
int get_old_segdata( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
return xd->old_segment_feature_data[segment_id][feature_id];
|
||||
int get_old_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
return xd->old_segment_feature_data[segment_id][feature_id];
|
||||
}
|
||||
|
||||
int segfeature_changed( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id )
|
||||
{
|
||||
// Return true if mask bit or data is different from last time
|
||||
return
|
||||
( xd->segmentation_enabled &&
|
||||
(
|
||||
(xd->old_segment_feature_mask[segment_id] & (1 << feature_id) ) !=
|
||||
(xd->segment_feature_mask[segment_id] & (1 << feature_id) )
|
||||
|| xd->old_segment_feature_data[segment_id][feature_id] !=
|
||||
xd->segment_feature_data[segment_id][feature_id]
|
||||
)
|
||||
);
|
||||
int segfeature_changed(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id) {
|
||||
// Return true if mask bit or data is different from last time
|
||||
return
|
||||
(xd->segmentation_enabled &&
|
||||
(
|
||||
(xd->old_segment_feature_mask[segment_id] & (1 << feature_id)) !=
|
||||
(xd->segment_feature_mask[segment_id] & (1 << feature_id))
|
||||
|| xd->old_segment_feature_data[segment_id][feature_id] !=
|
||||
xd->segment_feature_data[segment_id][feature_id]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void save_segment_info ( MACROBLOCKD *xd )
|
||||
{
|
||||
int i,j;
|
||||
for (i = 0; i < MAX_MB_SEGMENTS; i++)
|
||||
{
|
||||
xd->old_segment_feature_mask[i] = xd->segment_feature_mask[i];
|
||||
void save_segment_info(MACROBLOCKD *xd) {
|
||||
int i, j;
|
||||
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
|
||||
xd->old_segment_feature_mask[i] = xd->segment_feature_mask[i];
|
||||
|
||||
// For each segmentation codable feature...
|
||||
for (j = 0; j < SEG_LVL_MAX; j++)
|
||||
{
|
||||
xd->old_segment_feature_data[i][j]=xd->segment_feature_data[i][j];
|
||||
// For each segmentation codable feature...
|
||||
for (j = 0; j < SEG_LVL_MAX; j++) {
|
||||
xd->old_segment_feature_data[i][j] = xd->segment_feature_data[i][j];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void clear_segref( MACROBLOCKD *xd, int segment_id )
|
||||
{
|
||||
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] = 0;
|
||||
void clear_segref(MACROBLOCKD *xd, int segment_id) {
|
||||
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] = 0;
|
||||
}
|
||||
|
||||
void set_segref( MACROBLOCKD *xd,
|
||||
void set_segref(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame) {
|
||||
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] |=
|
||||
(1 << ref_frame);
|
||||
}
|
||||
|
||||
int check_segref(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame )
|
||||
{
|
||||
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] |=
|
||||
(1 << ref_frame);
|
||||
MV_REFERENCE_FRAME ref_frame) {
|
||||
return (xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] &
|
||||
(1 << ref_frame)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int check_segref( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame )
|
||||
{
|
||||
return ( xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] &
|
||||
(1 << ref_frame) ) ? 1 : 0;
|
||||
int check_segref_inter(MACROBLOCKD *xd, int segment_id) {
|
||||
return (xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] &
|
||||
~(1 << INTRA_FRAME)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int check_segref_inter(MACROBLOCKD *xd, int segment_id)
|
||||
{
|
||||
return ( xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] &
|
||||
~(1 << INTRA_FRAME) ) ? 1 : 0;
|
||||
}
|
||||
|
||||
int get_seg_tx_type(MACROBLOCKD *xd, int segment_id)
|
||||
{
|
||||
if ( segfeature_active(xd, segment_id, SEG_LVL_TRANSFORM) )
|
||||
return get_segdata(xd, segment_id, SEG_LVL_TRANSFORM);
|
||||
else
|
||||
return TX_4X4;
|
||||
int get_seg_tx_type(MACROBLOCKD *xd, int segment_id) {
|
||||
if (segfeature_active(xd, segment_id, SEG_LVL_TRANSFORM))
|
||||
return get_segdata(xd, segment_id, SEG_LVL_TRANSFORM);
|
||||
else
|
||||
return TX_4X4;
|
||||
}
|
||||
// TBD? Functions to read and write segment data with range / validity checking
|
||||
|
@ -15,67 +15,67 @@
|
||||
#ifndef __INC_SEG_COMMON_H__
|
||||
#define __INC_SEG_COMMON_H__ 1
|
||||
|
||||
int segfeature_active( MACROBLOCKD *xd,
|
||||
int segfeature_active(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
void clearall_segfeatures(MACROBLOCKD *xd);
|
||||
|
||||
void enable_segfeature(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
void clearall_segfeatures( MACROBLOCKD *xd );
|
||||
|
||||
void enable_segfeature( MACROBLOCKD *xd,
|
||||
void disable_segfeature(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
void disable_segfeature( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
int seg_feature_data_bits(SEG_LVL_FEATURES feature_id);
|
||||
|
||||
int seg_feature_data_bits( SEG_LVL_FEATURES feature_id );
|
||||
int is_segfeature_signed(SEG_LVL_FEATURES feature_id);
|
||||
|
||||
int is_segfeature_signed( SEG_LVL_FEATURES feature_id );
|
||||
void clear_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
void clear_segdata( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
void set_segdata( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id,
|
||||
int seg_data );
|
||||
|
||||
int get_segdata( MACROBLOCKD *xd,
|
||||
void set_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
SEG_LVL_FEATURES feature_id,
|
||||
int seg_data);
|
||||
|
||||
int get_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
#if CONFIG_FEATUREUPDATES
|
||||
|
||||
int old_segfeature_active( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
int old_segfeature_active(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
int get_old_segdata( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
int get_old_segdata(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
void save_segment_info ( MACROBLOCKD *xd );
|
||||
void save_segment_info(MACROBLOCKD *xd);
|
||||
|
||||
int segfeature_changed( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id );
|
||||
int segfeature_changed(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
SEG_LVL_FEATURES feature_id);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void clear_segref( MACROBLOCKD *xd, int segment_id );
|
||||
void clear_segref(MACROBLOCKD *xd, int segment_id);
|
||||
|
||||
void set_segref( MACROBLOCKD *xd,
|
||||
void set_segref(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame);
|
||||
|
||||
int check_segref(MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame );
|
||||
|
||||
int check_segref( MACROBLOCKD *xd,
|
||||
int segment_id,
|
||||
MV_REFERENCE_FRAME ref_frame );
|
||||
MV_REFERENCE_FRAME ref_frame);
|
||||
|
||||
int check_segref_inter(MACROBLOCKD *xd, int segment_id);
|
||||
|
||||
|
@ -12,21 +12,20 @@
|
||||
#include "setupintrarecon.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf)
|
||||
{
|
||||
int i;
|
||||
void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf) {
|
||||
int i;
|
||||
|
||||
/* set up frame new frame for intra coded blocks */
|
||||
vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
|
||||
for (i = 0; i < ybf->y_height; i++)
|
||||
ybf->y_buffer[ybf->y_stride *i - 1] = (unsigned char) 129;
|
||||
/* set up frame new frame for intra coded blocks */
|
||||
vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
|
||||
for (i = 0; i < ybf->y_height; i++)
|
||||
ybf->y_buffer[ybf->y_stride * i - 1] = (unsigned char) 129;
|
||||
|
||||
vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
|
||||
for (i = 0; i < ybf->uv_height; i++)
|
||||
ybf->u_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
|
||||
vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
|
||||
for (i = 0; i < ybf->uv_height; i++)
|
||||
ybf->u_buffer[ybf->uv_stride * i - 1] = (unsigned char) 129;
|
||||
|
||||
vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
|
||||
for (i = 0; i < ybf->uv_height; i++)
|
||||
ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
|
||||
vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
|
||||
for (i = 0; i < ybf->uv_height; i++)
|
||||
ybf->v_buffer[ybf->uv_stride * i - 1] = (unsigned char) 129;
|
||||
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
||||
#define SUBPIXEL_H
|
||||
|
||||
#define prototype_subpixel_predict(sym) \
|
||||
void sym(unsigned char *src, int src_pitch, int xofst, int yofst, \
|
||||
unsigned char *dst, int dst_pitch)
|
||||
void sym(unsigned char *src, int src_pitch, int xofst, int yofst, \
|
||||
unsigned char *dst, int dst_pitch)
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#include "x86/subpixel_x86.h"
|
||||
@ -166,38 +166,37 @@ extern prototype_subpixel_predict(vp8_subpix_bilinear4x4);
|
||||
extern prototype_subpixel_predict(vp8_subpix_bilinear_avg4x4);
|
||||
|
||||
typedef prototype_subpixel_predict((*vp8_subpix_fn_t));
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
#if CONFIG_ENHANCED_INTERP
|
||||
vp8_subpix_fn_t eighttap16x16;
|
||||
vp8_subpix_fn_t eighttap8x8;
|
||||
vp8_subpix_fn_t eighttap_avg16x16;
|
||||
vp8_subpix_fn_t eighttap_avg8x8;
|
||||
vp8_subpix_fn_t eighttap_avg4x4;
|
||||
vp8_subpix_fn_t eighttap8x4;
|
||||
vp8_subpix_fn_t eighttap4x4;
|
||||
vp8_subpix_fn_t eighttap16x16_sharp;
|
||||
vp8_subpix_fn_t eighttap8x8_sharp;
|
||||
vp8_subpix_fn_t eighttap_avg16x16_sharp;
|
||||
vp8_subpix_fn_t eighttap_avg8x8_sharp;
|
||||
vp8_subpix_fn_t eighttap_avg4x4_sharp;
|
||||
vp8_subpix_fn_t eighttap8x4_sharp;
|
||||
vp8_subpix_fn_t eighttap4x4_sharp;
|
||||
vp8_subpix_fn_t eighttap16x16;
|
||||
vp8_subpix_fn_t eighttap8x8;
|
||||
vp8_subpix_fn_t eighttap_avg16x16;
|
||||
vp8_subpix_fn_t eighttap_avg8x8;
|
||||
vp8_subpix_fn_t eighttap_avg4x4;
|
||||
vp8_subpix_fn_t eighttap8x4;
|
||||
vp8_subpix_fn_t eighttap4x4;
|
||||
vp8_subpix_fn_t eighttap16x16_sharp;
|
||||
vp8_subpix_fn_t eighttap8x8_sharp;
|
||||
vp8_subpix_fn_t eighttap_avg16x16_sharp;
|
||||
vp8_subpix_fn_t eighttap_avg8x8_sharp;
|
||||
vp8_subpix_fn_t eighttap_avg4x4_sharp;
|
||||
vp8_subpix_fn_t eighttap8x4_sharp;
|
||||
vp8_subpix_fn_t eighttap4x4_sharp;
|
||||
#endif
|
||||
vp8_subpix_fn_t sixtap16x16;
|
||||
vp8_subpix_fn_t sixtap8x8;
|
||||
vp8_subpix_fn_t sixtap_avg16x16;
|
||||
vp8_subpix_fn_t sixtap_avg8x8;
|
||||
vp8_subpix_fn_t sixtap8x4;
|
||||
vp8_subpix_fn_t sixtap4x4;
|
||||
vp8_subpix_fn_t sixtap_avg4x4;
|
||||
vp8_subpix_fn_t bilinear16x16;
|
||||
vp8_subpix_fn_t bilinear8x8;
|
||||
vp8_subpix_fn_t bilinear_avg16x16;
|
||||
vp8_subpix_fn_t bilinear_avg8x8;
|
||||
vp8_subpix_fn_t bilinear8x4;
|
||||
vp8_subpix_fn_t bilinear4x4;
|
||||
vp8_subpix_fn_t bilinear_avg4x4;
|
||||
vp8_subpix_fn_t sixtap16x16;
|
||||
vp8_subpix_fn_t sixtap8x8;
|
||||
vp8_subpix_fn_t sixtap_avg16x16;
|
||||
vp8_subpix_fn_t sixtap_avg8x8;
|
||||
vp8_subpix_fn_t sixtap8x4;
|
||||
vp8_subpix_fn_t sixtap4x4;
|
||||
vp8_subpix_fn_t sixtap_avg4x4;
|
||||
vp8_subpix_fn_t bilinear16x16;
|
||||
vp8_subpix_fn_t bilinear8x8;
|
||||
vp8_subpix_fn_t bilinear_avg16x16;
|
||||
vp8_subpix_fn_t bilinear_avg8x8;
|
||||
vp8_subpix_fn_t bilinear8x4;
|
||||
vp8_subpix_fn_t bilinear4x4;
|
||||
vp8_subpix_fn_t bilinear_avg4x4;
|
||||
} vp8_subpix_rtcd_vtable_t;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
|
@ -11,24 +11,23 @@
|
||||
|
||||
#include "swapyv12buffer.h"
|
||||
|
||||
void vp8_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame, YV12_BUFFER_CONFIG *last_frame)
|
||||
{
|
||||
unsigned char *temp;
|
||||
void vp8_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame, YV12_BUFFER_CONFIG *last_frame) {
|
||||
unsigned char *temp;
|
||||
|
||||
temp = last_frame->buffer_alloc;
|
||||
last_frame->buffer_alloc = new_frame->buffer_alloc;
|
||||
new_frame->buffer_alloc = temp;
|
||||
temp = last_frame->buffer_alloc;
|
||||
last_frame->buffer_alloc = new_frame->buffer_alloc;
|
||||
new_frame->buffer_alloc = temp;
|
||||
|
||||
temp = last_frame->y_buffer;
|
||||
last_frame->y_buffer = new_frame->y_buffer;
|
||||
new_frame->y_buffer = temp;
|
||||
temp = last_frame->y_buffer;
|
||||
last_frame->y_buffer = new_frame->y_buffer;
|
||||
new_frame->y_buffer = temp;
|
||||
|
||||
temp = last_frame->u_buffer;
|
||||
last_frame->u_buffer = new_frame->u_buffer;
|
||||
new_frame->u_buffer = temp;
|
||||
temp = last_frame->u_buffer;
|
||||
last_frame->u_buffer = new_frame->u_buffer;
|
||||
new_frame->u_buffer = temp;
|
||||
|
||||
temp = last_frame->v_buffer;
|
||||
last_frame->v_buffer = new_frame->v_buffer;
|
||||
new_frame->v_buffer = temp;
|
||||
temp = last_frame->v_buffer;
|
||||
last_frame->v_buffer = new_frame->v_buffer;
|
||||
new_frame->v_buffer = temp;
|
||||
|
||||
}
|
||||
|
@ -11,120 +11,106 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
void vp8_blit_text(const char *msg, unsigned char *address, const int pitch)
|
||||
{
|
||||
int letter_bitmap;
|
||||
unsigned char *output_pos = address;
|
||||
int colpos;
|
||||
const int font[] =
|
||||
{
|
||||
0x0, 0x5C00, 0x8020, 0xAFABEA, 0xD7EC0, 0x1111111, 0x1855740, 0x18000,
|
||||
0x45C0, 0x74400, 0x51140, 0x23880, 0xC4000, 0x21080, 0x80000, 0x111110,
|
||||
0xE9D72E, 0x87E40, 0x12AD732, 0xAAD62A, 0x4F94C4, 0x4D6B7, 0x456AA,
|
||||
0x3E8423, 0xAAD6AA, 0xAAD6A2, 0x2800, 0x2A00, 0x8A880, 0x52940, 0x22A20,
|
||||
0x15422, 0x6AD62E, 0x1E4A53E, 0xAAD6BF, 0x8C62E, 0xE8C63F, 0x118D6BF,
|
||||
0x1094BF, 0xCAC62E, 0x1F2109F, 0x118FE31, 0xF8C628, 0x8A89F, 0x108421F,
|
||||
0x1F1105F, 0x1F4105F, 0xE8C62E, 0x2294BF, 0x164C62E, 0x12694BF, 0x8AD6A2,
|
||||
0x10FC21, 0x1F8421F, 0x744107, 0xF8220F, 0x1151151, 0x117041, 0x119D731,
|
||||
0x47E0, 0x1041041, 0xFC400, 0x10440, 0x1084210, 0x820
|
||||
};
|
||||
colpos = 0;
|
||||
void vp8_blit_text(const char *msg, unsigned char *address, const int pitch) {
|
||||
int letter_bitmap;
|
||||
unsigned char *output_pos = address;
|
||||
int colpos;
|
||||
const int font[] = {
|
||||
0x0, 0x5C00, 0x8020, 0xAFABEA, 0xD7EC0, 0x1111111, 0x1855740, 0x18000,
|
||||
0x45C0, 0x74400, 0x51140, 0x23880, 0xC4000, 0x21080, 0x80000, 0x111110,
|
||||
0xE9D72E, 0x87E40, 0x12AD732, 0xAAD62A, 0x4F94C4, 0x4D6B7, 0x456AA,
|
||||
0x3E8423, 0xAAD6AA, 0xAAD6A2, 0x2800, 0x2A00, 0x8A880, 0x52940, 0x22A20,
|
||||
0x15422, 0x6AD62E, 0x1E4A53E, 0xAAD6BF, 0x8C62E, 0xE8C63F, 0x118D6BF,
|
||||
0x1094BF, 0xCAC62E, 0x1F2109F, 0x118FE31, 0xF8C628, 0x8A89F, 0x108421F,
|
||||
0x1F1105F, 0x1F4105F, 0xE8C62E, 0x2294BF, 0x164C62E, 0x12694BF, 0x8AD6A2,
|
||||
0x10FC21, 0x1F8421F, 0x744107, 0xF8220F, 0x1151151, 0x117041, 0x119D731,
|
||||
0x47E0, 0x1041041, 0xFC400, 0x10440, 0x1084210, 0x820
|
||||
};
|
||||
colpos = 0;
|
||||
|
||||
while (msg[colpos] != 0)
|
||||
{
|
||||
char letter = msg[colpos];
|
||||
int fontcol, fontrow;
|
||||
while (msg[colpos] != 0) {
|
||||
char letter = msg[colpos];
|
||||
int fontcol, fontrow;
|
||||
|
||||
if (letter <= 'Z' && letter >= ' ')
|
||||
letter_bitmap = font[letter-' '];
|
||||
else if (letter <= 'z' && letter >= 'a')
|
||||
letter_bitmap = font[letter-'a'+'A' - ' '];
|
||||
else
|
||||
letter_bitmap = font[0];
|
||||
if (letter <= 'Z' && letter >= ' ')
|
||||
letter_bitmap = font[letter - ' '];
|
||||
else if (letter <= 'z' && letter >= 'a')
|
||||
letter_bitmap = font[letter - 'a' + 'A' - ' '];
|
||||
else
|
||||
letter_bitmap = font[0];
|
||||
|
||||
for (fontcol = 6; fontcol >= 0 ; fontcol--)
|
||||
for (fontrow = 0; fontrow < 5; fontrow++)
|
||||
output_pos[fontrow *pitch + fontcol] =
|
||||
((letter_bitmap >> (fontcol * 5)) & (1 << fontrow) ? 255 : 0);
|
||||
for (fontcol = 6; fontcol >= 0; fontcol--)
|
||||
for (fontrow = 0; fontrow < 5; fontrow++)
|
||||
output_pos[fontrow * pitch + fontcol] =
|
||||
((letter_bitmap >> (fontcol * 5)) & (1 << fontrow) ? 255 : 0);
|
||||
|
||||
output_pos += 7;
|
||||
colpos++;
|
||||
}
|
||||
output_pos += 7;
|
||||
colpos++;
|
||||
}
|
||||
}
|
||||
|
||||
static void plot (const int x, const int y, unsigned char *image, const int pitch)
|
||||
{
|
||||
image [x+y*pitch] ^= 255;
|
||||
static void plot(const int x, const int y, unsigned char *image, const int pitch) {
|
||||
image [x + y * pitch] ^= 255;
|
||||
}
|
||||
|
||||
/* Bresenham line algorithm */
|
||||
void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch)
|
||||
{
|
||||
int steep = abs(y1 - y0) > abs(x1 - x0);
|
||||
int deltax, deltay;
|
||||
int error, ystep, y, x;
|
||||
void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch) {
|
||||
int steep = abs(y1 - y0) > abs(x1 - x0);
|
||||
int deltax, deltay;
|
||||
int error, ystep, y, x;
|
||||
|
||||
if (steep)
|
||||
{
|
||||
int t;
|
||||
t = x0;
|
||||
x0 = y0;
|
||||
y0 = t;
|
||||
if (steep) {
|
||||
int t;
|
||||
t = x0;
|
||||
x0 = y0;
|
||||
y0 = t;
|
||||
|
||||
t = x1;
|
||||
x1 = y1;
|
||||
y1 = t;
|
||||
t = x1;
|
||||
x1 = y1;
|
||||
y1 = t;
|
||||
}
|
||||
|
||||
if (x0 > x1) {
|
||||
int t;
|
||||
t = x0;
|
||||
x0 = x1;
|
||||
x1 = t;
|
||||
|
||||
t = y0;
|
||||
y0 = y1;
|
||||
y1 = t;
|
||||
}
|
||||
|
||||
deltax = x1 - x0;
|
||||
deltay = abs(y1 - y0);
|
||||
error = deltax / 2;
|
||||
|
||||
y = y0;
|
||||
|
||||
if (y0 < y1)
|
||||
ystep = 1;
|
||||
else
|
||||
ystep = -1;
|
||||
|
||||
if (steep) {
|
||||
for (x = x0; x <= x1; x++) {
|
||||
plot(y, x, image, pitch);
|
||||
|
||||
error = error - deltay;
|
||||
if (error < 0) {
|
||||
y = y + ystep;
|
||||
error = error + deltax;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (x = x0; x <= x1; x++) {
|
||||
plot(x, y, image, pitch);
|
||||
|
||||
if (x0 > x1)
|
||||
{
|
||||
int t;
|
||||
t = x0;
|
||||
x0 = x1;
|
||||
x1 = t;
|
||||
|
||||
t = y0;
|
||||
y0 = y1;
|
||||
y1 = t;
|
||||
}
|
||||
|
||||
deltax = x1 - x0;
|
||||
deltay = abs(y1 - y0);
|
||||
error = deltax / 2;
|
||||
|
||||
y = y0;
|
||||
|
||||
if (y0 < y1)
|
||||
ystep = 1;
|
||||
else
|
||||
ystep = -1;
|
||||
|
||||
if (steep)
|
||||
{
|
||||
for (x = x0; x <= x1; x++)
|
||||
{
|
||||
plot(y,x, image, pitch);
|
||||
|
||||
error = error - deltay;
|
||||
if (error < 0)
|
||||
{
|
||||
y = y + ystep;
|
||||
error = error + deltax;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (x = x0; x <= x1; x++)
|
||||
{
|
||||
plot(x,y, image, pitch);
|
||||
|
||||
error = error - deltay;
|
||||
if (error < 0)
|
||||
{
|
||||
y = y + ystep;
|
||||
error = error + deltax;
|
||||
}
|
||||
}
|
||||
error = error - deltay;
|
||||
if (error < 0) {
|
||||
y = y + ystep;
|
||||
error = error + deltax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,127 +17,108 @@
|
||||
#include "treecoder.h"
|
||||
|
||||
static void tree2tok(
|
||||
struct vp8_token_struct *const p,
|
||||
vp8_tree t,
|
||||
int i,
|
||||
int v,
|
||||
int L
|
||||
)
|
||||
{
|
||||
v += v;
|
||||
++L;
|
||||
struct vp8_token_struct *const p,
|
||||
vp8_tree t,
|
||||
int i,
|
||||
int v,
|
||||
int L
|
||||
) {
|
||||
v += v;
|
||||
++L;
|
||||
|
||||
do
|
||||
{
|
||||
const vp8_tree_index j = t[i++];
|
||||
do {
|
||||
const vp8_tree_index j = t[i++];
|
||||
|
||||
if (j <= 0)
|
||||
{
|
||||
p[-j].value = v;
|
||||
p[-j].Len = L;
|
||||
}
|
||||
else
|
||||
tree2tok(p, t, j, v, L);
|
||||
}
|
||||
while (++v & 1);
|
||||
if (j <= 0) {
|
||||
p[-j].value = v;
|
||||
p[-j].Len = L;
|
||||
} else
|
||||
tree2tok(p, t, j, v, L);
|
||||
} while (++v & 1);
|
||||
}
|
||||
|
||||
void vp8_tokens_from_tree(struct vp8_token_struct *p, vp8_tree t)
|
||||
{
|
||||
tree2tok(p, t, 0, 0, 0);
|
||||
void vp8_tokens_from_tree(struct vp8_token_struct *p, vp8_tree t) {
|
||||
tree2tok(p, t, 0, 0, 0);
|
||||
}
|
||||
|
||||
void vp8_tokens_from_tree_offset(struct vp8_token_struct *p, vp8_tree t,
|
||||
int offset)
|
||||
{
|
||||
tree2tok(p - offset, t, 0, 0, 0);
|
||||
int offset) {
|
||||
tree2tok(p - offset, t, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void branch_counts(
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ]
|
||||
)
|
||||
{
|
||||
const int tree_len = n - 1;
|
||||
int t = 0;
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ]
|
||||
) {
|
||||
const int tree_len = n - 1;
|
||||
int t = 0;
|
||||
|
||||
#if CONFIG_DEBUG
|
||||
assert(tree_len);
|
||||
assert(tree_len);
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
branch_ct[t][0] = branch_ct[t][1] = 0;
|
||||
}
|
||||
while (++t < tree_len);
|
||||
do {
|
||||
branch_ct[t][0] = branch_ct[t][1] = 0;
|
||||
} while (++t < tree_len);
|
||||
|
||||
t = 0;
|
||||
t = 0;
|
||||
|
||||
do
|
||||
{
|
||||
int L = tok[t].Len;
|
||||
const int enc = tok[t].value;
|
||||
const unsigned int ct = num_events[t];
|
||||
do {
|
||||
int L = tok[t].Len;
|
||||
const int enc = tok[t].value;
|
||||
const unsigned int ct = num_events[t];
|
||||
|
||||
vp8_tree_index i = 0;
|
||||
vp8_tree_index i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
const int b = (enc >> --L) & 1;
|
||||
const int j = i >> 1;
|
||||
do {
|
||||
const int b = (enc >> --L) & 1;
|
||||
const int j = i >> 1;
|
||||
#if CONFIG_DEBUG
|
||||
assert(j < tree_len && 0 <= L);
|
||||
assert(j < tree_len && 0 <= L);
|
||||
#endif
|
||||
|
||||
branch_ct [j] [b] += ct;
|
||||
i = tree[ i + b];
|
||||
}
|
||||
while (i > 0);
|
||||
branch_ct [j] [b] += ct;
|
||||
i = tree[ i + b];
|
||||
} while (i > 0);
|
||||
|
||||
#if CONFIG_DEBUG
|
||||
assert(!L);
|
||||
assert(!L);
|
||||
#endif
|
||||
}
|
||||
while (++t < n);
|
||||
} while (++t < n);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_tree_probs_from_distribution(
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
vp8_prob probs [ /* n-1 */ ],
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ],
|
||||
unsigned int Pfac,
|
||||
int rd
|
||||
)
|
||||
{
|
||||
const int tree_len = n - 1;
|
||||
int t = 0;
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
vp8_prob probs [ /* n-1 */ ],
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ],
|
||||
unsigned int Pfac,
|
||||
int rd
|
||||
) {
|
||||
const int tree_len = n - 1;
|
||||
int t = 0;
|
||||
|
||||
branch_counts(n, tok, tree, branch_ct, num_events);
|
||||
branch_counts(n, tok, tree, branch_ct, num_events);
|
||||
|
||||
do
|
||||
{
|
||||
const unsigned int *const c = branch_ct[t];
|
||||
const unsigned int tot = c[0] + c[1];
|
||||
do {
|
||||
const unsigned int *const c = branch_ct[t];
|
||||
const unsigned int tot = c[0] + c[1];
|
||||
|
||||
#if CONFIG_DEBUG
|
||||
assert(tot < (1 << 24)); /* no overflow below */
|
||||
assert(tot < (1 << 24)); /* no overflow below */
|
||||
#endif
|
||||
|
||||
if (tot)
|
||||
{
|
||||
const unsigned int p = ((c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
|
||||
probs[t] = p < 256 ? (p ? p : 1) : 255; /* agree w/old version for now */
|
||||
}
|
||||
else
|
||||
probs[t] = vp8_prob_half;
|
||||
}
|
||||
while (++t < tree_len);
|
||||
if (tot) {
|
||||
const unsigned int p = ((c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
|
||||
probs[t] = p < 256 ? (p ? p : 1) : 255; /* agree w/old version for now */
|
||||
} else
|
||||
probs[t] = vp8_prob_half;
|
||||
} while (++t < tree_len);
|
||||
}
|
||||
|
@ -45,10 +45,9 @@ typedef const bool_reader c_bool_reader;
|
||||
typedef const vp8_tree_index vp8_tree[], *vp8_tree_p;
|
||||
|
||||
|
||||
typedef const struct vp8_token_struct
|
||||
{
|
||||
int value;
|
||||
int Len;
|
||||
typedef const struct vp8_token_struct {
|
||||
int value;
|
||||
int Len;
|
||||
} vp8_token;
|
||||
|
||||
/* Construct encoding array from tree. */
|
||||
@ -64,26 +63,26 @@ void vp8_tokens_from_tree_offset(struct vp8_token_struct *, vp8_tree,
|
||||
probability updates. */
|
||||
|
||||
void vp8_tree_probs_from_distribution(
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
vp8_prob probs [ /* n-1 */ ],
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ],
|
||||
unsigned int Pfactor,
|
||||
int Round
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
vp8_prob probs [ /* n-1 */ ],
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ],
|
||||
unsigned int Pfactor,
|
||||
int Round
|
||||
);
|
||||
|
||||
/* Variant of above using coder spec rather than hardwired 8-bit probs. */
|
||||
|
||||
void vp8bc_tree_probs_from_distribution(
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
vp8_prob probs [ /* n-1 */ ],
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ],
|
||||
c_bool_coder_spec *s
|
||||
int n, /* n = size of alphabet */
|
||||
vp8_token tok [ /* n */ ],
|
||||
vp8_tree tree,
|
||||
vp8_prob probs [ /* n-1 */ ],
|
||||
unsigned int branch_ct [ /* n-1 */ ] [2],
|
||||
const unsigned int num_events[ /* n */ ],
|
||||
c_bool_coder_spec *s
|
||||
);
|
||||
|
||||
|
||||
|
@ -30,77 +30,71 @@ extern loop_filter_uvfunction vp8_mbloop_filter_vertical_edge_uv_sse2;
|
||||
#if HAVE_MMX
|
||||
/* Horizontal MB filtering */
|
||||
void vp8_loop_filter_mbh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_mbloop_filter_horizontal_edge_mmx(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_mbloop_filter_horizontal_edge_mmx(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_mmx(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_mmx(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_mmx(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_mmx(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical MB Filtering */
|
||||
void vp8_loop_filter_mbv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_mbloop_filter_vertical_edge_mmx(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_mbloop_filter_vertical_edge_mmx(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_mmx(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_mmx(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_mmx(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_mmx(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
|
||||
/* Horizontal B Filtering */
|
||||
void vp8_loop_filter_bh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_loop_filter_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_loop_filter_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_mmx(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_mmx(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_horizontal_edge_mmx(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_horizontal_edge_mmx(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
|
||||
void vp8_loop_filter_bhs_mmx(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
|
||||
{
|
||||
vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, blimit);
|
||||
void vp8_loop_filter_bhs_mmx(unsigned char *y_ptr, int y_stride, const unsigned char *blimit) {
|
||||
vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, blimit);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical B Filtering */
|
||||
void vp8_loop_filter_bv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_loop_filter_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_loop_filter_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_mmx(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_mmx(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_vertical_edge_mmx(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
if (v_ptr)
|
||||
vp8_loop_filter_vertical_edge_mmx(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
|
||||
}
|
||||
|
||||
|
||||
void vp8_loop_filter_bvs_mmx(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
|
||||
{
|
||||
vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 4, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 8, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 12, y_stride, blimit);
|
||||
void vp8_loop_filter_bvs_mmx(unsigned char *y_ptr, int y_stride, const unsigned char *blimit) {
|
||||
vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 4, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 8, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 12, y_stride, blimit);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -108,65 +102,59 @@ void vp8_loop_filter_bvs_mmx(unsigned char *y_ptr, int y_stride, const unsigned
|
||||
/* Horizontal MB filtering */
|
||||
#if HAVE_SSE2
|
||||
void vp8_loop_filter_mbh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_mbloop_filter_horizontal_edge_sse2(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_mbloop_filter_horizontal_edge_sse2(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_uv_sse2(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, v_ptr);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_horizontal_edge_uv_sse2(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, v_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical MB Filtering */
|
||||
void vp8_loop_filter_mbv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_mbloop_filter_vertical_edge_sse2(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_mbloop_filter_vertical_edge_sse2(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_uv_sse2(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, v_ptr);
|
||||
if (u_ptr)
|
||||
vp8_mbloop_filter_vertical_edge_uv_sse2(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, v_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Horizontal B Filtering */
|
||||
void vp8_loop_filter_bh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_loop_filter_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_loop_filter_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_uv_sse2(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, v_ptr + 4 * uv_stride);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_horizontal_edge_uv_sse2(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, v_ptr + 4 * uv_stride);
|
||||
}
|
||||
|
||||
|
||||
void vp8_loop_filter_bhs_sse2(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
|
||||
{
|
||||
vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, blimit);
|
||||
void vp8_loop_filter_bhs_sse2(unsigned char *y_ptr, int y_stride, const unsigned char *blimit) {
|
||||
vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, blimit);
|
||||
vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, blimit);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical B Filtering */
|
||||
void vp8_loop_filter_bv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
{
|
||||
vp8_loop_filter_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi) {
|
||||
vp8_loop_filter_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
vp8_loop_filter_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
|
||||
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_uv_sse2(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, v_ptr + 4);
|
||||
if (u_ptr)
|
||||
vp8_loop_filter_vertical_edge_uv_sse2(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, v_ptr + 4);
|
||||
}
|
||||
|
||||
|
||||
void vp8_loop_filter_bvs_sse2(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
|
||||
{
|
||||
vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, blimit);
|
||||
void vp8_loop_filter_bvs_sse2(unsigned char *y_ptr, int y_stride, const unsigned char *blimit) {
|
||||
vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, blimit);
|
||||
vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, blimit);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
#define build_intra_predictors_mbuv_prototype(sym) \
|
||||
void sym(unsigned char *dst, int dst_stride, \
|
||||
const unsigned char *src, int src_stride)
|
||||
void sym(unsigned char *dst, int dst_stride, \
|
||||
const unsigned char *src, int src_stride)
|
||||
typedef build_intra_predictors_mbuv_prototype((*build_intra_predictors_mbuv_fn_t));
|
||||
|
||||
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc_mmx2);
|
||||
@ -33,64 +33,70 @@ static void vp8_build_intra_predictors_mbuv_x86(MACROBLOCKD *x,
|
||||
unsigned char *dst_v,
|
||||
int dst_stride,
|
||||
build_intra_predictors_mbuv_fn_t tm_func,
|
||||
build_intra_predictors_mbuv_fn_t ho_func)
|
||||
{
|
||||
int mode = x->mode_info_context->mbmi.uv_mode;
|
||||
build_intra_predictors_mbuv_fn_t fn;
|
||||
int src_stride = x->dst.uv_stride;
|
||||
build_intra_predictors_mbuv_fn_t ho_func) {
|
||||
int mode = x->mode_info_context->mbmi.uv_mode;
|
||||
build_intra_predictors_mbuv_fn_t fn;
|
||||
int src_stride = x->dst.uv_stride;
|
||||
|
||||
switch (mode) {
|
||||
case V_PRED: fn = vp8_intra_pred_uv_ve_mmx; break;
|
||||
case H_PRED: fn = ho_func; break;
|
||||
case TM_PRED: fn = tm_func; break;
|
||||
case DC_PRED:
|
||||
if (x->up_available) {
|
||||
if (x->left_available) {
|
||||
fn = vp8_intra_pred_uv_dc_mmx2; break;
|
||||
} else {
|
||||
fn = vp8_intra_pred_uv_dctop_mmx2; break;
|
||||
}
|
||||
} else if (x->left_available) {
|
||||
fn = vp8_intra_pred_uv_dcleft_mmx2; break;
|
||||
} else {
|
||||
fn = vp8_intra_pred_uv_dc128_mmx; break;
|
||||
}
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
switch (mode) {
|
||||
case V_PRED:
|
||||
fn = vp8_intra_pred_uv_ve_mmx;
|
||||
break;
|
||||
case H_PRED:
|
||||
fn = ho_func;
|
||||
break;
|
||||
case TM_PRED:
|
||||
fn = tm_func;
|
||||
break;
|
||||
case DC_PRED:
|
||||
if (x->up_available) {
|
||||
if (x->left_available) {
|
||||
fn = vp8_intra_pred_uv_dc_mmx2;
|
||||
break;
|
||||
} else {
|
||||
fn = vp8_intra_pred_uv_dctop_mmx2;
|
||||
break;
|
||||
}
|
||||
} else if (x->left_available) {
|
||||
fn = vp8_intra_pred_uv_dcleft_mmx2;
|
||||
break;
|
||||
} else {
|
||||
fn = vp8_intra_pred_uv_dc128_mmx;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
fn(dst_u, dst_stride, x->dst.u_buffer, src_stride);
|
||||
fn(dst_v, dst_stride, x->dst.v_buffer, src_stride);
|
||||
fn(dst_u, dst_stride, x->dst.u_buffer, src_stride);
|
||||
fn(dst_v, dst_stride, x->dst.v_buffer, src_stride);
|
||||
}
|
||||
|
||||
void vp8_build_intra_predictors_mbuv_sse2(MACROBLOCKD *x)
|
||||
{
|
||||
vp8_build_intra_predictors_mbuv_x86(x, &x->predictor[256],
|
||||
&x->predictor[320], 8,
|
||||
vp8_intra_pred_uv_tm_sse2,
|
||||
vp8_intra_pred_uv_ho_mmx2);
|
||||
void vp8_build_intra_predictors_mbuv_sse2(MACROBLOCKD *x) {
|
||||
vp8_build_intra_predictors_mbuv_x86(x, &x->predictor[256],
|
||||
&x->predictor[320], 8,
|
||||
vp8_intra_pred_uv_tm_sse2,
|
||||
vp8_intra_pred_uv_ho_mmx2);
|
||||
}
|
||||
|
||||
void vp8_build_intra_predictors_mbuv_ssse3(MACROBLOCKD *x)
|
||||
{
|
||||
vp8_build_intra_predictors_mbuv_x86(x, &x->predictor[256],
|
||||
&x->predictor[320], 8,
|
||||
vp8_intra_pred_uv_tm_ssse3,
|
||||
vp8_intra_pred_uv_ho_ssse3);
|
||||
void vp8_build_intra_predictors_mbuv_ssse3(MACROBLOCKD *x) {
|
||||
vp8_build_intra_predictors_mbuv_x86(x, &x->predictor[256],
|
||||
&x->predictor[320], 8,
|
||||
vp8_intra_pred_uv_tm_ssse3,
|
||||
vp8_intra_pred_uv_ho_ssse3);
|
||||
}
|
||||
|
||||
void vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *x)
|
||||
{
|
||||
vp8_build_intra_predictors_mbuv_x86(x, x->dst.u_buffer,
|
||||
x->dst.v_buffer, x->dst.uv_stride,
|
||||
vp8_intra_pred_uv_tm_sse2,
|
||||
vp8_intra_pred_uv_ho_mmx2);
|
||||
void vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *x) {
|
||||
vp8_build_intra_predictors_mbuv_x86(x, x->dst.u_buffer,
|
||||
x->dst.v_buffer, x->dst.uv_stride,
|
||||
vp8_intra_pred_uv_tm_sse2,
|
||||
vp8_intra_pred_uv_ho_mmx2);
|
||||
}
|
||||
|
||||
void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x)
|
||||
{
|
||||
vp8_build_intra_predictors_mbuv_x86(x, x->dst.u_buffer,
|
||||
x->dst.v_buffer, x->dst.uv_stride,
|
||||
vp8_intra_pred_uv_tm_ssse3,
|
||||
vp8_intra_pred_uv_ho_ssse3);
|
||||
void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x) {
|
||||
vp8_build_intra_predictors_mbuv_x86(x, x->dst.u_buffer,
|
||||
x->dst.v_buffer, x->dst.uv_stride,
|
||||
vp8_intra_pred_uv_tm_ssse3,
|
||||
vp8_intra_pred_uv_ho_ssse3);
|
||||
}
|
||||
|
@ -14,112 +14,112 @@
|
||||
#include "vp8/common/subpixel.h"
|
||||
|
||||
#if CONFIG_SIXTEENTH_SUBPEL_UV
|
||||
extern const short vp8_six_tap_mmx[16][6*8];
|
||||
extern const short vp8_bilinear_filters_mmx[16][2*8];
|
||||
extern const short vp8_six_tap_mmx[16][6 * 8];
|
||||
extern const short vp8_bilinear_filters_mmx[16][2 * 8];
|
||||
#else
|
||||
extern const short vp8_six_tap_mmx[8][6*8];
|
||||
extern const short vp8_bilinear_filters_mmx[8][2*8];
|
||||
extern const short vp8_six_tap_mmx[8][6 * 8];
|
||||
extern const short vp8_bilinear_filters_mmx[8][2 * 8];
|
||||
#endif
|
||||
|
||||
//#define ANNOUNCE_FUNCTION
|
||||
// #define ANNOUNCE_FUNCTION
|
||||
|
||||
extern void vp8_filter_block1d_h6_mmx
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1dc_v6_mmx
|
||||
(
|
||||
unsigned short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
int output_pitch,
|
||||
unsigned int pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
unsigned short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
int output_pitch,
|
||||
unsigned int pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1d8_h6_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1d16_h6_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1d8_v6_sse2
|
||||
(
|
||||
unsigned short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
unsigned short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1d16_v6_sse2
|
||||
(
|
||||
unsigned short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
unsigned short *src_ptr,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int pixels_per_line,
|
||||
unsigned int pixel_step,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_unpack_block1d16_h6_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width
|
||||
unsigned char *src_ptr,
|
||||
unsigned short *output_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned int output_height,
|
||||
unsigned int output_width
|
||||
);
|
||||
extern void vp8_filter_block1d8_h6_only_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1d16_h6_only_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern void vp8_filter_block1d8_v6_only_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
int dst_ptich,
|
||||
unsigned int output_height,
|
||||
const short *vp8_filter
|
||||
);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict8x8_mmx);
|
||||
|
||||
@ -127,115 +127,111 @@ extern prototype_subpixel_predict(vp8_bilinear_predict8x8_mmx);
|
||||
#if HAVE_MMX
|
||||
void vp8_sixtap_predict4x4_mmx
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict4x4_mmx\n");
|
||||
printf("vp8_sixtap_predict4x4_mmx\n");
|
||||
#endif
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 16*16); /* Temp data bufffer used in filtering */
|
||||
const short *HFilter, *VFilter;
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 8, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 8, dst_ptr, dst_pitch, 8, 4 , 4, 4, VFilter);
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 16 * 16); /* Temp data bufffer used in filtering */
|
||||
const short *HFilter, *VFilter;
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 8, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 8, dst_ptr, dst_pitch, 8, 4, 4, 4, VFilter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict16x16_mmx
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict16x16_mmx\n");
|
||||
printf("vp8_sixtap_predict16x16_mmx\n");
|
||||
#endif
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 24*24); /* Temp data bufffer used in filtering */
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 24 * 24); /* Temp data bufffer used in filtering */
|
||||
|
||||
const short *HFilter, *VFilter;
|
||||
const short *HFilter, *VFilter;
|
||||
|
||||
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 8, FData2 + 8, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 12, FData2 + 12, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 8, FData2 + 8, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 12, FData2 + 12, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, 16, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 36, dst_ptr + 4, dst_pitch, 32, 16 , 16, 16, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 40, dst_ptr + 8, dst_pitch, 32, 16 , 16, 16, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 44, dst_ptr + 12, dst_pitch, 32, 16 , 16, 16, VFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 32, dst_ptr, dst_pitch, 32, 16, 16, 16, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 36, dst_ptr + 4, dst_pitch, 32, 16, 16, 16, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 40, dst_ptr + 8, dst_pitch, 32, 16, 16, 16, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 44, dst_ptr + 12, dst_pitch, 32, 16, 16, 16, VFilter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict8x8_mmx
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict8x8_mmx\n");
|
||||
printf("vp8_sixtap_predict8x8_mmx\n");
|
||||
#endif
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
|
||||
const short *HFilter, *VFilter;
|
||||
const short *HFilter, *VFilter;
|
||||
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 13, 16, HFilter);
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 13, 16, HFilter);
|
||||
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, 8, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 20, dst_ptr + 4, dst_pitch, 16, 8 , 8, 8, VFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 16, dst_ptr, dst_pitch, 16, 8, 8, 8, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 20, dst_ptr + 4, dst_pitch, 16, 8, 8, 8, VFilter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict8x4_mmx
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict8x4_mmx\n");
|
||||
printf("vp8_sixtap_predict8x4_mmx\n");
|
||||
#endif
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
|
||||
const short *HFilter, *VFilter;
|
||||
const short *HFilter, *VFilter;
|
||||
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 9, 16, HFilter);
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
|
||||
vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 9, 16, HFilter);
|
||||
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, 8, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 20, dst_ptr + 4, dst_pitch, 16, 8 , 4, 8, VFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 16, dst_ptr, dst_pitch, 16, 8, 4, 8, VFilter);
|
||||
vp8_filter_block1dc_v6_mmx(FData2 + 20, dst_ptr + 4, dst_pitch, 16, 8, 4, 8, VFilter);
|
||||
|
||||
}
|
||||
|
||||
@ -243,18 +239,17 @@ void vp8_sixtap_predict8x4_mmx
|
||||
|
||||
void vp8_bilinear_predict16x16_mmx
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pitch);
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr + 8, src_pixels_per_line, xoffset, yoffset, dst_ptr + 8, dst_pitch);
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr + 8 * src_pixels_per_line, src_pixels_per_line, xoffset, yoffset, dst_ptr + dst_pitch * 8, dst_pitch);
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr + 8 * src_pixels_per_line + 8, src_pixels_per_line, xoffset, yoffset, dst_ptr + dst_pitch * 8 + 8, dst_pitch);
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pitch);
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr + 8, src_pixels_per_line, xoffset, yoffset, dst_ptr + 8, dst_pitch);
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr + 8 * src_pixels_per_line, src_pixels_per_line, xoffset, yoffset, dst_ptr + dst_pitch * 8, dst_pitch);
|
||||
vp8_bilinear_predict8x8_mmx(src_ptr + 8 * src_pixels_per_line + 8, src_pixels_per_line, xoffset, yoffset, dst_ptr + dst_pitch * 8 + 8, dst_pitch);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -262,127 +257,106 @@ void vp8_bilinear_predict16x16_mmx
|
||||
#if HAVE_SSE2
|
||||
void vp8_sixtap_predict16x16_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 24*24); /* Temp data bufffer used in filtering */
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 24 * 24); /* Temp data bufffer used in filtering */
|
||||
|
||||
const short *HFilter, *VFilter;
|
||||
const short *HFilter, *VFilter;
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict16x16_sse2\n");
|
||||
printf("vp8_sixtap_predict16x16_sse2\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First-pass only */
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d16_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, HFilter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second-pass only */
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
|
||||
vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16, 16, dst_pitch, VFilter);
|
||||
} else {
|
||||
/* First-pass only */
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d16_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, HFilter);
|
||||
}
|
||||
} else {
|
||||
/* Second-pass only */
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
|
||||
vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16, 16, dst_pitch, VFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict8x8_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
const short *HFilter, *VFilter;
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
const short *HFilter, *VFilter;
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict8x8_sse2\n");
|
||||
printf("vp8_sixtap_predict8x8_sse2\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, dst_pitch, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First-pass only */
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, HFilter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second-pass only */
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, VFilter);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8, 8, dst_pitch, VFilter);
|
||||
} else {
|
||||
/* First-pass only */
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, HFilter);
|
||||
}
|
||||
} else {
|
||||
/* Second-pass only */
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, VFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict8x4_sse2
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
const short *HFilter, *VFilter;
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
|
||||
const short *HFilter, *VFilter;
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict8x4_sse2\n");
|
||||
printf("vp8_sixtap_predict8x4_sse2\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, dst_pitch, VFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First-pass only */
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, HFilter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second-pass only */
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, VFilter);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8, 4, dst_pitch, VFilter);
|
||||
} else {
|
||||
/* First-pass only */
|
||||
HFilter = vp8_six_tap_mmx[xoffset];
|
||||
vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, HFilter);
|
||||
}
|
||||
} else {
|
||||
/* Second-pass only */
|
||||
VFilter = vp8_six_tap_mmx[yoffset];
|
||||
vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, VFilter);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -391,200 +365,172 @@ void vp8_sixtap_predict8x4_sse2
|
||||
|
||||
extern void vp8_filter_block1d8_h6_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
);
|
||||
|
||||
extern void vp8_filter_block1d16_h6_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
);
|
||||
|
||||
extern void vp8_filter_block1d16_v6_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int out_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int out_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
);
|
||||
|
||||
extern void vp8_filter_block1d8_v6_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int out_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int out_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
);
|
||||
|
||||
extern void vp8_filter_block1d4_h6_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pixels_per_line,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int output_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
);
|
||||
|
||||
extern void vp8_filter_block1d4_v6_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int out_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
unsigned char *src_ptr,
|
||||
unsigned int src_pitch,
|
||||
unsigned char *output_ptr,
|
||||
unsigned int out_pitch,
|
||||
unsigned int output_height,
|
||||
unsigned int vp8_filter_index
|
||||
);
|
||||
|
||||
void vp8_sixtap_predict16x16_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 24*24);
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 24 * 24);
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict16x16_ssse3\n");
|
||||
printf("vp8_sixtap_predict16x16_ssse3\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
vp8_filter_block1d16_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 16, 21, xoffset);
|
||||
vp8_filter_block1d16_v6_ssse3(FData2 , 16, dst_ptr, dst_pitch, 16, yoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First-pass only */
|
||||
vp8_filter_block1d16_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, xoffset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second-pass only */
|
||||
vp8_filter_block1d16_v6_ssse3(src_ptr - (2 * src_pixels_per_line) , src_pixels_per_line, dst_ptr, dst_pitch, 16, yoffset);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
vp8_filter_block1d16_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 16, 21, xoffset);
|
||||
vp8_filter_block1d16_v6_ssse3(FData2, 16, dst_ptr, dst_pitch, 16, yoffset);
|
||||
} else {
|
||||
/* First-pass only */
|
||||
vp8_filter_block1d16_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, xoffset);
|
||||
}
|
||||
} else {
|
||||
/* Second-pass only */
|
||||
vp8_filter_block1d16_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 16, yoffset);
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_sixtap_predict8x8_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 256);
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 256);
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict8x8_ssse3\n");
|
||||
printf("vp8_sixtap_predict8x8_ssse3\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 8, 13, xoffset);
|
||||
vp8_filter_block1d8_v6_ssse3(FData2, 8, dst_ptr, dst_pitch, 8, yoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, xoffset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second-pass only */
|
||||
vp8_filter_block1d8_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, yoffset);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 8, 13, xoffset);
|
||||
vp8_filter_block1d8_v6_ssse3(FData2, 8, dst_ptr, dst_pitch, 8, yoffset);
|
||||
} else {
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, xoffset);
|
||||
}
|
||||
} else {
|
||||
/* Second-pass only */
|
||||
vp8_filter_block1d8_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, yoffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp8_sixtap_predict8x4_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 256);
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 256);
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict8x4_ssse3\n");
|
||||
printf("vp8_sixtap_predict8x4_ssse3\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 8, 9, xoffset);
|
||||
vp8_filter_block1d8_v6_ssse3(FData2, 8, dst_ptr, dst_pitch, 4, yoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First-pass only */
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, xoffset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second-pass only */
|
||||
vp8_filter_block1d8_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, yoffset);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 8, 9, xoffset);
|
||||
vp8_filter_block1d8_v6_ssse3(FData2, 8, dst_ptr, dst_pitch, 4, yoffset);
|
||||
} else {
|
||||
/* First-pass only */
|
||||
vp8_filter_block1d8_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, xoffset);
|
||||
}
|
||||
} else {
|
||||
/* Second-pass only */
|
||||
vp8_filter_block1d8_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, yoffset);
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_sixtap_predict4x4_ssse3
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
)
|
||||
{
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 4*9);
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
unsigned char *dst_ptr,
|
||||
int dst_pitch
|
||||
) {
|
||||
DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 4 * 9);
|
||||
#ifdef ANNOUNCE_FUNCTION
|
||||
printf("vp8_sixtap_predict4x4_ssse3\n");
|
||||
printf("vp8_sixtap_predict4x4_ssse3\n");
|
||||
#endif
|
||||
|
||||
if (xoffset)
|
||||
{
|
||||
if (yoffset)
|
||||
{
|
||||
vp8_filter_block1d4_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 4, 9, xoffset);
|
||||
vp8_filter_block1d4_v6_ssse3(FData2, 4, dst_ptr, dst_pitch, 4, yoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp8_filter_block1d4_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, xoffset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vp8_filter_block1d4_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, yoffset);
|
||||
if (xoffset) {
|
||||
if (yoffset) {
|
||||
vp8_filter_block1d4_h6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, FData2, 4, 9, xoffset);
|
||||
vp8_filter_block1d4_v6_ssse3(FData2, 4, dst_ptr, dst_pitch, 4, yoffset);
|
||||
} else {
|
||||
vp8_filter_block1d4_h6_ssse3(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, xoffset);
|
||||
}
|
||||
} else {
|
||||
vp8_filter_block1d4_v6_ssse3(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, yoffset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,127 +19,123 @@
|
||||
#include "vp8/common/pragmas.h"
|
||||
#include "vp8/common/onyxc_int.h"
|
||||
|
||||
void vp8_arch_x86_common_init(VP8_COMMON *ctx)
|
||||
{
|
||||
void vp8_arch_x86_common_init(VP8_COMMON *ctx) {
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
int flags = x86_simd_caps();
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
int flags = x86_simd_caps();
|
||||
|
||||
/* Note:
|
||||
*
|
||||
* This platform can be built without runtime CPU detection as well. If
|
||||
* you modify any of the function mappings present in this file, be sure
|
||||
* to also update them in static mapings (<arch>/filename_<arch>.h)
|
||||
*/
|
||||
/* Note:
|
||||
*
|
||||
* This platform can be built without runtime CPU detection as well. If
|
||||
* you modify any of the function mappings present in this file, be sure
|
||||
* to also update them in static mapings (<arch>/filename_<arch>.h)
|
||||
*/
|
||||
|
||||
/* Override default functions with fastest ones for this CPU. */
|
||||
/* Override default functions with fastest ones for this CPU. */
|
||||
#if HAVE_MMX
|
||||
// The commented functions need to be re-written for vpx.
|
||||
if (flags & HAS_MMX)
|
||||
{
|
||||
rtcd->idct.idct1 = vpx_short_idct4x4llm_1_mmx;
|
||||
rtcd->idct.idct16 = vpx_short_idct4x4llm_mmx;
|
||||
rtcd->idct.idct1_scalar_add = vpx_dc_only_idct_add_mmx;
|
||||
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx;
|
||||
//rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx;
|
||||
if (flags & HAS_MMX) {
|
||||
rtcd->idct.idct1 = vpx_short_idct4x4llm_1_mmx;
|
||||
rtcd->idct.idct16 = vpx_short_idct4x4llm_mmx;
|
||||
rtcd->idct.idct1_scalar_add = vpx_dc_only_idct_add_mmx;
|
||||
// rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx;
|
||||
// rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx;
|
||||
|
||||
rtcd->recon.recon = vp8_recon_b_mmx;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_mmx;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_mmx;
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_mmx;
|
||||
rtcd->recon.recon = vp8_recon_b_mmx;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_mmx;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_mmx;
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_mmx;
|
||||
|
||||
#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_mmx;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_mmx;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_mmx;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_mmx;
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_mmx;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_mmx;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_mmx;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_mmx;
|
||||
#endif
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_mmx;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_mmx;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_mmx;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_mmx;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_mmx;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_mmx;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_mmx;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_mmx;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_mmx;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_mmx;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_mmx;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_mmx;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_mmx;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_mmx;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_mmx;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_mmx;
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_mmx;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_mmx;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_mmx;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_mmx;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_mmx;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_mmx;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_mmx;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_mmx;
|
||||
|
||||
#if CONFIG_POSTPROC
|
||||
rtcd->postproc.down = vp8_mbpost_proc_down_mmx;
|
||||
/*rtcd->postproc.across = vp8_mbpost_proc_across_ip_c;*/
|
||||
rtcd->postproc.downacross = vp8_post_proc_down_and_across_mmx;
|
||||
rtcd->postproc.addnoise = vp8_plane_add_noise_mmx;
|
||||
rtcd->postproc.down = vp8_mbpost_proc_down_mmx;
|
||||
/*rtcd->postproc.across = vp8_mbpost_proc_across_ip_c;*/
|
||||
rtcd->postproc.downacross = vp8_post_proc_down_and_across_mmx;
|
||||
rtcd->postproc.addnoise = vp8_plane_add_noise_mmx;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#if HAVE_SSE2
|
||||
|
||||
if (flags & HAS_SSE2)
|
||||
{
|
||||
rtcd->recon.recon2 = vp8_recon2b_sse2;
|
||||
rtcd->recon.recon4 = vp8_recon4b_sse2;
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_sse2;
|
||||
if (flags & HAS_SSE2) {
|
||||
rtcd->recon.recon2 = vp8_recon2b_sse2;
|
||||
rtcd->recon.recon4 = vp8_recon4b_sse2;
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_sse2;
|
||||
#if CONFIG_NEWINTRAMODES == 0
|
||||
rtcd->recon.build_intra_predictors_mbuv =
|
||||
vp8_build_intra_predictors_mbuv_sse2;
|
||||
rtcd->recon.build_intra_predictors_mbuv_s =
|
||||
vp8_build_intra_predictors_mbuv_s_sse2;
|
||||
rtcd->recon.build_intra_predictors_mbuv =
|
||||
vp8_build_intra_predictors_mbuv_sse2;
|
||||
rtcd->recon.build_intra_predictors_mbuv_s =
|
||||
vp8_build_intra_predictors_mbuv_s_sse2;
|
||||
#endif
|
||||
|
||||
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2;
|
||||
// rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2;
|
||||
|
||||
#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_sse2;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_sse2;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_sse2;
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_sse2;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_sse2;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_sse2;
|
||||
#endif
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_sse2;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_sse2;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_sse2;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_sse2;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_sse2;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_sse2;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_sse2;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_sse2;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_sse2;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_sse2;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_sse2;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_sse2;
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_sse2;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_sse2;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_sse2;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_sse2;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_sse2;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_sse2;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_sse2;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_sse2;
|
||||
|
||||
#if CONFIG_POSTPROC
|
||||
rtcd->postproc.down = vp8_mbpost_proc_down_xmm;
|
||||
rtcd->postproc.across = vp8_mbpost_proc_across_ip_xmm;
|
||||
rtcd->postproc.downacross = vp8_post_proc_down_and_across_xmm;
|
||||
rtcd->postproc.addnoise = vp8_plane_add_noise_wmt;
|
||||
rtcd->postproc.down = vp8_mbpost_proc_down_xmm;
|
||||
rtcd->postproc.across = vp8_mbpost_proc_across_ip_xmm;
|
||||
rtcd->postproc.downacross = vp8_post_proc_down_and_across_xmm;
|
||||
rtcd->postproc.addnoise = vp8_plane_add_noise_wmt;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3
|
||||
|
||||
if (flags & HAS_SSSE3)
|
||||
{
|
||||
if (flags & HAS_SSSE3) {
|
||||
#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_ssse3;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_ssse3;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_ssse3;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_ssse3;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_ssse3;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_ssse3;
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_ssse3;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_ssse3;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_ssse3;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_ssse3;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_ssse3;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_ssse3;
|
||||
#endif
|
||||
|
||||
#if CONFIG_NEWINTRAMODES == 0
|
||||
rtcd->recon.build_intra_predictors_mbuv =
|
||||
vp8_build_intra_predictors_mbuv_ssse3;
|
||||
rtcd->recon.build_intra_predictors_mbuv_s =
|
||||
vp8_build_intra_predictors_mbuv_s_ssse3;
|
||||
rtcd->recon.build_intra_predictors_mbuv =
|
||||
vp8_build_intra_predictors_mbuv_ssse3;
|
||||
rtcd->recon.build_intra_predictors_mbuv_s =
|
||||
vp8_build_intra_predictors_mbuv_s_ssse3;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -16,41 +16,37 @@
|
||||
#include "vp8/decoder/dequantize.h"
|
||||
#include "vp8/decoder/onyxd_int.h"
|
||||
|
||||
void vp8_arch_arm_decode_init(VP8D_COMP *pbi)
|
||||
{
|
||||
void vp8_arch_arm_decode_init(VP8D_COMP *pbi) {
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
int flags = pbi->common.rtcd.flags;
|
||||
int flags = pbi->common.rtcd.flags;
|
||||
|
||||
#if HAVE_ARMV5TE
|
||||
if (flags & HAS_EDSP)
|
||||
{
|
||||
}
|
||||
if (flags & HAS_EDSP) {
|
||||
}
|
||||
#endif
|
||||
|
||||
//The commented functions need to be re-written for vpx.
|
||||
// The commented functions need to be re-written for vpx.
|
||||
#if HAVE_ARMV6
|
||||
if (flags & HAS_MEDIA)
|
||||
{
|
||||
pbi->dequant.block = vp8_dequantize_b_v6;
|
||||
/*pbi->dequant.idct_add = vp8_dequant_idct_add_v6;
|
||||
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_v6;
|
||||
pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_v6;
|
||||
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_v6;
|
||||
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_v6;*/
|
||||
}
|
||||
if (flags & HAS_MEDIA) {
|
||||
pbi->dequant.block = vp8_dequantize_b_v6;
|
||||
/*pbi->dequant.idct_add = vp8_dequant_idct_add_v6;
|
||||
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_v6;
|
||||
pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_v6;
|
||||
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_v6;
|
||||
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_v6;*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
if (flags & HAS_NEON)
|
||||
{
|
||||
pbi->dequant.block = vp8_dequantize_b_neon;
|
||||
//pbi->dequant.idct_add = vp8_dequant_idct_add_neon;
|
||||
/*This is not used: NEON always dequants two blocks at once.
|
||||
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_neon;*/
|
||||
/*pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_neon;
|
||||
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_neon;
|
||||
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_neon;*/
|
||||
}
|
||||
if (flags & HAS_NEON) {
|
||||
pbi->dequant.block = vp8_dequantize_b_neon;
|
||||
// pbi->dequant.idct_add = vp8_dequant_idct_add_neon;
|
||||
/*This is not used: NEON always dequants two blocks at once.
|
||||
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_neon;*/
|
||||
/*pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_neon;
|
||||
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_neon;
|
||||
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_neon;*/
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -13,139 +13,124 @@
|
||||
#include "vp8/decoder/dequantize.h"
|
||||
|
||||
void vp8_dequant_dc_idct_add_y_block_v6
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs, short *dc)
|
||||
{
|
||||
int i;
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs, short *dc) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_dc_idct_add_v6 (q, dq, pre, dst, 16, stride, dc[0]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6 (dc[0], pre, dst, 16, stride);
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_dc_idct_add_v6(q, dq, pre, dst, 16, stride, dc[0]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6(dc[0], pre, dst, 16, stride);
|
||||
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_dc_idct_add_v6 (q+16, dq, pre+4, dst+4, 16, stride, dc[1]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6 (dc[1], pre+4, dst+4, 16, stride);
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_dc_idct_add_v6(q + 16, dq, pre + 4, dst + 4, 16, stride, dc[1]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6(dc[1], pre + 4, dst + 4, 16, stride);
|
||||
|
||||
if (eobs[2] > 1)
|
||||
vp8_dequant_dc_idct_add_v6 (q+32, dq, pre+8, dst+8, 16, stride, dc[2]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6 (dc[2], pre+8, dst+8, 16, stride);
|
||||
if (eobs[2] > 1)
|
||||
vp8_dequant_dc_idct_add_v6(q + 32, dq, pre + 8, dst + 8, 16, stride, dc[2]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6(dc[2], pre + 8, dst + 8, 16, stride);
|
||||
|
||||
if (eobs[3] > 1)
|
||||
vp8_dequant_dc_idct_add_v6 (q+48, dq, pre+12, dst+12, 16, stride, dc[3]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6 (dc[3], pre+12, dst+12, 16, stride);
|
||||
if (eobs[3] > 1)
|
||||
vp8_dequant_dc_idct_add_v6(q + 48, dq, pre + 12, dst + 12, 16, stride, dc[3]);
|
||||
else
|
||||
vp8_dc_only_idct_add_v6(dc[3], pre + 12, dst + 12, 16, stride);
|
||||
|
||||
q += 64;
|
||||
dc += 4;
|
||||
pre += 64;
|
||||
dst += 4*stride;
|
||||
eobs += 4;
|
||||
}
|
||||
q += 64;
|
||||
dc += 4;
|
||||
pre += 64;
|
||||
dst += 4 * stride;
|
||||
eobs += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_idct_add_y_block_v6
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs)
|
||||
{
|
||||
int i;
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_idct_add_v6 (q, dq, pre, dst, 16, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[0]*dq[0], pre, dst, 16, stride);
|
||||
((int *)q)[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_idct_add_v6 (q+16, dq, pre+4, dst+4, 16, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[16]*dq[0], pre+4, dst+4, 16, stride);
|
||||
((int *)(q+16))[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[2] > 1)
|
||||
vp8_dequant_idct_add_v6 (q+32, dq, pre+8, dst+8, 16, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[32]*dq[0], pre+8, dst+8, 16, stride);
|
||||
((int *)(q+32))[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[3] > 1)
|
||||
vp8_dequant_idct_add_v6 (q+48, dq, pre+12, dst+12, 16, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[48]*dq[0], pre+12, dst+12, 16, stride);
|
||||
((int *)(q+48))[0] = 0;
|
||||
}
|
||||
|
||||
q += 64;
|
||||
pre += 64;
|
||||
dst += 4*stride;
|
||||
eobs += 4;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_idct_add_v6(q, dq, pre, dst, 16, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[0]*dq[0], pre, dst, 16, stride);
|
||||
((int *)q)[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_idct_add_v6(q + 16, dq, pre + 4, dst + 4, 16, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[16]*dq[0], pre + 4, dst + 4, 16, stride);
|
||||
((int *)(q + 16))[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[2] > 1)
|
||||
vp8_dequant_idct_add_v6(q + 32, dq, pre + 8, dst + 8, 16, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[32]*dq[0], pre + 8, dst + 8, 16, stride);
|
||||
((int *)(q + 32))[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[3] > 1)
|
||||
vp8_dequant_idct_add_v6(q + 48, dq, pre + 12, dst + 12, 16, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[48]*dq[0], pre + 12, dst + 12, 16, stride);
|
||||
((int *)(q + 48))[0] = 0;
|
||||
}
|
||||
|
||||
q += 64;
|
||||
pre += 64;
|
||||
dst += 4 * stride;
|
||||
eobs += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_idct_add_uv_block_v6
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
|
||||
{
|
||||
int i;
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dstu, unsigned char *dstv, int stride, char *eobs) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_idct_add_v6 (q, dq, pre, dstu, 8, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[0]*dq[0], pre, dstu, 8, stride);
|
||||
((int *)q)[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_idct_add_v6 (q+16, dq, pre+4, dstu+4, 8, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[16]*dq[0], pre+4, dstu+4, 8, stride);
|
||||
((int *)(q+16))[0] = 0;
|
||||
}
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstu += 4*stride;
|
||||
eobs += 2;
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_idct_add_v6(q, dq, pre, dstu, 8, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[0]*dq[0], pre, dstu, 8, stride);
|
||||
((int *)q)[0] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_idct_add_v6 (q, dq, pre, dstv, 8, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[0]*dq[0], pre, dstv, 8, stride);
|
||||
((int *)q)[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_idct_add_v6 (q+16, dq, pre+4, dstv+4, 8, stride);
|
||||
else
|
||||
{
|
||||
vp8_dc_only_idct_add_v6 (q[16]*dq[0], pre+4, dstv+4, 8, stride);
|
||||
((int *)(q+16))[0] = 0;
|
||||
}
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstv += 4*stride;
|
||||
eobs += 2;
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_idct_add_v6(q + 16, dq, pre + 4, dstu + 4, 8, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[16]*dq[0], pre + 4, dstu + 4, 8, stride);
|
||||
((int *)(q + 16))[0] = 0;
|
||||
}
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstu += 4 * stride;
|
||||
eobs += 2;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (eobs[0] > 1)
|
||||
vp8_dequant_idct_add_v6(q, dq, pre, dstv, 8, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[0]*dq[0], pre, dstv, 8, stride);
|
||||
((int *)q)[0] = 0;
|
||||
}
|
||||
|
||||
if (eobs[1] > 1)
|
||||
vp8_dequant_idct_add_v6(q + 16, dq, pre + 4, dstv + 4, 8, stride);
|
||||
else {
|
||||
vp8_dc_only_idct_add_v6(q[16]*dq[0], pre + 4, dstv + 4, 8, stride);
|
||||
((int *)(q + 16))[0] = 0;
|
||||
}
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstv += 4 * stride;
|
||||
eobs += 2;
|
||||
}
|
||||
}
|
||||
|
@ -24,23 +24,21 @@ extern void vp8_dequantize_b_loop_v6(short *Q, short *DQC, short *DQ);
|
||||
|
||||
#if HAVE_ARMV7
|
||||
|
||||
void vp8_dequantize_b_neon(BLOCKD *d)
|
||||
{
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
void vp8_dequantize_b_neon(BLOCKD *d) {
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
|
||||
vp8_dequantize_b_loop_neon(Q, DQC, DQ);
|
||||
vp8_dequantize_b_loop_neon(Q, DQC, DQ);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV6
|
||||
void vp8_dequantize_b_v6(BLOCKD *d)
|
||||
{
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
void vp8_dequantize_b_v6(BLOCKD *d) {
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
|
||||
vp8_dequantize_b_loop_v6(Q, DQC, DQ);
|
||||
vp8_dequantize_b_loop_v6(Q, DQC, DQ);
|
||||
}
|
||||
#endif
|
||||
|
@ -16,100 +16,95 @@
|
||||
* outside of this scope
|
||||
*/
|
||||
void idct_dequant_dc_full_2x_neon
|
||||
(short *input, short *dq, unsigned char *pre, unsigned char *dst,
|
||||
int stride, short *dc);
|
||||
(short *input, short *dq, unsigned char *pre, unsigned char *dst,
|
||||
int stride, short *dc);
|
||||
void idct_dequant_dc_0_2x_neon
|
||||
(short *dc, unsigned char *pre, unsigned char *dst, int stride);
|
||||
(short *dc, unsigned char *pre, unsigned char *dst, int stride);
|
||||
void idct_dequant_full_2x_neon
|
||||
(short *q, short *dq, unsigned char *pre, unsigned char *dst,
|
||||
int pitch, int stride);
|
||||
(short *q, short *dq, unsigned char *pre, unsigned char *dst,
|
||||
int pitch, int stride);
|
||||
void idct_dequant_0_2x_neon
|
||||
(short *q, short dq, unsigned char *pre, int pitch,
|
||||
unsigned char *dst, int stride);
|
||||
(short *q, short dq, unsigned char *pre, int pitch,
|
||||
unsigned char *dst, int stride);
|
||||
|
||||
void vp8_dequant_dc_idct_add_y_block_neon
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs, short *dc)
|
||||
{
|
||||
int i;
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs, short *dc) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (((short *)eobs)[0] & 0xfefe)
|
||||
idct_dequant_dc_full_2x_neon (q, dq, pre, dst, stride, dc);
|
||||
else
|
||||
idct_dequant_dc_0_2x_neon(dc, pre, dst, stride);
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (((short *)eobs)[0] & 0xfefe)
|
||||
idct_dequant_dc_full_2x_neon(q, dq, pre, dst, stride, dc);
|
||||
else
|
||||
idct_dequant_dc_0_2x_neon(dc, pre, dst, stride);
|
||||
|
||||
if (((short *)eobs)[1] & 0xfefe)
|
||||
idct_dequant_dc_full_2x_neon (q+32, dq, pre+8, dst+8, stride, dc+2);
|
||||
else
|
||||
idct_dequant_dc_0_2x_neon(dc+2, pre+8, dst+8, stride);
|
||||
if (((short *)eobs)[1] & 0xfefe)
|
||||
idct_dequant_dc_full_2x_neon(q + 32, dq, pre + 8, dst + 8, stride, dc + 2);
|
||||
else
|
||||
idct_dequant_dc_0_2x_neon(dc + 2, pre + 8, dst + 8, stride);
|
||||
|
||||
q += 64;
|
||||
dc += 4;
|
||||
pre += 64;
|
||||
dst += 4*stride;
|
||||
eobs += 4;
|
||||
}
|
||||
q += 64;
|
||||
dc += 4;
|
||||
pre += 64;
|
||||
dst += 4 * stride;
|
||||
eobs += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_idct_add_y_block_neon
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs)
|
||||
{
|
||||
int i;
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dst, int stride, char *eobs) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (((short *)eobs)[0] & 0xfefe)
|
||||
idct_dequant_full_2x_neon (q, dq, pre, dst, 16, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon (q, dq[0], pre, 16, dst, stride);
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (((short *)eobs)[0] & 0xfefe)
|
||||
idct_dequant_full_2x_neon(q, dq, pre, dst, 16, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon(q, dq[0], pre, 16, dst, stride);
|
||||
|
||||
if (((short *)eobs)[1] & 0xfefe)
|
||||
idct_dequant_full_2x_neon (q+32, dq, pre+8, dst+8, 16, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon (q+32, dq[0], pre+8, 16, dst+8, stride);
|
||||
if (((short *)eobs)[1] & 0xfefe)
|
||||
idct_dequant_full_2x_neon(q + 32, dq, pre + 8, dst + 8, 16, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon(q + 32, dq[0], pre + 8, 16, dst + 8, stride);
|
||||
|
||||
q += 64;
|
||||
pre += 64;
|
||||
dst += 4*stride;
|
||||
eobs += 4;
|
||||
}
|
||||
q += 64;
|
||||
pre += 64;
|
||||
dst += 4 * stride;
|
||||
eobs += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_idct_add_uv_block_neon
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
|
||||
{
|
||||
if (((short *)eobs)[0] & 0xfefe)
|
||||
idct_dequant_full_2x_neon (q, dq, pre, dstu, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon (q, dq[0], pre, 8, dstu, stride);
|
||||
(short *q, short *dq, unsigned char *pre,
|
||||
unsigned char *dstu, unsigned char *dstv, int stride, char *eobs) {
|
||||
if (((short *)eobs)[0] & 0xfefe)
|
||||
idct_dequant_full_2x_neon(q, dq, pre, dstu, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon(q, dq[0], pre, 8, dstu, stride);
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstu += 4*stride;
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstu += 4 * stride;
|
||||
|
||||
if (((short *)eobs)[1] & 0xfefe)
|
||||
idct_dequant_full_2x_neon (q, dq, pre, dstu, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon (q, dq[0], pre, 8, dstu, stride);
|
||||
if (((short *)eobs)[1] & 0xfefe)
|
||||
idct_dequant_full_2x_neon(q, dq, pre, dstu, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon(q, dq[0], pre, 8, dstu, stride);
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
q += 32;
|
||||
pre += 32;
|
||||
|
||||
if (((short *)eobs)[2] & 0xfefe)
|
||||
idct_dequant_full_2x_neon (q, dq, pre, dstv, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon (q, dq[0], pre, 8, dstv, stride);
|
||||
if (((short *)eobs)[2] & 0xfefe)
|
||||
idct_dequant_full_2x_neon(q, dq, pre, dstv, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon(q, dq[0], pre, 8, dstv, stride);
|
||||
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstv += 4*stride;
|
||||
q += 32;
|
||||
pre += 32;
|
||||
dstv += 4 * stride;
|
||||
|
||||
if (((short *)eobs)[3] & 0xfefe)
|
||||
idct_dequant_full_2x_neon (q, dq, pre, dstv, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon (q, dq[0], pre, 8, dstv, stride);
|
||||
if (((short *)eobs)[3] & 0xfefe)
|
||||
idct_dequant_full_2x_neon(q, dq, pre, dstv, 8, stride);
|
||||
else
|
||||
idct_dequant_0_2x_neon(q, dq[0], pre, 8, dstv, stride);
|
||||
}
|
||||
|
@ -15,102 +15,88 @@
|
||||
|
||||
int vp8dx_start_decode(BOOL_DECODER *br,
|
||||
const unsigned char *source,
|
||||
unsigned int source_sz)
|
||||
{
|
||||
br->user_buffer_end = source+source_sz;
|
||||
br->user_buffer = source;
|
||||
br->value = 0;
|
||||
br->count = -8;
|
||||
br->range = 255;
|
||||
unsigned int source_sz) {
|
||||
br->user_buffer_end = source + source_sz;
|
||||
br->user_buffer = source;
|
||||
br->value = 0;
|
||||
br->count = -8;
|
||||
br->range = 255;
|
||||
|
||||
if (source_sz && !source)
|
||||
return 1;
|
||||
if (source_sz && !source)
|
||||
return 1;
|
||||
|
||||
/* Populate the buffer */
|
||||
vp8dx_bool_decoder_fill(br);
|
||||
/* Populate the buffer */
|
||||
vp8dx_bool_decoder_fill(br);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void vp8dx_bool_decoder_fill(BOOL_DECODER *br)
|
||||
{
|
||||
const unsigned char *bufptr;
|
||||
const unsigned char *bufend;
|
||||
VP8_BD_VALUE value;
|
||||
int count;
|
||||
bufend = br->user_buffer_end;
|
||||
bufptr = br->user_buffer;
|
||||
value = br->value;
|
||||
count = br->count;
|
||||
void vp8dx_bool_decoder_fill(BOOL_DECODER *br) {
|
||||
const unsigned char *bufptr;
|
||||
const unsigned char *bufend;
|
||||
VP8_BD_VALUE value;
|
||||
int count;
|
||||
bufend = br->user_buffer_end;
|
||||
bufptr = br->user_buffer;
|
||||
value = br->value;
|
||||
count = br->count;
|
||||
|
||||
VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
|
||||
VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
|
||||
|
||||
br->user_buffer = bufptr;
|
||||
br->value = value;
|
||||
br->count = count;
|
||||
br->user_buffer = bufptr;
|
||||
br->value = value;
|
||||
br->count = count;
|
||||
}
|
||||
|
||||
|
||||
#if CONFIG_NEWUPDATE
|
||||
static int get_unsigned_bits(unsigned num_values)
|
||||
{
|
||||
int cat=0;
|
||||
if ((num_values--)<=1) return 0;
|
||||
while (num_values>0)
|
||||
{
|
||||
cat++;
|
||||
num_values>>=1;
|
||||
static int get_unsigned_bits(unsigned num_values) {
|
||||
int cat = 0;
|
||||
if ((num_values--) <= 1) return 0;
|
||||
while (num_values > 0) {
|
||||
cat++;
|
||||
num_values >>= 1;
|
||||
}
|
||||
return cat;
|
||||
}
|
||||
|
||||
int inv_recenter_nonneg(int v, int m) {
|
||||
if (v > (m << 1)) return v;
|
||||
else if ((v & 1) == 0) return (v >> 1) + m;
|
||||
else return m - ((v + 1) >> 1);
|
||||
}
|
||||
|
||||
int vp8_decode_uniform(BOOL_DECODER *br, int n) {
|
||||
int v;
|
||||
int l = get_unsigned_bits(n);
|
||||
int m = (1 << l) - n;
|
||||
if (!l) return 0;
|
||||
v = vp8_decode_value(br, l - 1);
|
||||
if (v < m)
|
||||
return v;
|
||||
else
|
||||
return (v << 1) - m + vp8_decode_value(br, 1);
|
||||
}
|
||||
|
||||
int vp8_decode_term_subexp(BOOL_DECODER *br, int k, int num_syms) {
|
||||
int i = 0, mk = 0, word;
|
||||
while (1) {
|
||||
int b = (i ? k + i - 1 : k);
|
||||
int a = (1 << b);
|
||||
if (num_syms <= mk + 3 * a) {
|
||||
word = vp8_decode_uniform(br, num_syms - mk) + mk;
|
||||
break;
|
||||
} else {
|
||||
if (vp8_decode_value(br, 1)) {
|
||||
i++;
|
||||
mk += a;
|
||||
} else {
|
||||
word = vp8_decode_value(br, b) + mk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cat;
|
||||
}
|
||||
|
||||
int inv_recenter_nonneg(int v, int m)
|
||||
{
|
||||
if (v>(m<<1)) return v;
|
||||
else if ((v&1)==0) return (v>>1)+m;
|
||||
else return m-((v+1)>>1);
|
||||
}
|
||||
|
||||
int vp8_decode_uniform(BOOL_DECODER *br, int n)
|
||||
{
|
||||
int v;
|
||||
int l=get_unsigned_bits(n);
|
||||
int m=(1<<l)-n;
|
||||
if (!l) return 0;
|
||||
v = vp8_decode_value(br, l-1);
|
||||
if (v < m)
|
||||
return v;
|
||||
else
|
||||
return (v<<1)-m+vp8_decode_value(br, 1);
|
||||
}
|
||||
|
||||
int vp8_decode_term_subexp(BOOL_DECODER *br, int k, int num_syms)
|
||||
{
|
||||
int i=0, mk=0, word;
|
||||
while (1)
|
||||
{
|
||||
int b = (i?k+i-1:k);
|
||||
int a = (1<<b);
|
||||
if (num_syms<=mk+3*a)
|
||||
{
|
||||
word = vp8_decode_uniform(br, num_syms-mk) + mk;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vp8_decode_value(br, 1))
|
||||
{
|
||||
i++;
|
||||
mk += a;
|
||||
}
|
||||
else
|
||||
{
|
||||
word = vp8_decode_value(br, b) + mk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return word;
|
||||
}
|
||||
return word;
|
||||
}
|
||||
#endif
|
||||
|
@ -25,13 +25,12 @@ typedef size_t VP8_BD_VALUE;
|
||||
Even relatively modest values like 100 would work fine.*/
|
||||
# define VP8_LOTS_OF_BITS (0x40000000)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const unsigned char *user_buffer_end;
|
||||
const unsigned char *user_buffer;
|
||||
VP8_BD_VALUE value;
|
||||
int count;
|
||||
unsigned int range;
|
||||
typedef struct {
|
||||
const unsigned char *user_buffer_end;
|
||||
const unsigned char *user_buffer;
|
||||
VP8_BD_VALUE value;
|
||||
int count;
|
||||
unsigned int range;
|
||||
} BOOL_DECODER;
|
||||
|
||||
DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
|
||||
@ -55,107 +54,102 @@ int inv_recenter_nonneg(int v, int m);
|
||||
enough to eliminate the stores to those fields and the subsequent reloads
|
||||
from them when inlining the function.*/
|
||||
#define VP8DX_BOOL_DECODER_FILL(_count,_value,_bufptr,_bufend) \
|
||||
do \
|
||||
do \
|
||||
{ \
|
||||
int shift = VP8_BD_VALUE_SIZE - 8 - ((_count) + 8); \
|
||||
int loop_end, x; \
|
||||
size_t bits_left = ((_bufend)-(_bufptr))*CHAR_BIT; \
|
||||
\
|
||||
x = shift + CHAR_BIT - bits_left; \
|
||||
loop_end = 0; \
|
||||
if(x >= 0) \
|
||||
{ \
|
||||
int shift = VP8_BD_VALUE_SIZE - 8 - ((_count) + 8); \
|
||||
int loop_end, x; \
|
||||
size_t bits_left = ((_bufend)-(_bufptr))*CHAR_BIT; \
|
||||
\
|
||||
x = shift + CHAR_BIT - bits_left; \
|
||||
loop_end = 0; \
|
||||
if(x >= 0) \
|
||||
{ \
|
||||
(_count) += VP8_LOTS_OF_BITS; \
|
||||
loop_end = x; \
|
||||
if(!bits_left) break; \
|
||||
} \
|
||||
while(shift >= loop_end) \
|
||||
{ \
|
||||
(_count) += CHAR_BIT; \
|
||||
(_value) |= (VP8_BD_VALUE)*(_bufptr)++ << shift; \
|
||||
shift -= CHAR_BIT; \
|
||||
} \
|
||||
(_count) += VP8_LOTS_OF_BITS; \
|
||||
loop_end = x; \
|
||||
if(!bits_left) break; \
|
||||
} \
|
||||
while(0) \
|
||||
while(shift >= loop_end) \
|
||||
{ \
|
||||
(_count) += CHAR_BIT; \
|
||||
(_value) |= (VP8_BD_VALUE)*(_bufptr)++ << shift; \
|
||||
shift -= CHAR_BIT; \
|
||||
} \
|
||||
} \
|
||||
while(0) \
|
||||
|
||||
|
||||
static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
|
||||
unsigned int bit = 0;
|
||||
VP8_BD_VALUE value;
|
||||
unsigned int split;
|
||||
VP8_BD_VALUE bigsplit;
|
||||
int count;
|
||||
unsigned int range;
|
||||
unsigned int bit = 0;
|
||||
VP8_BD_VALUE value;
|
||||
unsigned int split;
|
||||
VP8_BD_VALUE bigsplit;
|
||||
int count;
|
||||
unsigned int range;
|
||||
|
||||
split = 1 + (((br->range - 1) * probability) >> 8);
|
||||
split = 1 + (((br->range - 1) * probability) >> 8);
|
||||
|
||||
if(br->count < 0)
|
||||
vp8dx_bool_decoder_fill(br);
|
||||
if (br->count < 0)
|
||||
vp8dx_bool_decoder_fill(br);
|
||||
|
||||
value = br->value;
|
||||
count = br->count;
|
||||
value = br->value;
|
||||
count = br->count;
|
||||
|
||||
bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
|
||||
bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
|
||||
|
||||
range = split;
|
||||
range = split;
|
||||
|
||||
if (value >= bigsplit)
|
||||
{
|
||||
range = br->range - split;
|
||||
value = value - bigsplit;
|
||||
bit = 1;
|
||||
}
|
||||
if (value >= bigsplit) {
|
||||
range = br->range - split;
|
||||
value = value - bigsplit;
|
||||
bit = 1;
|
||||
}
|
||||
|
||||
{
|
||||
register unsigned int shift = vp8_norm[range];
|
||||
range <<= shift;
|
||||
value <<= shift;
|
||||
count -= shift;
|
||||
}
|
||||
br->value = value;
|
||||
br->count = count;
|
||||
br->range = range;
|
||||
{
|
||||
register unsigned int shift = vp8_norm[range];
|
||||
range <<= shift;
|
||||
value <<= shift;
|
||||
count -= shift;
|
||||
}
|
||||
br->value = value;
|
||||
br->count = count;
|
||||
br->range = range;
|
||||
|
||||
return bit;
|
||||
return bit;
|
||||
}
|
||||
|
||||
static int vp8_decode_value(BOOL_DECODER *br, int bits)
|
||||
{
|
||||
int z = 0;
|
||||
int bit;
|
||||
static int vp8_decode_value(BOOL_DECODER *br, int bits) {
|
||||
int z = 0;
|
||||
int bit;
|
||||
|
||||
for (bit = bits - 1; bit >= 0; bit--)
|
||||
{
|
||||
z |= (vp8dx_decode_bool(br, 0x80) << bit);
|
||||
}
|
||||
for (bit = bits - 1; bit >= 0; bit--) {
|
||||
z |= (vp8dx_decode_bool(br, 0x80) << bit);
|
||||
}
|
||||
|
||||
return z;
|
||||
return z;
|
||||
}
|
||||
|
||||
static int vp8dx_bool_error(BOOL_DECODER *br)
|
||||
{
|
||||
/* Check if we have reached the end of the buffer.
|
||||
*
|
||||
* Variable 'count' stores the number of bits in the 'value' buffer, minus
|
||||
* 8. The top byte is part of the algorithm, and the remainder is buffered
|
||||
* to be shifted into it. So if count == 8, the top 16 bits of 'value' are
|
||||
* occupied, 8 for the algorithm and 8 in the buffer.
|
||||
*
|
||||
* When reading a byte from the user's buffer, count is filled with 8 and
|
||||
* one byte is filled into the value buffer. When we reach the end of the
|
||||
* data, count is additionally filled with VP8_LOTS_OF_BITS. So when
|
||||
* count == VP8_LOTS_OF_BITS - 1, the user's data has been exhausted.
|
||||
static int vp8dx_bool_error(BOOL_DECODER *br) {
|
||||
/* Check if we have reached the end of the buffer.
|
||||
*
|
||||
* Variable 'count' stores the number of bits in the 'value' buffer, minus
|
||||
* 8. The top byte is part of the algorithm, and the remainder is buffered
|
||||
* to be shifted into it. So if count == 8, the top 16 bits of 'value' are
|
||||
* occupied, 8 for the algorithm and 8 in the buffer.
|
||||
*
|
||||
* When reading a byte from the user's buffer, count is filled with 8 and
|
||||
* one byte is filled into the value buffer. When we reach the end of the
|
||||
* data, count is additionally filled with VP8_LOTS_OF_BITS. So when
|
||||
* count == VP8_LOTS_OF_BITS - 1, the user's data has been exhausted.
|
||||
*/
|
||||
if ((br->count > VP8_BD_VALUE_SIZE) && (br->count < VP8_LOTS_OF_BITS)) {
|
||||
/* We have tried to decode bits after the end of
|
||||
* stream was encountered.
|
||||
*/
|
||||
if ((br->count > VP8_BD_VALUE_SIZE) && (br->count < VP8_LOTS_OF_BITS))
|
||||
{
|
||||
/* We have tried to decode bits after the end of
|
||||
* stream was encountered.
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* No error. */
|
||||
return 0;
|
||||
/* No error. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "onyxd_int.h"
|
||||
|
||||
extern void vp8_short_idct4x4llm_c(short *input, short *output, int pitch) ;
|
||||
extern void vp8_short_idct4x4llm_c(short *input, short *output, int pitch);
|
||||
extern void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch);
|
||||
extern void vp8_short_idct8x8_c(short *input, short *output, int pitch);
|
||||
extern void vp8_short_idct8x8_1_c(short *input, short *output, int pitch);
|
||||
@ -29,386 +29,358 @@ extern void vp8_short_inv_walsh4x4_1_x8_c(short *input, short *output, int pitch
|
||||
extern int dec_debug;
|
||||
#endif
|
||||
|
||||
void vp8_dequantize_b_c(BLOCKD *d)
|
||||
{
|
||||
void vp8_dequantize_b_c(BLOCKD *d) {
|
||||
|
||||
int i;
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
int i;
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
DQ[i] = Q[i] * DQC[i];
|
||||
}
|
||||
for (i = 0; i < 16; i++) {
|
||||
DQ[i] = Q[i] * DQC[i];
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *pred,
|
||||
unsigned char *dest, int pitch, int stride)
|
||||
{
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
int i;
|
||||
unsigned char *dest, int pitch, int stride) {
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
input[i] = dq[i] * input[i];
|
||||
for (i = 0; i < 16; i++) {
|
||||
input[i] = dq[i] * input[i];
|
||||
}
|
||||
|
||||
/* the idct halves ( >> 1) the pitch */
|
||||
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
||||
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
/* the idct halves ( >> 1) the pitch */
|
||||
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
||||
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_dc_idct_add_c(short *input, short *dq, unsigned char *pred,
|
||||
unsigned char *dest, int pitch, int stride,
|
||||
int Dc)
|
||||
{
|
||||
int i;
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
int Dc) {
|
||||
int i;
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
|
||||
input[0] = (short)Dc;
|
||||
input[0] = (short)Dc;
|
||||
|
||||
for (i = 1; i < 16; i++)
|
||||
{
|
||||
input[i] = dq[i] * input[i];
|
||||
for (i = 1; i < 16; i++) {
|
||||
input[i] = dq[i] * input[i];
|
||||
}
|
||||
|
||||
/* the idct halves ( >> 1) the pitch */
|
||||
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
||||
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
/* the idct halves ( >> 1) the pitch */
|
||||
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
||||
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_LOSSLESS
|
||||
void vp8_dequant_idct_add_lossless_c(short *input, short *dq, unsigned char *pred,
|
||||
unsigned char *dest, int pitch, int stride)
|
||||
{
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
int i;
|
||||
unsigned char *dest, int pitch, int stride) {
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
input[i] = dq[i] * input[i];
|
||||
for (i = 0; i < 16; i++) {
|
||||
input[i] = dq[i] * input[i];
|
||||
}
|
||||
|
||||
vp8_short_inv_walsh4x4_x8_c(input, output, 4 << 1);
|
||||
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
vp8_short_inv_walsh4x4_x8_c(input, output, 4 << 1);
|
||||
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_dequant_dc_idct_add_lossless_c(short *input, short *dq, unsigned char *pred,
|
||||
unsigned char *dest, int pitch, int stride,
|
||||
int Dc)
|
||||
{
|
||||
int i;
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
unsigned char *dest, int pitch, int stride,
|
||||
int Dc) {
|
||||
int i;
|
||||
short output[16];
|
||||
short *diff_ptr = output;
|
||||
int r, c;
|
||||
|
||||
input[0] = (short)Dc;
|
||||
input[0] = (short)Dc;
|
||||
|
||||
for (i = 1; i < 16; i++)
|
||||
{
|
||||
input[i] = dq[i] * input[i];
|
||||
for (i = 1; i < 16; i++) {
|
||||
input[i] = dq[i] * input[i];
|
||||
}
|
||||
|
||||
vp8_short_inv_walsh4x4_x8_c(input, output, 4 << 1);
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
vp8_short_inv_walsh4x4_x8_c(input, output, 4 << 1);
|
||||
vpx_memset(input, 0, 32);
|
||||
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
dest += stride;
|
||||
diff_ptr += 4;
|
||||
pred += pitch;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void vp8_dequantize_b_2x2_c(BLOCKD *d)
|
||||
{
|
||||
int i;
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
void vp8_dequantize_b_2x2_c(BLOCKD *d) {
|
||||
int i;
|
||||
short *DQ = d->dqcoeff;
|
||||
short *Q = d->qcoeff;
|
||||
short *DQC = d->dequant;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
DQ[i] = (short)((Q[i] * DQC[i]));
|
||||
}
|
||||
for (i = 0; i < 16; i++) {
|
||||
DQ[i] = (short)((Q[i] * DQC[i]));
|
||||
}
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Dequantize 2x2\n");
|
||||
for (j=0;j<16;j++) printf("%d ", Q[j]); printf("\n");
|
||||
for (j=0;j<16;j++) printf("%d ", DQ[j]); printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Dequantize 2x2\n");
|
||||
for (j = 0; j < 16; j++) printf("%d ", Q[j]);
|
||||
printf("\n");
|
||||
for (j = 0; j < 16; j++) printf("%d ", DQ[j]);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp8_dequant_idct_add_8x8_c(short *input, short *dq, unsigned char *pred,
|
||||
unsigned char *dest, int pitch, int stride)//, MACROBLOCKD *xd, short blk_idx
|
||||
{
|
||||
short output[64];
|
||||
short *diff_ptr = output;
|
||||
int r, c, b;
|
||||
int i;
|
||||
unsigned char *origdest = dest;
|
||||
unsigned char *origpred = pred;
|
||||
unsigned char *dest, int pitch, int stride) { // , MACROBLOCKD *xd, short blk_idx
|
||||
short output[64];
|
||||
short *diff_ptr = output;
|
||||
int r, c, b;
|
||||
int i;
|
||||
unsigned char *origdest = dest;
|
||||
unsigned char *origpred = pred;
|
||||
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input 8x8\n");
|
||||
for (j=0;j<64;j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j%8 == 7) printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input 8x8\n");
|
||||
for (j = 0; j < 64; j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j % 8 == 7) printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
input[0]= input[0] * dq[0];
|
||||
input[0] = input[0] * dq[0];
|
||||
|
||||
// recover quantizer for 4 4x4 blocks
|
||||
for (i = 1; i < 64; i++)
|
||||
{
|
||||
input[i]=input[i] * dq[1];
|
||||
}
|
||||
// recover quantizer for 4 4x4 blocks
|
||||
for (i = 1; i < 64; i++) {
|
||||
input[i] = input[i] * dq[1];
|
||||
}
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input DQ 8x8\n");
|
||||
for (j=0;j<64;j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j%8 == 7) printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input DQ 8x8\n");
|
||||
for (j = 0; j < 64; j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j % 8 == 7) printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// the idct halves ( >> 1) the pitch
|
||||
vp8_short_idct8x8_c(input, output, 16);
|
||||
// the idct halves ( >> 1) the pitch
|
||||
vp8_short_idct8x8_c(input, output, 16);
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Output 8x8\n");
|
||||
for (j=0;j<64;j++) {
|
||||
printf("%d ", output[j]);
|
||||
if (j%8 == 7) printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Output 8x8\n");
|
||||
for (j = 0; j < 64; j++) {
|
||||
printf("%d ", output[j]);
|
||||
if (j % 8 == 7) printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vpx_memset(input, 0, 128);// test what should i put here
|
||||
vpx_memset(input, 0, 128);// test what should i put here
|
||||
|
||||
for (b = 0; b < 4; b++)
|
||||
{
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
for (b = 0; b < 4; b++) {
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 8;
|
||||
pred += pitch;
|
||||
}
|
||||
diff_ptr = output + (b+1) / 2 * 4 * 8 + (b+1) % 2 * 4;
|
||||
dest = origdest + (b+1) / 2 * 4 * stride + (b+1) % 2 * 4;
|
||||
pred = origpred + (b+1) / 2 * 4 * pitch + (b+1) % 2 * 4;
|
||||
}
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int k,j;
|
||||
printf("Final 8x8\n");
|
||||
for (j=0;j<8;j++) {
|
||||
for (k=0;k<8;k++) {
|
||||
printf("%d ", origdest[k]);
|
||||
}
|
||||
printf("\n");
|
||||
origdest+=stride;
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 8;
|
||||
pred += pitch;
|
||||
}
|
||||
diff_ptr = output + (b + 1) / 2 * 4 * 8 + (b + 1) % 2 * 4;
|
||||
dest = origdest + (b + 1) / 2 * 4 * stride + (b + 1) % 2 * 4;
|
||||
pred = origpred + (b + 1) / 2 * 4 * pitch + (b + 1) % 2 * 4;
|
||||
}
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int k, j;
|
||||
printf("Final 8x8\n");
|
||||
for (j = 0; j < 8; j++) {
|
||||
for (k = 0; k < 8; k++) {
|
||||
printf("%d ", origdest[k]);
|
||||
}
|
||||
printf("\n");
|
||||
origdest += stride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp8_dequant_dc_idct_add_8x8_c(short *input, short *dq, unsigned char *pred,
|
||||
unsigned char *dest, int pitch, int stride,
|
||||
int Dc)// Dc for 1st order T in some rear case
|
||||
{
|
||||
short output[64];
|
||||
short *diff_ptr = output;
|
||||
int r, c, b;
|
||||
int i;
|
||||
unsigned char *origdest = dest;
|
||||
unsigned char *origpred = pred;
|
||||
unsigned char *dest, int pitch, int stride,
|
||||
int Dc) { // Dc for 1st order T in some rear case
|
||||
short output[64];
|
||||
short *diff_ptr = output;
|
||||
int r, c, b;
|
||||
int i;
|
||||
unsigned char *origdest = dest;
|
||||
unsigned char *origpred = pred;
|
||||
|
||||
input[0] = (short)Dc;//Dc is the reconstructed value, do not need dequantization
|
||||
//dc value is recovered after dequantization, since dc need not quantization
|
||||
input[0] = (short)Dc;// Dc is the reconstructed value, do not need dequantization
|
||||
// dc value is recovered after dequantization, since dc need not quantization
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input 8x8\n");
|
||||
for (j=0;j<64;j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j%8 == 7) printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input 8x8\n");
|
||||
for (j = 0; j < 64; j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j % 8 == 7) printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 1; i < 64; i++)
|
||||
{
|
||||
input[i]=input[i] * dq[1];
|
||||
}
|
||||
for (i = 1; i < 64; i++) {
|
||||
input[i] = input[i] * dq[1];
|
||||
}
|
||||
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input DQ 8x8\n");
|
||||
for (j=0;j<64;j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j%8 == 7) printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Input DQ 8x8\n");
|
||||
for (j = 0; j < 64; j++) {
|
||||
printf("%d ", input[j]);
|
||||
if (j % 8 == 7) printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// the idct halves ( >> 1) the pitch
|
||||
vp8_short_idct8x8_c(input, output,16);
|
||||
// the idct halves ( >> 1) the pitch
|
||||
vp8_short_idct8x8_c(input, output, 16);
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Output 8x8\n");
|
||||
for (j=0;j<64;j++) {
|
||||
printf("%d ", output[j]);
|
||||
if (j%8 == 7) printf("\n");
|
||||
}
|
||||
if (dec_debug) {
|
||||
int j;
|
||||
printf("Output 8x8\n");
|
||||
for (j = 0; j < 64; j++) {
|
||||
printf("%d ", output[j]);
|
||||
if (j % 8 == 7) printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
vpx_memset(input, 0, 128);
|
||||
vpx_memset(input, 0, 128);
|
||||
|
||||
for (b = 0; b < 4; b++)
|
||||
{
|
||||
for (r = 0; r < 4; r++)
|
||||
{
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
for (b = 0; b < 4; b++) {
|
||||
for (r = 0; r < 4; r++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
int a = diff_ptr[c] + pred[c];
|
||||
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
if (a < 0)
|
||||
a = 0;
|
||||
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 8;
|
||||
pred += pitch;
|
||||
}
|
||||
diff_ptr = output + (b+1) / 2 * 4 * 8 + (b+1) % 2 * 4;
|
||||
dest = origdest + (b+1) / 2 * 4 * stride + (b+1) % 2 * 4;
|
||||
pred = origpred + (b+1) / 2 * 4 * pitch + (b+1) % 2 * 4;
|
||||
}
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int k,j;
|
||||
printf("Final 8x8\n");
|
||||
for (j=0;j<8;j++) {
|
||||
for (k=0;k<8;k++) {
|
||||
printf("%d ", origdest[k]);
|
||||
}
|
||||
printf("\n");
|
||||
origdest+=stride;
|
||||
dest[c] = (unsigned char) a;
|
||||
}
|
||||
|
||||
dest += stride;
|
||||
diff_ptr += 8;
|
||||
pred += pitch;
|
||||
}
|
||||
diff_ptr = output + (b + 1) / 2 * 4 * 8 + (b + 1) % 2 * 4;
|
||||
dest = origdest + (b + 1) / 2 * 4 * stride + (b + 1) % 2 * 4;
|
||||
pred = origpred + (b + 1) / 2 * 4 * pitch + (b + 1) % 2 * 4;
|
||||
}
|
||||
#ifdef DEC_DEBUG
|
||||
if (dec_debug) {
|
||||
int k, j;
|
||||
printf("Final 8x8\n");
|
||||
for (j = 0; j < 8; j++) {
|
||||
for (k = 0; k < 8; k++) {
|
||||
printf("%d ", origdest[k]);
|
||||
}
|
||||
printf("\n");
|
||||
origdest += stride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -14,49 +14,49 @@
|
||||
#include "vp8/common/blockd.h"
|
||||
|
||||
#define prototype_dequant_block(sym) \
|
||||
void sym(BLOCKD *x)
|
||||
void sym(BLOCKD *x)
|
||||
|
||||
#define prototype_dequant_idct_add(sym) \
|
||||
void sym(short *input, short *dq, \
|
||||
unsigned char *pred, unsigned char *output, \
|
||||
int pitch, int stride)
|
||||
void sym(short *input, short *dq, \
|
||||
unsigned char *pred, unsigned char *output, \
|
||||
int pitch, int stride)
|
||||
|
||||
#define prototype_dequant_dc_idct_add(sym) \
|
||||
void sym(short *input, short *dq, \
|
||||
unsigned char *pred, unsigned char *output, \
|
||||
int pitch, int stride, \
|
||||
int dc)
|
||||
void sym(short *input, short *dq, \
|
||||
unsigned char *pred, unsigned char *output, \
|
||||
int pitch, int stride, \
|
||||
int dc)
|
||||
|
||||
#define prototype_dequant_dc_idct_add_y_block(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs, short *dc)
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs, short *dc)
|
||||
|
||||
#define prototype_dequant_idct_add_y_block(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs)
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs)
|
||||
|
||||
#define prototype_dequant_idct_add_uv_block(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst_u, \
|
||||
unsigned char *dst_v, int stride, char *eobs)
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst_u, \
|
||||
unsigned char *dst_v, int stride, char *eobs)
|
||||
|
||||
#define prototype_dequant_dc_idct_add_y_block_8x8(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs, short *dc, MACROBLOCKD *xd)
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs, short *dc, MACROBLOCKD *xd)
|
||||
|
||||
#define prototype_dequant_idct_add_y_block_8x8(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs, MACROBLOCKD *xd)
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst, \
|
||||
int stride, char *eobs, MACROBLOCKD *xd)
|
||||
|
||||
#define prototype_dequant_idct_add_uv_block_8x8(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst_u, \
|
||||
unsigned char *dst_v, int stride, char *eobs, \
|
||||
MACROBLOCKD *xd)
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *pre, unsigned char *dst_u, \
|
||||
unsigned char *dst_v, int stride, char *eobs, \
|
||||
MACROBLOCKD *xd)
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#include "x86/dequantize_x86.h"
|
||||
@ -154,20 +154,19 @@ typedef prototype_dequant_idct_add_y_block_8x8((*vp8_dequant_idct_add_y_block_fn
|
||||
|
||||
typedef prototype_dequant_idct_add_uv_block_8x8((*vp8_dequant_idct_add_uv_block_fn_t_8x8));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vp8_dequant_block_fn_t block;
|
||||
vp8_dequant_idct_add_fn_t idct_add;
|
||||
vp8_dequant_dc_idct_add_fn_t dc_idct_add;
|
||||
vp8_dequant_dc_idct_add_y_block_fn_t dc_idct_add_y_block;
|
||||
vp8_dequant_idct_add_y_block_fn_t idct_add_y_block;
|
||||
vp8_dequant_idct_add_uv_block_fn_t idct_add_uv_block;
|
||||
vp8_dequant_block_fn_t block_2x2;
|
||||
vp8_dequant_idct_add_fn_t idct_add_8x8;
|
||||
vp8_dequant_dc_idct_add_fn_t dc_idct_add_8x8;
|
||||
vp8_dequant_dc_idct_add_y_block_fn_t_8x8 dc_idct_add_y_block_8x8;
|
||||
vp8_dequant_idct_add_y_block_fn_t_8x8 idct_add_y_block_8x8;
|
||||
vp8_dequant_idct_add_uv_block_fn_t_8x8 idct_add_uv_block_8x8;
|
||||
typedef struct {
|
||||
vp8_dequant_block_fn_t block;
|
||||
vp8_dequant_idct_add_fn_t idct_add;
|
||||
vp8_dequant_dc_idct_add_fn_t dc_idct_add;
|
||||
vp8_dequant_dc_idct_add_y_block_fn_t dc_idct_add_y_block;
|
||||
vp8_dequant_idct_add_y_block_fn_t idct_add_y_block;
|
||||
vp8_dequant_idct_add_uv_block_fn_t idct_add_uv_block;
|
||||
vp8_dequant_block_fn_t block_2x2;
|
||||
vp8_dequant_idct_add_fn_t idct_add_8x8;
|
||||
vp8_dequant_dc_idct_add_fn_t dc_idct_add_8x8;
|
||||
vp8_dequant_dc_idct_add_y_block_fn_t_8x8 dc_idct_add_y_block_8x8;
|
||||
vp8_dequant_idct_add_y_block_fn_t_8x8 idct_add_y_block_8x8;
|
||||
vp8_dequant_idct_add_uv_block_fn_t_8x8 idct_add_uv_block_8x8;
|
||||
} vp8_dequant_rtcd_vtable_t;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user