Ejemplo n.º 1
0
        public unsafe static void vp8_loop_filter_row_simple(VP8_COMMON cm, ArrPtr <MODE_INFO> mode_info_context,
                                                             int mb_row, int post_ystride,
                                                             byte *y_ptr)
        {
            int mb_col;
            int filter_level;
            loop_filter_info_n lfi_n = cm.lf_info;

            for (mb_col = 0; mb_col < cm.mb_cols; ++mb_col)
            {
                int skip_lf = (mode_info_context.get().mbmi.mode != (int)MB_PREDICTION_MODE.B_PRED &&
                               mode_info_context.get().mbmi.mode != (int)MB_PREDICTION_MODE.SPLITMV &&
                               mode_info_context.get().mbmi.mb_skip_coeff > 0) ? 1 : 0;

                int mode_index = lfi_n.mode_lf_lut[mode_info_context.get().mbmi.mode];
                int seg        = mode_info_context.get().mbmi.segment_id;
                int ref_frame  = mode_info_context.get().mbmi.ref_frame;

                filter_level = lfi_n.lvl[seg, ref_frame, mode_index];

                if (filter_level > 0)
                {
                    if (mb_col > 0)
                    {
                        //vp8_rtcd.vp8_loop_filter_simple_mbv(y_ptr, post_ystride, lfi_n.mblim[filter_level]);
                        fixed(byte *pMBlim = lfi_n.mblim)
                        {
                            int step = filter_level * lfi_n.mblim.GetLength(1);

                            vp8_rtcd.vp8_loop_filter_simple_mbv(y_ptr, post_ystride, pMBlim + step);
                        }
                    }

                    if (skip_lf == 0)
                    {
                        //vp8_rtcd.vp8_loop_filter_simple_bv(y_ptr, post_ystride, lfi_n.blim[filter_level]);
                        fixed(byte *pBlim = lfi_n.blim)
                        {
                            int step = lfi_n.blim.GetLength(1) * filter_level;

                            vp8_rtcd.vp8_loop_filter_simple_bv(y_ptr, post_ystride, pBlim + step);
                        }
                    }

                    /* don't apply across umv border */
                    if (mb_row > 0)
                    {
                        //vp8_rtcd.vp8_loop_filter_simple_mbh(y_ptr, post_ystride, lfi_n.mblim[filter_level]);
                        fixed(byte *pMBlim = lfi_n.mblim)
                        {
                            int step = lfi_n.mblim.GetLength(1) * filter_level;

                            vp8_rtcd.vp8_loop_filter_simple_mbh(y_ptr, post_ystride, pMBlim + step);
                        }
                    }

                    if (skip_lf == 0)
                    {
                        //vp8_rtcd.vp8_loop_filter_simple_bh(y_ptr, post_ystride, lfi_n.blim[filter_level]);
                        fixed(byte *pBlim = lfi_n.blim)
                        {
                            int step = lfi_n.blim.GetLength(1) * filter_level;

                            vp8_rtcd.vp8_loop_filter_simple_bh(y_ptr, post_ystride, pBlim + step);
                        }
                    }
                }

                y_ptr += 16;

                mode_info_context++; /* step to next MB */
            }
        }
Ejemplo n.º 2
0
        public unsafe static void vp8_loop_filter_row_normal(VP8_COMMON cm, ArrPtr <MODE_INFO> mode_info_context,
                                                             int mb_row, int post_ystride, int post_uvstride,
                                                             byte *y_ptr, byte *u_ptr,
                                                             byte *v_ptr)
        {
            int mb_col;
            int filter_level;
            loop_filter_info_n lfi_n      = cm.lf_info;
            loop_filter_info   lfi        = new loop_filter_info();
            FRAME_TYPE         frame_type = cm.frame_type;

            for (mb_col = 0; mb_col < cm.mb_cols; ++mb_col)
            {
                int skip_lf = (mode_info_context.get().mbmi.mode != (int)MB_PREDICTION_MODE.B_PRED &&
                               mode_info_context.get().mbmi.mode != (int)MB_PREDICTION_MODE.SPLITMV &&
                               mode_info_context.get().mbmi.mb_skip_coeff > 0) ? 1 : 0;

                int mode_index = lfi_n.mode_lf_lut[mode_info_context.get().mbmi.mode];
                int seg        = mode_info_context.get().mbmi.segment_id;
                int ref_frame  = mode_info_context.get().mbmi.ref_frame;

                filter_level = lfi_n.lvl[seg, ref_frame, mode_index];

                if (filter_level > 0)
                {
                    int hev_index = lfi_n.hev_thr_lut[(int)frame_type, filter_level];

                    //lfi.mblim = lfi_n.mblim[filter_level];
                    //lfi.blim = lfi_n.blim[filter_level];
                    //lfi.lim = lfi_n.lim[filter_level];
                    //lfi.hev_thr = lfi_n.hev_thr[hev_index];

                    fixed(byte *pMblin = lfi_n.mblim, pBlim = lfi_n.blim, pLim = lfi_n.lim, pHev_thr = lfi_n.hev_thr)
                    {
                        lfi.mblim   = pMblin + lfi_n.mblim.GetLength(1) * filter_level;
                        lfi.blim    = pBlim + lfi_n.blim.GetLength(1) * filter_level;
                        lfi.lim     = pLim + lfi_n.lim.GetLength(1) * filter_level;
                        lfi.hev_thr = pHev_thr + lfi_n.hev_thr.GetLength(1) * hev_index;

                        if (mb_col > 0)
                        {
                            vp8_rtcd.vp8_loop_filter_mbv(y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, lfi);
                        }

                        if (skip_lf == 0)
                        {
                            vp8_rtcd.vp8_loop_filter_bv(y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, lfi);
                        }

                        /* don't apply across umv border */
                        if (mb_row > 0)
                        {
                            vp8_rtcd.vp8_loop_filter_mbh(y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, lfi);
                        }

                        if (skip_lf == 0)
                        {
                            vp8_rtcd.vp8_loop_filter_bh(y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, lfi);
                        }
                    }
                }

                y_ptr += 16;
                u_ptr += 8;
                v_ptr += 8;

                mode_info_context++; /* step to next MB */
            }
        }