亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? inter.c

?? 經過開源的H.264壓縮算法代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*****************************************************************************
 *
 *  T264 AVC CODEC
 *
 *  Copyright(C) 2004-2005 llcc <lcgate1@yahoo.com.cn>
 *               2004-2005 visionany <visionany@yahoo.com.cn>
 *
 *  This program is free software ; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation ; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program ; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 ****************************************************************************/
#include "portab.h"
#include "stdio.h"

#include "memory.h"

#include "T264.h"
#include "inter.h"
#include "intra.h"
#include "estimation.h"
#include "utility.h"
#include "interpolate.h"
#include "bitstream.h"

//#define USE_PREV_DETECT

uint32_t
T264_predict_sad(T264_t* t, int32_t list)
{
    return T264_median(t->mb.sad_ref[0], t->mb.sad_ref[1], t->mb.sad_ref[2]);
}

void
T264_predict_mv(T264_t* t, int32_t list, int32_t i, int32_t width, T264_vector_t* vec)
{
    int32_t n;
    int32_t count = 0;
    int32_t idx;
    int32_t row;
    int32_t col;
    int32_t org;
    T264_vector_t vec_n[3];

    n = vec->refno;
    org = i;
    i = luma_index[i];

    col = org % 4;
    row = org / 4;

    vec_n[0] = t->mb.vec_ref[VEC_LUMA - 1 + row * 8 + col].vec[list];
    vec_n[1] = t->mb.vec_ref[VEC_LUMA - 8 + row * 8 + col].vec[list];
    vec_n[2] = t->mb.vec_ref[VEC_LUMA - 8 + row * 8 + col + width].vec[list];
    if (vec_n[2].refno == -2)
    {
        vec_n[2] = t->mb.vec_ref[VEC_LUMA - 8 + row * 8 + col - 1].vec[list];
    }
    if (((i & 3) == 3) || ((i & 3) == 2 && width == 2))
    {
        vec_n[2] = t->mb.vec_ref[VEC_LUMA - 8 + row * 8 + col - 1].vec[list];
    }
    if (t->mb.mb_part == MB_16x8)
    {
        if (i == 0 && n == vec_n[1].refno)
        {
            vec[0].x = vec_n[1].x;
            vec[0].y = vec_n[1].y;
            return;
        }
        else if (i != 0 && n == vec_n[0].refno)
        {
            vec[0].x = vec_n[0].x;
            vec[0].y = vec_n[0].y;
            return;
        }
    }
    else if (t->mb.mb_part == MB_8x16)
    {
        if (i == 0 && n == vec_n[0].refno)
        {
            vec[0].x = vec_n[0].x;
            vec[0].y = vec_n[0].y;
            return;
        }
        else if (i != 0 && n == vec_n[2].refno)
        {
            vec[0].x = vec_n[2].x;
            vec[0].y = vec_n[2].y;
            return;
        }
    }

    if (vec_n[0].refno == n)
    {
        count ++;
        idx = 0;
    }
    if (vec_n[1].refno == n)
    {
        count ++;
        idx = 1;
    }
    if (vec_n[2].refno == n)
    {
        count ++;
        idx = 2;
    }

    if (count > 1)
    {
        vec[0].x = T264_median(vec_n[0].x, vec_n[1].x, vec_n[2].x);
        vec[0].y = T264_median(vec_n[0].y, vec_n[1].y, vec_n[2].y);
        return;
    }
    else if (count == 1)
    {
        vec[0].x = vec_n[idx].x;
        vec[0].y = vec_n[idx].y;
        return;
    }
    else if (vec_n[1].refno == -2 && vec_n[2].refno == -2 && vec_n[0].refno != -2)
    {
        vec[0].x = vec_n[0].x;
        vec[0].y = vec_n[0].y;
    }
    else
    {
        vec[0].x = T264_median(vec_n[0].x, vec_n[1].x, vec_n[2].x);
        vec[0].y = T264_median(vec_n[0].y, vec_n[1].y, vec_n[2].y);
        return;        
    }
}

