static void od_decode_mv(daala_dec_ctx *dec, od_mv_grid_pt *mvg, int vx, int vy, int level, int mv_res, int width, int height) { generic_encoder *model; int pred[2]; int ox; int oy; int id; int equal_mvs; equal_mvs = od_state_get_predictor(&dec->state, pred, vx, vy, level, mv_res); model = &dec->state.adapt.mv_model; id = od_decode_cdf_adapt(&dec->ec, dec->state.adapt.mv_small_cdf[equal_mvs], 16, dec->state.adapt.mv_small_increment); oy = id >> 2; ox = id & 0x3; if (ox == 3) { ox += generic_decode(&dec->ec, model, width << (3 - mv_res), &dec->state.adapt.mv_ex[level], 6); } if (oy == 3) { oy += generic_decode(&dec->ec, model, height << (3 - mv_res), &dec->state.adapt.mv_ey[level], 6); } if (ox && od_ec_dec_bits(&dec->ec, 1)) ox = -ox; if (oy && od_ec_dec_bits(&dec->ec, 1)) oy = -oy; mvg->mv[0] = (pred[0] + ox) << mv_res; mvg->mv[1] = (pred[1] + oy) << mv_res; }
static void arcadia_init(running_machine &machine) { arcadia_amiga_state *state = machine.driver_data<arcadia_amiga_state>(); static const amiga_machine_interface arcadia_intf = { ANGUS_CHIP_RAM_MASK, NULL, NULL, NULL, NULL, NULL, arcadia_reset_coins, NULL, 0 }; UINT16 *biosrom; /* configure our Amiga setup */ amiga_machine_config(machine, &arcadia_intf); /* set up memory */ state->membank("bank1")->configure_entry(0, state->m_chip_ram); state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base()); /* OnePlay bios is encrypted, TenPlay is not */ biosrom = (UINT16 *)machine.root_device().memregion("user2")->base(); if (biosrom[0] != 0x4afc) generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7); }
static void arcadia_init(void) { static const amiga_machine_interface arcadia_intf = { ANGUS_CHIP_RAM_MASK, arcadia_cia_0_porta_r, arcadia_cia_0_portb_r, arcadia_cia_0_porta_w, arcadia_cia_0_portb_w, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, arcadia_reset_coins }; UINT16 *biosrom; /* configure our Amiga setup */ amiga_machine_config(&arcadia_intf); /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram, 0); memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0); /* OnePlay bios is encrypted, TenPlay is not */ biosrom = (UINT16 *)memory_region(REGION_USER2); if (biosrom[0] != 0x4afc) generic_decode(REGION_USER2, 6, 1, 0, 2, 3, 4, 5, 7); /* request notifications when the coins change */ input_port_set_changed_callback(port_tag_to_index("COINS"), 0x01, coin_changed_callback, &coin_counter[0]); input_port_set_changed_callback(port_tag_to_index("COINS"), 0x02, coin_changed_callback, &coin_counter[1]); }
void arcadia_amiga_state::arcadia_init() { static const amiga_machine_interface arcadia_intf = { ANGUS_CHIP_RAM_MASK, NULL, NULL, NULL, NULL, NULL, arcadia_reset_coins, NULL, 0 }; UINT16 *biosrom; /* configure our Amiga setup */ amiga_machine_config(machine(), &arcadia_intf); /* set up memory */ m_bank1->configure_entry(0, m_chip_ram); m_bank1->configure_entry(1, memregion("user1")->base()); /* OnePlay bios is encrypted, TenPlay is not */ biosrom = (UINT16 *)memregion("user2")->base(); if (biosrom[0] != 0x4afc) generic_decode("user2", 6, 1, 0, 2, 3, 4, 5, 7); }
static void arcadia_init(running_machine *machine) { static const amiga_machine_interface arcadia_intf = { ANGUS_CHIP_RAM_MASK, NULL, NULL, NULL, NULL, NULL, NULL, NULL, arcadia_reset_coins, NULL, 0 }; UINT16 *biosrom; /* configure our Amiga setup */ amiga_machine_config(machine, &arcadia_intf); /* set up memory */ memory_configure_bank(machine, "bank1", 0, 1, amiga_chip_ram, 0); memory_configure_bank(machine, "bank1", 1, 1, memory_region(machine, "user1"), 0); /* OnePlay bios is encrypted, TenPlay is not */ biosrom = (UINT16 *)memory_region(machine, "user2"); if (biosrom[0] != 0x4afc) generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7); }
static DRIVER_INIT( ninj ) { arcadia_init(machine); generic_decode(machine, "user3", 1, 6, 5, 7, 4, 2, 0, 3); }
static DRIVER_INIT( dart ) { arcadia_init(machine); generic_decode(machine, "user3", 4, 0, 7, 6, 3, 1, 2, 5); }
static DRIVER_INIT( ldrba ) { arcadia_init(machine); generic_decode(machine, "user3", 2, 3, 4, 1, 0, 7, 5, 6); }
static DRIVER_INIT( airh ) { arcadia_init(machine); generic_decode(machine, "user3", 5, 0, 2, 4, 7, 6, 1, 3); }
static DRIVER_INIT( bowl ) { arcadia_init(machine); generic_decode(machine, "user3", 7, 6, 0, 1, 2, 3, 4, 5); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,dart) { arcadia_init(machine()); generic_decode(machine(), "user3", 4, 0, 7, 6, 3, 1, 2, 5); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,airh) { arcadia_init(machine()); generic_decode(machine(), "user3", 5, 0, 2, 4, 7, 6, 1, 3); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,xeon) { arcadia_init(machine()); generic_decode(machine(), "user3", 3, 1, 2, 4, 0, 5, 6, 7); }
static DRIVER_INIT( socc ) { arcadia_init(machine); generic_decode(machine, "user3", 0, 7, 1, 6, 5, 4, 3, 2); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,socc) { arcadia_init(machine()); generic_decode(machine(), "user3", 0, 7, 1, 6, 5, 4, 3, 2); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,sprg) { arcadia_init(machine()); generic_decode(machine(), "user3", 4, 7, 3, 0, 6, 5, 2, 1); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,sdwr) { arcadia_init(machine()); generic_decode(machine(), "user3", 6, 3, 4, 5, 2, 1, 0, 7); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,ninj) { arcadia_init(machine()); generic_decode(machine(), "user3", 1, 6, 5, 7, 4, 2, 0, 3); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,ldrba) { arcadia_init(machine()); generic_decode(machine(), "user3", 2, 3, 4, 1, 0, 7, 5, 6); }
static DRIVER_INIT( rdwr ) { arcadia_init(machine); generic_decode(machine, "user3", 3, 1, 6, 4, 0, 5, 2, 7); }
static DRIVER_INIT( xeon ) { arcadia_init(machine); generic_decode(machine, "user3", 3, 1, 2, 4, 0, 5, 6, 7); }
static DRIVER_INIT( sdwr ) { arcadia_init(machine); generic_decode(machine, "user3", 6, 3, 4, 5, 2, 1, 0, 7); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,bowl) { arcadia_init(machine()); generic_decode(machine(), "user3", 7, 6, 0, 1, 2, 3, 4, 5); }
static DRIVER_INIT( sprg ) { arcadia_init(machine); generic_decode(machine, "user3", 4, 7, 3, 0, 6, 5, 2, 1); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,ldrb) { arcadia_init(); generic_decode("user3", 2, 3, 4, 1, 0, 7, 5, 6); }
/** Decodes a single vector of integers (eg, a partition within a * coefficient block) encoded using PVQ * * @param [in,out] ec range encoder * @param [in] q scale/quantizer * @param [in] n number of coefficients in partition * @param [in,out] model entropy decoder state * @param [in,out] adapt adaptation context * @param [in,out] exg ExQ16 expectation of decoded gain value * @param [in,out] ext ExQ16 expectation of decoded theta value * @param [in] ref 'reference' (prediction) vector * @param [out] out decoded partition * @param [in] noref boolean indicating absence of reference * @param [in,out] mask_gain input masking from other bands, output masking for * other bands * @param [in] beta per-band activity masking beta param * @param [in] is_keyframe whether we're encoding a keyframe */ static void pvq_decode_partition(od_ec_dec *ec, int q0, int n, generic_encoder model[3], int *adapt, int *exg, int *ext, od_coeff *ref, od_coeff *out, int noref, double *mask_gain, double beta, int is_keyframe) { int adapt_curr[OD_NSB_ADAPT_CTXS] = {0}; int speed; int k; double qcg; int max_theta; int itheta; double theta; double gr; double gain_offset; od_coeff y[1024]; double r[1024]; int qg; double q; double mask_ratio; /* Quantization step calibration to account for the activity masking. */ q = q0*pow(256<<OD_COEFF_SHIFT, 1./beta - 1); speed = 5; theta = 0; gr = 0; gain_offset = 0; /* read quantized gain */ qg = generic_decode(ec, &model[!noref], -1, exg, 2); if(!noref){ /* we have a reference; compute its gain */ double cgr; int icgr; int i; cgr = pvq_compute_gain(ref, n, q, &gr, beta); icgr = floor(.5+cgr); /* quantized gain is interleave encoded when there's a reference; deinterleave it now */ qg = neg_deinterleave(qg, icgr); gain_offset = cgr-icgr; qcg = qg + gain_offset; mask_ratio = pvq_interband_masking(*mask_gain, pow(q*qcg, 2*beta), beta); /* read and decode first-stage PVQ error theta */ max_theta = pvq_compute_max_theta(mask_ratio*qcg, beta); if (max_theta > 1) { if (is_keyframe) { int tmp; tmp = max_theta**ext; itheta = generic_decode(ec, &model[2], max_theta-1, &tmp, 2); /* Adapt expectation as fraction of max_theta */ *ext += (itheta*65536/max_theta - *ext) >> 5; } else itheta = generic_decode(ec, &model[2], max_theta - 1, ext, 2); }
DRIVER_INIT_MEMBER(arcadia_amiga_state,rdwr) { arcadia_init(); generic_decode("user3", 3, 1, 6, 4, 0, 5, 2, 7); }