// copy
ART_ACTION(action4__copy, ActorInstance_RVC_decoder__texture_V__IAP) {
  int32_t ac;
  int32_t h;
  bool_t top_edge;
  int32_t pred;
  int32_t v;
  int32_t index;
  bool_t left_edge;
  ART_ACTION_ENTER(action4__copy, 4);
  ac = pinRead_int32_t(IN0_PQF_AC);
  h = bitand(rshift(thisActor->count, 3), 7);
  top_edge = (h == 0);
  pred = ac;
  v = bitand(thisActor->count, 7);
  index = ((top_edge) ? (v):(bitor(h, 8)));
  left_edge = (v == 0);
  if ((thisActor->acpred_flag && ((thisActor->top && top_edge) || ((!(thisActor->top)) && left_edge)))) {
    if ((thisActor->s_prev_quant == thisActor->s_quant)) {
      pred = (pred + thisActor->buf[bitor(lshift(thisActor->pred_ptr, 4), index)]);
    
    } else {
      pred = (pred + RVC_decoder__texture_V__IAPdivroundnearest(thisActor, (thisActor->buf[bitor(lshift(thisActor->pred_ptr, 4), index)] * thisActor->s_prev_quant), thisActor->s_quant));
    }
  }
  if ((left_edge || top_edge)) {
    thisActor->buf[bitor(lshift(thisActor->ptr, 4), index)] = pred;
  }
  thisActor->count = (thisActor->count + 1);
  pinWrite_int32_t(OUT0_QF_AC, pred);
  ART_ACTION_EXIT(action4__copy, 4);
}
Exemple #2
0
BigNum BigNum::operator *(const BigNum& operand) const {
	std::vector<uint32_t> ret(data.size() + operand.data.size() - 1, 0);
	std::vector<uint8_t> u8ret;
	for (int i = 0; i < data.size(); i++)
		for (int j = 0; j < operand.data.size(); j++) {
			//std::cout << "j: " << j << ". operand.data.size(): " << operand.data.size() << std::endl;
			ret[i + j] += (uint16_t) data[i] * operand.data[j];
		}
	uint32_t carry(0);
	for (std::vector<uint32_t>::iterator it = ret.begin(); it != ret.end();
			it++) {
		*it += carry;
		carry = *it >> 8;
		u8ret.push_back((*it) bitand ((1 << 8) - 1));
	}
	while (carry > 0) {
		u8ret.push_back(carry bitand ((1 << 8) - 1));
		carry >>= 8;
	}

	//redudant because u8ret will be refined in BigNum construction but for sake of logical purpose
//	while(not u8ret.empty() and *u8ret.rbegin() == 0)
//		u8ret.pop_back();

	BigNum bb(0);
	bb.data = u8ret;
	bb.negative = negative xor operand.negative;
	bb.refine();
	return bb;
}
// read.intra
ART_ACTION(action5__read__intra, ActorInstance_RVC_decoder__texture_V__DCRecontruction__invpred) {
  int32_t cmd;
  int32_t qp;
  int32_t a;
  int32_t b;
  int32_t c;
  int32_t s;
  int32_t dca;
  bool_t ac;
  int32_t dcc;
  int32_t dcb;
  int32_t horiz;
  int32_t vert;
  bool_t top;
  int32_t U__5;
  ART_ACTION_ENTER(action5__read__intra, 5);
  c = pinRead_int32_t(IN3_C);
  b = pinRead_int32_t(IN2_B);
  a = pinRead_int32_t(IN1_A);
  qp = pinRead_int32_t(IN5_QP);
  cmd = pinRead_int32_t(IN0_BTYPE);
  dca = thisActor->dc_buf[a];
  ac = (bitand(cmd, ACPRED) != 0);
  dcc = thisActor->dc_buf[c];
  dcb = thisActor->dc_buf[b];
  horiz = RVC_decoder__texture_V__DCRecontruction__invpredabs(thisActor, (dcb - dcc));
  vert = RVC_decoder__texture_V__DCRecontruction__invpredabs(thisActor, (dca - dcb));
  top = (vert < horiz);
  thisActor->s_qp = qp;
  thisActor->s_prev_qp = thisActor->s_qp;
  thisActor->round = bitxor(bitand(thisActor->s_qp, 1), 1);
  thisActor->scaler = ((((thisActor->s_qp > 0) && (thisActor->s_qp < 5))) ? (8):(((((thisActor->s_qp > 4) && (thisActor->s_qp < 25))) ? (rshift((thisActor->s_qp + 13), 1)):((thisActor->s_qp - 6)))));
  thisActor->dc_pred = ((((top) ? (dcc):(dca)) + rshift(thisActor->scaler, 1)) / thisActor->scaler);
  s = (((!(ac))) ? (0):(((top) ? (2):(1))));
  thisActor->is_signed = (thisActor->scaler == 0);
  if ((s == 2)) {
    thisActor->s_prev_qp = thisActor->buf_qp[thisActor->cnt];
  }
  if (((s == 1) && (thisActor->cnt >= 1))) {
    thisActor->s_prev_qp = thisActor->buf_qp[(thisActor->cnt - 1)];
  }
  thisActor->buf_qp[thisActor->cnt] = thisActor->s_qp;
  U__5 = ((top) ? (c):(a));
  pinWrite_int32_t(OUT1_PTR, U__5);
  pinWrite_int32_t(OUT2_AC_PRED_DIR, s);
  pinWrite_bool_t(OUT3_SIGNED, thisActor->is_signed);
  pinWrite_int32_t(OUT4_QUANT, thisActor->s_qp);
  pinWrite_int32_t(OUT5_PREV_QUANT, thisActor->s_prev_qp);
  ART_ACTION_EXIT(action5__read__intra, 5);
}
    void PUT(short idx, np_t value) {
	np_t shift = idx * NPuzzle::SHIFT;
	np_t mask = NPuzzle::MASK;
	np_t zeroed = v bitand (~(mask << shift));	
	np_t shifted = value << shift;
	v = zeroed | shifted;
    }     