void
T264_predict_mv_skip(T264_t* t, int32_t list, T264_vector_t* vec)
{
    T264_vector_t vec_n[2];
    int32_t zero_left, zero_top;

    vec_n[0] = t->mb.vec_ref[VEC_LUMA - 1].vec[0];
    vec_n[1] = t->mb.vec_ref[VEC_LUMA - 8].vec[0];
    vec[0].refno = 0;

    zero_left = vec_n[0].refno == -2 ? 1 : vec_n[0].refno == 0 && vec_n[0].x == 0 && vec_n[0].y == 0 ? 1 : 0;
    zero_top  = vec_n[1].refno == -2 ? 1 : vec_n[1].refno == 0 && vec_n[1].x == 0 && vec_n[1].y == 0 ? 1 : 0;

    if (zero_left || zero_top)
    {
        vec[0].x = vec[0].y = 0;
    }
    else
    {
        T264_predict_mv(t, 0, 0, 4, vec);
    }
}

int32_t 
T264_median(int32_t x, int32_t y, int32_t z)
{
    int32_t min, max;
    if (x < y)
    {
        min = x;
        max = y;
    }
    else
    {
        min = y;
        max = x;
    }

    if (z < min)
    {
        min = z;
    }
    else if (z > max)
    {
        max = z;
    }

    return x + y + z - min - max;
}

void
copy_nvec(T264_vector_t* src, T264_vector_t* dst, int32_t width, int32_t height, int32_t stride)
{
    int32_t i, j;

    for(i = 0 ; i < height ; i ++)
    {
        for(j = 0 ; j < width ; j ++)
        {
            dst[j] = src[0];
        }
        dst += stride;
    }
}

void
T264_inter_p16x16_mode_available(T264_t* t, int32_t preds[], int32_t* modes)
{
    if (t->flags & USE_FORCEBLOCKSIZE)
    {
        *modes = 0;
      
        preds[(*modes) ++] = MB_16x16;

        if (t->param.block_size & SEARCH_16x8P)
            preds[(*modes) ++] = MB_16x8;
        if (t->param.block_size & SEARCH_8x16P)
            preds[(*modes) ++] = MB_8x16;

        return ;
    }

    if ((t->mb.mb_neighbour & (MB_LEFT | MB_TOP)) == (MB_LEFT | MB_TOP))
    {
        *modes = 0;

        preds[(*modes) ++] = MB_16x16;
        if (t->mb.vec_ref[VEC_LUMA - 1].part == MB_16x8)
        {
            preds[(*modes) ++] = MB_16x8;
        }
        if (t->mb.vec_ref[VEC_LUMA - 8].part == MB_8x16)
        {
            preds[(*modes) ++] = MB_8x16;
        }
    }
    else
    {
        // try all
        preds[0] = MB_16x16;
        preds[1] = MB_16x8;
        preds[2] = MB_8x16;
        *modes = 3;
    }
}

void
T264_inter_p8x8_mode_available(T264_t* t, int32_t preds[], int32_t* modes, int32_t sub_no)
{
    static const int32_t neighbour[] = 
    {
        0, MB_LEFT, MB_TOP, MB_LEFT| MB_TOP
    };

    int32_t mb_neighbour = t->mb.mb_neighbour| neighbour[sub_no];

    if (t->flags & USE_FORCEBLOCKSIZE)
    {
        *modes = 0;

        if (t->param.block_size & SEARCH_8x8P)
            preds[(*modes) ++] = MB_8x8;
        if (t->param.block_size & SEARCH_8x4P)
            preds[(*modes) ++] = MB_8x4;
        if (t->param.block_size & SEARCH_4x8P)
            preds[(*modes) ++] = MB_4x8;
        if (t->param.block_size & SEARCH_4x4P)
            preds[(*modes) ++] = MB_4x4;

        return ;
    }

    if ((mb_neighbour & (MB_LEFT | MB_TOP)) == (MB_LEFT | MB_TOP))
    {
        *modes = 0;

        preds[*modes ++] = MB_8x8;
        if (t->mb.vec_ref[VEC_LUMA - 8 + sub_no / 2 * 16 + sub_no % 2 * 4].part == MB_8x4)
        {
            preds[*modes ++] = MB_8x4;
        }
        if (t->mb.vec_ref[VEC_LUMA - 1 + sub_no / 2 * 16 + sub_no % 2 * 4].part == MB_4x8)
        {
            preds[*modes ++] = MB_4x8;
        }
        if (t->mb.vec_ref[VEC_LUMA - 8 + sub_no / 2 * 16 + sub_no % 2 * 4].part == MB_4x4 || 
            t->mb.vec_ref[VEC_LUMA - 1 + sub_no / 2 * 16 + sub_no % 2 * 4].part == MB_4x4)
        {
            preds[*modes ++] = MB_4x4;
        }
    }
    else
    {
        // try all
        preds[0] = MB_8x8;
        preds[1] = MB_8x4;
        preds[2] = MB_4x8;
        preds[3] = MB_4x4;
        *modes = 4;
    }
}

