Lines Matching refs:dc
224 int dc, val, pos; in jpg_decode_block() local
232 dc = get_vlc2(gb, c->dc_vlc[is_chroma].table, 9, 2); in jpg_decode_block()
233 if (dc < 0) in jpg_decode_block()
235 if (dc) in jpg_decode_block()
236 dc = get_xbits(gb, dc); in jpg_decode_block()
237 dc = dc * qmat[0] + c->prev_dc[plane]; in jpg_decode_block()
238 block[0] = dc; in jpg_decode_block()
239 c->prev_dc[plane] = dc; in jpg_decode_block()
479 static inline int is_pixel_on_stack(const ePICContext *dc, uint32_t pix) in is_pixel_on_stack() argument
483 for (i = 0; i < dc->stack_pos; i++) in is_pixel_on_stack()
484 if (dc->stack[i] == pix) in is_pixel_on_stack()
487 return i != dc->stack_pos; in is_pixel_on_stack()
492 static inline int epic_decode_component_pred(ePICContext *dc, in epic_decode_component_pred() argument
495 unsigned delta = ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung); in epic_decode_component_pred()
499 static uint32_t epic_decode_pixel_pred(ePICContext *dc, int x, int y, in epic_decode_pixel_pred() argument
516 G = epic_decode_component_pred(dc, GN, GW, GNW); in epic_decode_pixel_pred()
518 R = G + epic_decode_component_pred(dc, in epic_decode_pixel_pred()
523 B = G + epic_decode_component_pred(dc, in epic_decode_pixel_pred()
533 delta = ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung); in epic_decode_pixel_pred()
536 delta = ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung); in epic_decode_pixel_pred()
539 delta = ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung); in epic_decode_pixel_pred()
551 static int epic_predict_pixel(ePICContext *dc, uint8_t *rung, in epic_predict_pixel() argument
554 if (!ff_els_decode_bit(&dc->els_ctx, rung)) { in epic_predict_pixel()
558 dc->stack[dc->stack_pos++ & EPIC_PIX_STACK_MAX] = pix; in epic_predict_pixel()
562 static int epic_handle_edges(ePICContext *dc, int x, int y, in epic_handle_edges() argument
570 *pPix = (ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung) << R_shift) | in epic_handle_edges()
571 (ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung) << G_shift) | in epic_handle_edges()
572 (ff_els_decode_unsigned(&dc->els_ctx, &dc->unsigned_rung) << B_shift); in epic_handle_edges()
578 if (epic_predict_pixel(dc, &dc->W_flag_rung, pPix, pix)) in epic_handle_edges()
584 if (!dc->stack_pos || dc->stack[0] != pix) { in epic_handle_edges()
585 if (epic_predict_pixel(dc, &dc->N_flag_rung, pPix, pix)) in epic_handle_edges()
593 static int epic_decode_run_length(ePICContext *dc, int x, int y, int tile_width, in epic_decode_run_length() argument
606 if (dc->next_run_pos == x) { in epic_decode_run_length()
618 WWneW = ff_els_decode_bit(&dc->els_ctx, &dc->W_ctx_rung[idx]); in epic_decode_run_length()
624 dc->stack[dc->stack_pos++ & EPIC_PIX_STACK_MAX] = W; in epic_decode_run_length()
645 if (!is_pixel_on_stack(dc, N)) { in epic_decode_run_length()
655 if (!ff_els_decode_bit(&dc->els_ctx, &dc->N_ctx_rung[idx])) { in epic_decode_run_length()
666 if (!is_pixel_on_stack(dc, N)) in epic_decode_run_length()
667 dc->stack[dc->stack_pos++ & EPIC_PIX_STACK_MAX] = N; in epic_decode_run_length()
688 if (ff_els_decode_bit(&dc->els_ctx, &dc->prev_row_rung[idx])) in epic_decode_run_length()
695 ff_els_decode_bit(&dc->els_ctx, in epic_decode_run_length()
696 flag ? &dc->runlen_one in epic_decode_run_length()
697 : &dc->runlen_zeroes[pos])) { in epic_decode_run_length()
721 WWneW = ff_els_decode_bit(&dc->els_ctx, &dc->W_ctx_rung[idx]); in epic_decode_run_length()
724 dc->next_run_pos = x + *pRun; in epic_decode_run_length()
728 static int epic_predict_pixel2(ePICContext *dc, uint8_t *rung, in epic_predict_pixel2() argument
731 if (ff_els_decode_bit(&dc->els_ctx, rung)) { in epic_predict_pixel2()
735 dc->stack[dc->stack_pos++ & EPIC_PIX_STACK_MAX] = pix; in epic_predict_pixel2()
739 static int epic_predict_from_NW_NE(ePICContext *dc, int x, int y, int run, in epic_predict_from_NW_NE() argument
748 if (NW != curr_row[x - 1] && NW != above_row[x] && !is_pixel_on_stack(dc, NW)) { in epic_predict_from_NW_NE()
749 if (epic_predict_pixel2(dc, &dc->nw_pred_rung[NW & 0xFF], pPix, NW)) in epic_predict_from_NW_NE()
758 if (NE != above_row[pos] && !is_pixel_on_stack(dc, NE)) { in epic_predict_from_NW_NE()
759 if (epic_predict_pixel2(dc, &dc->ne_pred_rung[NE & 0xFF], pPix, NE)) in epic_predict_from_NW_NE()
767 static int epic_decode_from_cache(ePICContext *dc, uint32_t W, uint32_t *pPix) in epic_decode_from_cache() argument
770 ePICPixHashElem *hash_elem = epic_hash_find(&dc->hash, W); in epic_decode_from_cache()
777 if (!is_pixel_on_stack(dc, list->pixel)) { in epic_decode_from_cache()
778 if (ff_els_decode_bit(&dc->els_ctx, &list->rung)) { in epic_decode_from_cache()
787 dc->stack[dc->stack_pos++ & EPIC_PIX_STACK_MAX] = list->pixel; in epic_decode_from_cache()
796 static int epic_decode_tile(ePICContext *dc, uint8_t *out, int tile_height, in epic_decode_tile() argument
808 for (x = 0, dc->next_run_pos = 0; x < tile_width;) { in epic_decode_tile()
809 if (dc->els_ctx.err) in epic_decode_tile()
817 !epic_cache_entries_for_pixel(&dc->hash, pix)) { in epic_decode_tile()
818 curr_row[x] = epic_decode_pixel_pred(dc, x, y, curr_row, above_row); in epic_decode_tile()
822 dc->stack_pos = 0; // empty stack in epic_decode_tile()
826 got_pixel = epic_handle_edges(dc, x, y, curr_row, above_row, &pix); in epic_decode_tile()
828 got_pixel = epic_decode_run_length(dc, x, y, tile_width, in epic_decode_tile()
835 if (!got_pixel && !epic_predict_from_NW_NE(dc, x, y, run, in epic_decode_tile()
839 if (!x || !epic_decode_from_cache(dc, ref_pix, &pix)) { in epic_decode_tile()
840 pix = epic_decode_pixel_pred(dc, x, y, curr_row, above_row); in epic_decode_tile()
841 if (is_pixel_on_stack(dc, pix)) in epic_decode_tile()
845 int ret = epic_add_pixel_to_cache(&dc->hash, in epic_decode_tile()