// read_mv
ART_ACTION(action4__read_mv, ActorInstance_RVC_decoder__motion_V__framebuf) {
  int32_t x;
  int32_t y;
  int32_t flag_x;
  int32_t flags;
  int32_t flag_y;
  ART_ACTION_ENTER(action4__read_mv, 4);
  x = pinRead_int32_t(IN0_MV);
  y = pinRead_int32_t(IN0_MV);
  flag_x = (((bitand(x, 1) == 1)) ? (4):(0));
  flags = ((lshift(bitand(x, 1), 2) + lshift(bitand(y, 1), 1)) + thisActor->vop_rounding_mode);
  flag_y = (((bitand(y, 1) == 1)) ? (2):(0));
  thisActor->mvx = rshift(x, 1);
  thisActor->mvy = rshift(y, 1);
  pinWrite_int32_t(OUT0_halfpel, flags);
  ART_ACTION_EXIT(action4__read_mv, 4);
}
// read_only
ART_ACTION(action3__read_only, ActorInstance_RVC_decoder__texture_Y__IS) {
  int32_t ac;
  ART_ACTION_ENTER(action3__read_only, 3);
  ac = pinRead_int32_t(IN1_QFS_AC);
  thisActor->buf[bitor(bitand(thisActor->count, 63), ((thisActor->half) ? (64):(0)))] = ac;
  thisActor->count = (thisActor->count + 1);
  ART_ACTION_EXIT(action3__read_only, 3);
}
bool_t RVC_decoder__texture_V__DCRecontruction__addressing__DOLLAR__d1336(art_action_context_t *context, ActorInstance_RVC_decoder__texture_V__DCRecontruction__addressing *thisActor) {
    int32_t blocktype;
    {
        bool_t ret;
        blocktype = pinPeek_int32_t(IN0_BTYPE, 0);
        ret = (bitand(blocktype, INTRA) != 0);
        return ret;
    }
}
bool_t RVC_decoder__texture_V__DCRecontruction__invpred__DOLLAR__d944(art_action_context_t *context, ActorInstance_RVC_decoder__texture_V__DCRecontruction__invpred *thisActor) {
  int32_t cmd;
  {
    bool_t ret;
    cmd = pinPeek_int32_t(IN0_BTYPE, 0);
    ret = (bitand(cmd, INTRA) == 0);
    return ret;
  }
}
// cmd.newVop
ART_ACTION(action0__cmd__newVop, ActorInstance_RVC_decoder__motion_V__framebuf) {
  int32_t cmd;
  int32_t round;
  ART_ACTION_ENTER(action0__cmd__newVop, 0);
  cmd = pinRead_int32_t(IN1_BTYPE);
  round = (((bitand(cmd, ROUND_TYPE) != 0)) ? (1):(0));
  thisActor->vop_rounding_mode = round;
  ART_ACTION_EXIT(action0__cmd__newVop, 0);
}
bool_t RVC_decoder__motion_V__framebuf__DOLLAR__d7471(art_action_context_t *context, ActorInstance_RVC_decoder__motion_V__framebuf *thisActor) {
  int32_t cmd;
  {
    bool_t ret;
    cmd = pinPeek_int32_t(IN1_BTYPE, 0);
    ret = (bitand(cmd, MOTION) != 0);
    return ret;
  }
}
bool_t RVC_decoder__parser__splitter_MV__DOLLAR__d8623(art_action_context_t *context, ActorInstance_RVC_decoder__parser__splitter_MV *thisActor) {
  int32_t btype;
  {
    bool_t ret;
    btype = pinPeek_int32_t(IN1_BTYPE, 0);
    ret = (bitand(btype, MOTION) != 0);
    return ret;
  }
}
bool_t RVC_decoder__parser__splitter_MV__DOLLAR__d8472(art_action_context_t *context, ActorInstance_RVC_decoder__parser__splitter_MV *thisActor) {
  int32_t cmd;
  {
    bool_t ret;
    cmd = pinPeek_int32_t(IN1_BTYPE, 0);
    ret = (bitand(cmd, NEWVOP) != 0);
    return ret;
  }
}
bool_t RVC_decoder__texture_V__DCRecontruction__addressing__DOLLAR__d1306(art_action_context_t *context, ActorInstance_RVC_decoder__texture_V__DCRecontruction__addressing *thisActor) {
    int32_t cmd;
    {
        bool_t ret;
        cmd = pinPeek_int32_t(IN0_BTYPE, 0);
        ret = (bitand(cmd, NEWVOP) != 0);
        return ret;
    }
}
Exemple #14
0
BigNum BigNum::operator +(const BigNum& operand) const {
	if (negative)
		return -((-*this) + -operand);
	if (operand.negative) { //compare
		BigNum abs(operand.abs());
		if (operator==(abs))
			return BigNum(0);
		if (operator<(abs))
			return -(abs - *this);
		//do subtract here

		//we are sure here: *this > operand (strictly)
		vector<uint8_t> ret(data);
		int carry = 0;
		for (int i = 0; i < data.size(); i++) {
			if (i < operand.data.size())
				//if digit exists in b
				carry += operand.data[i];
			int tmp = (int) ret[i] - carry;
			if (tmp < 0) {
				carry = 1;
				ret[i] = tmp + (1 << 8);
			} else {
				ret[i] = tmp;
				carry = 0;
			}
		}
		//because *this > operand. carry must be 0 here
		//this refinement is redudant but just because of the sake of logic
		while (not ret.empty() and *ret.rbegin() == 0)
			ret.pop_back();
		BigNum big(0);
		big.data = ret;
		return big;
	}
	//do plus here
	vector<uint8_t> ret(data);
	int carry = 0;
	for (int i = 0; i < data.size(); i++) {
		if (i < operand.data.size())
			//if digit exists in b
			carry += operand.data[i];
		int tmp = (int) ret[i] + carry;
		carry = tmp >> 8;
		ret[i] = tmp bitand ((1 << 8) - 1);
	}
	while (carry > 0) {
		ret.push_back(carry & ((1 << 8) - 1));
		carry >>= 8;
	}
	while (not ret.empty() and *ret.rbegin() == 0)
		ret.pop_back();
	BigNum r(0);
	r.data = ret;
	return r;
}
// start
ART_ACTION(action0__start, ActorInstance_RVC_decoder__motion_Y__interpolation) {
  int32_t f;
  ART_ACTION_ENTER(action0__start, 0);
  f = pinRead_int32_t(IN1_halfpel);
  thisActor->x = 0;
  thisActor->y = 0;
  thisActor->flags = rshift(f, 1);
  thisActor->round = bitand(f, 1);
  ART_ACTION_EXIT(action0__start, 0);
}
// read_write
ART_ACTION(action5__read_write, ActorInstance_RVC_decoder__texture_Y__IS) {
  int32_t ac;
  ART_ACTION_ENTER(action5__read_write, 5);
  ac = pinRead_int32_t(IN1_QFS_AC);
  thisActor->buf[bitor(bitand(thisActor->count, 63), ((thisActor->half) ? (64):(0)))] = ac;
  thisActor->count = (thisActor->count + 1);
  thisActor->addr = (thisActor->addr + 1);
  pinWrite_int32_t(OUT0_PQF_AC, thisActor->buf[RVC_decoder__texture_Y__ISra(thisActor, Scanmode[thisActor->addr])]);
  ART_ACTION_EXIT(action5__read_write, 5);
}
Exemple #17
0
 int f() {
    if (false) {
    } else do
         return throw compl
                      sizeof true
                      xor not this
                      and new signed long int volatile
                      or false
                      bitor nullptr
                      not_eq operator unsigned const short bitand()
                      +arr, 0;
    while (false);
    return 42;
 }