int32_t
T264_get_pos_sad(T264_t* t, uint8_t* ref, T264_vector_t* vec)
{
    uint8_t* tmp;
    int32_t x, y;
    int32_t list_index = 0;
    uint32_t sad;

    static const int8_t index[4][4][6] = 
    {
        {{0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0}, {1, 0, 0, 0, 1, 0}},
        {{0, 2, 0, 0, 0, 0}, {1, 2, 0, 0, 0, 0}, {1, 3, 0, 0, 0, 0}, {1, 2, 0, 0, 1, 0}},
        {{2, 2, 0, 0, 0, 0}, {2, 3, 0, 0, 0, 0}, {3, 3, 0, 0, 0, 0}, {3, 2, 0, 0, 1, 0}},
        {{2, 0, 0, 0, 0, 1}, {2, 1, 0, 0, 0, 1}, {3, 1, 0, 0, 0, 1}, {1, 2, 0, 1, 1, 0}}
    };

    // need subpel
    if ((t->flags & (USE_QUARTPEL)) == (USE_QUARTPEL))
    {
        x = (vec->x & 3);
        y = (vec->y & 3);

        if (index[y][x][0] == index[y][x][1])
        {
            tmp = t->ref[list_index][vec->refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec->y >> 2)) * t->edged_stride + 
                ((t->mb.mb_x << 4) + (vec->x >> 2));
            t->memcpy_stride_u(tmp, 16, 16, t->edged_stride, ref, 16);
        }
        else
        {
            t->pia[MB_16x16](t->ref[list_index][vec->refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec->y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec->x >> 2) + index[y][x][2], 
                t->ref[list_index][vec->refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec->y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec->x >> 2) + index[y][x][4],
                t->edged_stride, t->edged_stride, ref, 16);
        }

        // rc will use sad value
        sad = t->cmp[MB_16x16](t->mb.src_y, t->stride, ref, 16);

        return sad;
    }

    return -1;
}

