static void sao_filter_CTB(HEVCContext *s, int x, int y) { // TODO: This should be easily parallelizable // TODO: skip CBs when (cu_transquant_bypass_flag || (pcm_loop_filter_disable_flag && pcm_flag)) int c_idx = 0; int class = 1, class_index; int edges[4]; // 0 left 1 top 2 right 3 bottom SAOParams *sao[4]; int classes[4]; int x_shift = 0, y_shift = 0; int x_ctb = x >> s->sps->log2_ctb_size; int y_ctb = y >> s->sps->log2_ctb_size; int ctb_addr_rs = y_ctb * s->sps->ctb_width + x_ctb; int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[ctb_addr_rs]; // flags indicating unfilterable edges uint8_t vert_edge[] = { 0, 0, 0, 0 }; uint8_t horiz_edge[] = { 0, 0, 0, 0 }; uint8_t diag_edge[] = { 0, 0, 0, 0 }; uint8_t lfase[3]; // current, above, left uint8_t no_tile_filter = s->pps->tiles_enabled_flag && !s->pps->loop_filter_across_tiles_enabled_flag; uint8_t left_tile_edge = 0; uint8_t up_tile_edge = 0; sao[0] = &CTB(s->sao, x_ctb, y_ctb); edges[0] = x_ctb == 0; edges[1] = y_ctb == 0; edges[2] = x_ctb == s->sps->ctb_width - 1; edges[3] = y_ctb == s->sps->ctb_height - 1; lfase[0] = CTB(s->filter_slice_edges, x_ctb, y_ctb); classes[0] = 0; if (!edges[0]) { left_tile_edge = no_tile_filter && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]]; sao[class] = &CTB(s->sao, x_ctb - 1, y_ctb); vert_edge[0] = (!lfase[0] && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb)) || left_tile_edge; vert_edge[2] = vert_edge[0]; lfase[2] = CTB(s->filter_slice_edges, x_ctb - 1, y_ctb); classes[class] = 2; class++; x_shift = 8; }
static void calculTranslation (vpMatrix &a, vpMatrix &b, int nl, int nc1, int nc3, vpColVector &x1, vpColVector &x2) { try { int i,j; vpMatrix ct(3,nl) ; for (i=0 ; i < 3 ; i++) { for (j=0 ; j < nl ; j++) ct[i][j] = b[j][i+nc3] ; } vpMatrix c ; c = ct.t() ; vpMatrix ctc ; ctc = ct*c ; vpMatrix ctc1 ; // (C^T C)^(-1) ctc1 = ctc.inverseByLU() ; vpMatrix cta ; vpMatrix ctb ; cta = ct*a ; /* C^T A */ ctb = ct*b ; /* C^T B */ if (DEBUG_LEVEL2) { std::cout <<"ctc " << std::endl << ctc ; std::cout <<"cta " << std::endl << cta ; std::cout <<"ctb " << std::endl << ctb ; } vpColVector X2(nc3) ; vpMatrix CTB(nc1,nc3) ; for (i=0 ; i < nc1 ; i++) { for (j=0 ; j < nc3 ; j++) CTB[i][j] = ctb[i][j] ; } for (j=0 ; j < nc3 ; j++) X2[j] = x2[j] ; vpColVector sv ; // C^T A X1 + C^T B X2) sv = cta*x1 + CTB*X2 ;// C^T A X1 + C^T B X2) if (DEBUG_LEVEL2) std::cout << "sv " << sv.t() ; vpColVector X3 ; /* X3 = - (C^T C )^{-1} C^T (A X1 + B X2) */ X3 = -ctc1*sv ; if (DEBUG_LEVEL2) std::cout << "x3 " << X3.t() ; for (i=0 ; i < nc1 ; i++) x2[i+nc3] = X3[i] ; } catch(...) { // en fait il y a des dizaines de raisons qui font que cette fonction // rende une erreur (matrice pas inversible, pb de memoire etc...) vpERROR_TRACE(" ") ; throw ; } }