void Max7219::doScrollLeft()
{
	// scroll the current char.
	word theChar = pgm_read_byte_near(m_scrollText + m_scrollIndex);
	if(theChar >= 64)
		theChar -= 64;
	word charOffset = theChar * 8;

	for(byte i = 0; i < 8; ++i) {
		scrollChar[i] <<= 1;
		boolean bitset = (pgm_read_byte_near(parallax_font + charOffset++) bitand (1 << (7 - m_currScrollPixRowCol))) not_eq 0;
		if(m_inverseScroll)
			bitset ^= true;
		scrollChar[i] or_eq bitset ? (1 << 0) : 0;
		maxSingle(i + 1, scrollChar[i]);
	}

	scrollNextPixRowCol();
} // doScrollLeft
// read.inter_ac
ART_ACTION(action3__read__inter_ac, ActorInstance_RVC_decoder__texture_V__DCRecontruction__invpred) {
  int32_t cmd;
  int32_t qp;
  int32_t U__1;
  int32_t U__2;
  bool_t U__3;
  ART_ACTION_ENTER(action3__read__inter_ac, 3);
  qp = pinRead_int32_t(IN5_QP);
  cmd = pinRead_int32_t(IN0_BTYPE);
  thisActor->s_qp = qp;
  thisActor->round = bitxor(bitand(thisActor->s_qp, 1), 1);
  thisActor->is_signed = 1;
  thisActor->s_prev_qp = thisActor->s_qp;
  thisActor->buf_qp[thisActor->cnt] = thisActor->s_qp;
  U__1 = 0;
  pinWrite_int32_t(OUT2_AC_PRED_DIR, U__1);
  U__2 = 0;
  pinWrite_int32_t(OUT1_PTR, U__2);
  U__3 = 1;
  pinWrite_bool_t(OUT3_SIGNED, U__3);
  pinWrite_int32_t(OUT4_QUANT, thisActor->s_qp);
  pinWrite_int32_t(OUT5_PREV_QUANT, thisActor->s_prev_qp);
  ART_ACTION_EXIT(action3__read__inter_ac, 3);
}
//Actor functions
static inline int32_t RVC_decoder__texture_Y__ISwa(ActorInstance_RVC_decoder__texture_Y__IS* thisActor){
  return bitor(bitand(thisActor->count, 63), ((thisActor->half) ? (64):(0)));
}
static inline int32_t RVC_decoder__texture_Y__ISra(ActorInstance_RVC_decoder__texture_Y__IS* thisActor, int32_t address){
  return bitor(bitand(address, 63), ((thisActor->half) ? (0):(64)));
}
Exemple #22
0
 int foo() {
     int arr[1];
     return throw compl sizeof true xor not this and new signed long int volatile or false bitor nullptr not_eq operator unsigned const short bitand() +arr, 0;
 }