int32_t
T264_detect_pskip(T264_t* t, uint32_t sad_t)
{
    // detect p skip has a two-step process. here try to find suitable skip mv
    //  and encode post will decide if use skip mode or not
    DECLARE_ALIGNED_MATRIX(ref, 16, 16, uint8_t, CACHE_SIZE);

    T264_vector_t vec;
    uint8_t* tmp;
    int32_t x, y;
    int32_t i, j;
    int32_t list_index = 0;

    static const int8_t index[4][4][6] = 
    {
        {{0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0}, {1, 0, 0, 0, 1, 0}},
        {{0, 2, 0, 0, 0, 0}, {1, 2, 0, 0, 0, 0}, {1, 3, 0, 0, 0, 0}, {1, 2, 0, 0, 1, 0}},
        {{2, 2, 0, 0, 0, 0}, {2, 3, 0, 0, 0, 0}, {3, 3, 0, 0, 0, 0}, {3, 2, 0, 0, 1, 0}},
        {{2, 0, 0, 0, 0, 1}, {2, 1, 0, 0, 0, 1}, {3, 1, 0, 0, 0, 1}, {1, 2, 0, 1, 1, 0}}
    };

    T264_predict_mv_skip(t, 0, &vec);

    // need subpel
    if ((t->flags & (USE_QUARTPEL)) == (USE_QUARTPEL))
    {
        x = (vec.x & 3);
        y = (vec.y & 3);

        if (index[y][x][0] == index[y][x][1])
        {
            tmp = t->ref[list_index][vec.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec.y >> 2)) * t->edged_stride + 
                ((t->mb.mb_x << 4) + (vec.x >> 2));
            t->memcpy_stride_u(tmp, 16, 16, t->edged_stride, ref, 16);
        }
        else
        {
            t->pia[MB_16x16](t->ref[list_index][vec.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec.x >> 2) + index[y][x][2], 
                        t->ref[list_index][vec.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec.x >> 2) + index[y][x][4],
                        t->edged_stride, t->edged_stride, ref, 16);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色偷偷久久人人79超碰人人澡| 精品处破学生在线二十三| 国产精品不卡一区二区三区| 国产一区二区h| 国产色产综合色产在线视频| 粉嫩绯色av一区二区在线观看| 国产精品人成在线观看免费| 99久久国产免费看| 亚洲男人的天堂一区二区| 欧美无乱码久久久免费午夜一区| 欧美日韩国产综合久久| 色香色香欲天天天影视综合网| 久久成人久久鬼色| 成人开心网精品视频| 亚洲日本在线看| 欧美色手机在线观看| 美腿丝袜亚洲三区| 欧美国产日本韩| 欧美影院精品一区| 蜜臀av性久久久久蜜臀av麻豆| 久久久久久久久99精品| 99国产精品久久久久| 亚洲成人久久影院| xnxx国产精品| 日本电影欧美片| 久久精品av麻豆的观看方式| 一区在线中文字幕| 欧美美女喷水视频| 国产精品资源站在线| 最新中文字幕一区二区三区| 欧美日韩国产经典色站一区二区三区 | 成人丝袜18视频在线观看| 亚洲色图在线看| 日韩一卡二卡三卡四卡| 成人黄页毛片网站| 亚洲成人动漫在线观看| 久久精品夜夜夜夜久久| 欧美另类videos死尸| 成人午夜视频网站| 秋霞成人午夜伦在线观看| 国产精品久久久久久久久久免费看 | 精品国产露脸精彩对白| 在线中文字幕一区二区| 国产乱理伦片在线观看夜一区| 一区二区三区毛片| 欧美国产日韩精品免费观看| 日韩欧美亚洲国产另类 | 亚洲成人7777| 国产欧美一二三区| 91精品国产综合久久久久久 | 国产一区欧美一区| 亚洲一区二区三区视频在线 | 亚洲精品成人天堂一二三| 欧美成人欧美edvon| 欧美在线啊v一区| 成人在线综合网站| 美女网站在线免费欧美精品| 一区二区高清在线| 中文字幕日韩精品一区| 国产欧美一区二区三区在线老狼| 欧美一区二区三区在线视频| 色www精品视频在线观看| 日韩西西人体444www| 亚洲人吸女人奶水| 91官网在线免费观看| 亚洲一区二区综合| 欧美成人免费网站| 北条麻妃国产九九精品视频| 午夜成人免费电影| 91久久精品日日躁夜夜躁欧美| 欧美日韩国产免费一区二区| 天天综合色天天综合| 久久狠狠亚洲综合| 一级日本不卡的影视| 亚洲色图制服诱惑| 中文字幕在线不卡国产视频| 久久久高清一区二区三区| 国产成a人亚洲| 久色婷婷小香蕉久久| 国产精品免费av| 91原创在线视频| 日韩美女一区二区三区四区| 欧美日韩mp4| 欧美久久久久中文字幕| 欧美日韩一区二区三区在线| 在线观看精品一区| 欧美日韩欧美一区二区| 欧美乱熟臀69xxxxxx| 欧美一卡二卡三卡四卡| 精品奇米国产一区二区三区| 久久综合九色综合欧美就去吻| 精品成a人在线观看| 久久久久久免费网| 亚洲欧洲成人自拍| 亚洲尤物在线视频观看| 无码av免费一区二区三区试看| 日产国产欧美视频一区精品 | 国产精品久久福利| 最近日韩中文字幕| 亚洲一区二区精品久久av| 久久久久久久av麻豆果冻| 久久久蜜臀国产一区二区| 中文字幕一区视频| 在线观看亚洲专区| 成人av在线网| 欧美亚洲高清一区二区三区不卡| 欧美日韩一区二区三区免费看 | 欧美少妇bbb| 欧美一区二区网站| 久久久久久久久久久99999| 国产精品久久久久久久久快鸭 | 亚洲色欲色欲www在线观看| 亚洲一区二区三区中文字幕 | 日本韩国精品一区二区在线观看| 欧美群妇大交群的观看方式| 精品国产一区二区精华| 中文字幕不卡三区| 午夜久久久久久久久| 国产九色sp调教91| 欧美羞羞免费网站| 久久人人爽人人爽| 夜夜嗨av一区二区三区网页| 精品一区二区三区免费毛片爱| 91麻豆国产在线观看| 欧美一区二区在线播放| 亚洲.国产.中文慕字在线| 狠狠色伊人亚洲综合成人| 色悠悠亚洲一区二区| 精品久久久久久久一区二区蜜臀| 亚洲视频资源在线| 久久国产精品露脸对白| 欧美中文字幕一区二区三区| 久久免费精品国产久精品久久久久| 亚洲精品水蜜桃| 国产永久精品大片wwwapp | av成人免费在线| 日韩欧美激情四射| 亚洲一区二区三区在线| 成人综合婷婷国产精品久久| 欧美成人一区二区三区片免费 | 亚洲亚洲精品在线观看| 国产黄色成人av| 7777精品伊人久久久大香线蕉| 中文字幕 久热精品 视频在线| 日韩高清国产一区在线| 91福利国产成人精品照片| wwwwww.欧美系列| 无吗不卡中文字幕| 色八戒一区二区三区| 中文字幕一区二区三区在线不卡 | 欧美体内she精高潮| 国产精品福利影院| 国产精品系列在线观看| 日韩欧美高清一区| 日韩一区欧美二区| 欧美少妇性性性| 樱花影视一区二区| 99久久er热在这里只有精品15| 精品国产乱码久久久久久影片| 日韩激情一二三区| 欧美日韩激情在线| 亚洲成人中文在线| 在线观看成人免费视频| 亚洲精品午夜久久久| 色综合视频一区二区三区高清| 国产精品乱子久久久久| 成人午夜视频网站| 中文字幕一区二区三区精华液| 成人精品亚洲人成在线| 亚洲国产成人私人影院tom| 国产在线播精品第三| 久久综合五月天婷婷伊人| 国内精品免费**视频| 精品少妇一区二区三区视频免付费| 日本亚洲三级在线| 欧美电影在哪看比较好| 日韩成人免费看| 日韩精品综合一本久道在线视频| 美女在线观看视频一区二区| 日韩精品一区二区三区四区| 黑人巨大精品欧美黑白配亚洲| 久久综合色综合88| 成人伦理片在线| 亚洲精品久久嫩草网站秘色| 一本一道久久a久久精品| 亚洲一二三区不卡| 欧美精品一级二级| 久久国产尿小便嘘嘘尿| 久久久久久久一区| k8久久久一区二区三区 | 国产精品视频免费| 色婷婷久久一区二区三区麻豆| 亚洲图片一区二区| 欧美一级午夜免费电影| 久久精品理论片| 日本一区二区三级电影在线观看| caoporn国产一区二区| 99精品国产热久久91蜜凸| 亚洲在线中文字幕| 欧美大黄免费观看|