// read_fb
ART_ACTION(action6__read_fb, ActorInstance_RVC_decoder__motion_V__framebuf) {
  int32_t clip_right;
  int32_t end_i;
  int32_t i;
  int32_t clip_left;
  int32_t temp;
  int32_t y;
  int32_t clip_y;
  int32_t x;
  int32_t clip_x;
  int32_t addr;
  int32_t start_of_row;
  int32_t* rd;
  ART_ACTION_ENTER(action6__read_fb, 6);
  rd = malloc((sizeof(int32_t) * 81));
  clip_right = 0;
  clip_left = 0;
  y = (((thisActor->mby_read * 8) + (8 * rshift(thisActor->comp_read, 1))) + thisActor->mvy);
  clip_y = (((y < 0)) ? (0):((((y < thisActor->vop_height_in_samples)) ? (y):((thisActor->vop_height_in_samples - 1)))));
  x = (((thisActor->mbx_read * 8) + (8 * bitand(thisActor->comp_read, 1))) + thisActor->mvx);
  clip_x = x;
  {
    int32_t k;
    for(k = 1; k <= 81; k++)
    {
      rd[((0 + k) - 1)] = 0;
    }
  }
  if ((x < 0)) {
    clip_x = 0;
    clip_left = (((x < (-(9)))) ? (9):((-(x))));
  
  } else {
    if (((x + 9) > thisActor->vop_width_in_samples)) {
      if ((x >= thisActor->vop_width_in_samples)) {
        clip_x = (thisActor->vop_width_in_samples - 1);
        clip_right = 8;
      
      } else {
        clip_right = ((x + 9) - thisActor->vop_width_in_samples);
      }
    }
  }
  start_of_row = ((thisActor->start_of_prev_frame + (clip_y * 1936)) + clip_x);
  if ((start_of_row >= 2199296)) {
    start_of_row = (start_of_row - 2199296);
  }
  i = 0;
  while ((i < 81)) {
    if ((clip_left != 0)) {
      end_i = (i + clip_left);
      temp = thisActor->frameBuffer[start_of_row];
      while ((i < end_i)) {
        rd[i] = temp;
        i = (i + 1);
      }
    }
    addr = start_of_row;
    end_i = (((i + 9) - clip_left) - clip_right);
    while ((i < end_i)) {
      rd[i] = thisActor->frameBuffer[addr];
      i = (i + 1);
      addr = (addr + 1);
    }
    if ((clip_right != 0)) {
      end_i = (i + clip_right);
      temp = thisActor->frameBuffer[(addr - 1)];
      while ((i < end_i)) {
        rd[i] = temp;
        i = (i + 1);
      }
    }
    y = (y + 1);
    if (((y > 0) && (y < thisActor->vop_height_in_samples))) {
      start_of_row = (start_of_row + 1936);
      if ((start_of_row >= 2199296)) {
        start_of_row = (start_of_row - 2199296);
      }
    }
  }
  RVC_decoder__motion_V__framebufadvance_block(thisActor);
  pinWriteRepeat_int32_t(OUT1_RD, rd, 81);
  free((void*) rd);
  ART_ACTION_EXIT(action6__read_fb, 6);
}