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

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

?? macroblock.c

?? 圖象壓縮程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/***************************************************************************** * macroblock.c: h264 encoder library ***************************************************************************** * Copyright (C) 2003 Laurent Aimar * $Id: macroblock.c,v 1.9 2004/03/28 12:37:11 fenrir Exp $ * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * * 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, USA. *****************************************************************************/#include <stdlib.h>#include <stdio.h>#include <string.h>#include <stdint.h>#include "../core/common.h"#include "../core/vlc.h"#include "macroblock.h"static const uint8_t intra4x4_cbp_to_golomb[48]={  3, 29, 30, 17, 31, 18, 37,  8, 32, 38, 19,  9, 20, 10, 11,  2, 16, 33, 34, 21, 35, 22, 39,  4, 36, 40, 23,  5, 24,  6,  7,  1, 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15,  0};static const uint8_t inter_cbp_to_golomb[48]={  0,  2,  3,  7,  4,  8, 17, 13,  5, 18,  9, 14, 10, 15, 16, 11,  1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19,  6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12};static const uint8_t block_idx_x[16] ={    0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3};static const uint8_t block_idx_y[16] ={    0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3};static const uint8_t block_idx_xy[4][4] ={    { 0, 2, 8,  10},    { 1, 3, 9,  11},    { 4, 6, 12, 14},    { 5, 7, 13, 15}};static const int quant_mf[6][4][4] ={    {  { 13107, 8066, 13107, 8066}, {  8066, 5243,  8066, 5243},       { 13107, 8066, 13107, 8066}, {  8066, 5243,  8066, 5243}  },    {  { 11916, 7490, 11916, 7490}, {  7490, 4660,  7490, 4660},       { 11916, 7490, 11916, 7490}, {  7490, 4660,  7490, 4660}  },    {  { 10082, 6554, 10082, 6554}, {  6554, 4194,  6554, 4194},       { 10082, 6554, 10082, 6554}, {  6554, 4194,  6554, 4194}  },    {  {  9362, 5825,  9362, 5825}, {  5825, 3647,  5825, 3647},       {  9362, 5825,  9362, 5825}, {  5825, 3647,  5825, 3647}  },    {  {  8192, 5243,  8192, 5243}, {  5243, 3355,  5243, 3355},       {  8192, 5243,  8192, 5243}, {  5243, 3355,  5243, 3355}  },    {  {  7282, 4559,  7282, 4559}, {  4559, 2893,  4559, 2893},       {  7282, 4559,  7282, 4559}, {  4559, 2893,  4559, 2893}  }};static const int i_chroma_qp_table[52] ={     0,  1,  2,  3,  4,  5,  6,  7,  8,  9,    10, 11, 12, 13, 14, 15, 16, 17, 18, 19,    20, 21, 22, 23, 24, 25, 26, 27, 28, 29,    29, 30, 31, 32, 32, 33, 34, 34, 35, 35,    36, 36, 37, 37, 37, 38, 38, 38, 39, 39,    39, 39};/**************************************************************************** * Scan and Quant functions ****************************************************************************/static const int scan_zigzag_x[16]={0, 1, 0, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 3, 2, 3};static const int scan_zigzag_y[16]={0, 0, 1, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 2, 3, 3};static inline void scan_zigzag_4x4full( int level[16], int16_t dct[4][4] ){    int i;    for( i = 0; i < 16; i++ )    {        level[i] = dct[scan_zigzag_y[i]][scan_zigzag_x[i]];    }}static inline void scan_zigzag_4x4( int level[15], int16_t dct[4][4] ){    int i;    for( i = 1; i < 16; i++ )    {        level[i - 1] = dct[scan_zigzag_y[i]][scan_zigzag_x[i]];    }}static inline void scan_zigzag_2x2_dc( int level[4], int16_t dct[2][2] ){    level[0] = dct[0][0];    level[1] = dct[0][1];    level[2] = dct[1][0];    level[3] = dct[1][1];}static void quant_4x4( int16_t dct[4][4], int i_qscale, int b_intra ){    const int i_qbits = 15 + i_qscale / 6;    const int i_mf = i_qscale % 6;    const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );    int x,y;    for( y = 0; y < 4; y++ )    {        for( x = 0; x < 4; x++ )        {            if( dct[y][x] > 0 )            {                dct[y][x] =( f + dct[y][x]  * quant_mf[i_mf][y][x] ) >> i_qbits;            }            else            {                dct[y][x] = - ( ( f - dct[y][x]  * quant_mf[i_mf][y][x] ) >> i_qbits );            }        }    }}static void quant_4x4_dc( int16_t dct[4][4], int i_qscale ){    const int i_qbits = 15 + i_qscale / 6;    const int f2 = ( 2 << i_qbits ) / 3;    const int i_qmf = quant_mf[i_qscale%6][0][0];    int x,y;    for( y = 0; y < 4; y++ )    {        for( x = 0; x < 4; x++ )        {            if( dct[y][x] > 0 )            {                dct[y][x] =( f2 + dct[y][x]  * i_qmf) >> ( 1 + i_qbits );            }            else            {                dct[y][x] = - ( ( f2 - dct[y][x]  * i_qmf ) >> (1 + i_qbits ) );            }        }    }}static void quant_2x2_dc( int16_t dct[2][2], int i_qscale, int b_intra ){    int const i_qbits = 15 + i_qscale / 6;    const int f2 = ( 2 << i_qbits ) / ( b_intra ? 3 : 6 );    const int i_qmf = quant_mf[i_qscale%6][0][0];    int x,y;    for( y = 0; y < 2; y++ )    {        for( x = 0; x < 2; x++ )        {            if( dct[y][x] > 0 )            {                dct[y][x] =( f2 + dct[y][x]  * i_qmf) >> ( 1 + i_qbits );            }            else            {                dct[y][x] = - ( ( f2 - dct[y][x]  * i_qmf ) >> (1 + i_qbits ) );            }        }    }}static inline int array_non_zero_count( int *v, int i_count ){    int i;    int i_nz;    for( i = 0, i_nz = 0; i < i_count; i++ )    {        if( v[i] )        {            i_nz++;        }    }    return i_nz;}void x264_mb_partition_mvd( x264_macroblock_t *mb, int i_list, int i_part, int i_sub, int mvd[2]){    int mvp[2];    int x,  y;    int w,  h;    int dx, dy;    x264_mb_partition_getxy( mb, i_part, i_sub, &x, &y );    x264_mb_partition_size ( mb, i_part, i_sub, &w, &h );    x264_mb_predict_mv(  mb, i_list, i_part, i_sub, mvp );    mvd[0] = mb->partition[x][y].mv[i_list][0] - mvp[0];    mvd[1] = mb->partition[x][y].mv[i_list][1] - mvp[1];    for( dx = 0; dx < w; dx++ )    {        for( dy = 0; dy < h; dy++ )        {            mb->partition[x+dx][y+dy].mvd[i_list][0] = mvd[0];            mb->partition[x+dx][y+dy].mvd[i_list][1] = mvd[1];        }    }}/* (ref: JVT-B118) * x264_mb_decimate_score: given dct coeffs it returns a score to see if we could empty this dct coeffs * to 0 (low score means set it to null) * Used in inter macroblock (luma and chroma) *  luma: for a 8x8 block: if score < 4 -> null *        for the complete mb: if score < 6 -> null *  chroma: for the complete mb: if score < 7 -> null */static int x264_mb_decimate_score( int *dct, int i_max ){    static const int i_ds_table[16] = { 3, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };    int i_score = 0;    int idx = i_max - 1;    while( idx >= 0 && dct[idx] == 0 )    {        idx--;    }    while( idx >= 0 )    {        int i_run;        if( abs( dct[idx--] ) > 1 )        {            return 9;        }        i_run = 0;        while( idx >= 0 && dct[idx] == 0 )        {            idx--;            i_run++;        }        i_score += i_ds_table[i_run];    }    return i_score;}void x264_mb_encode_i4x4( x264_t *h, x264_macroblock_t *mb, int idx, int i_qscale ){    x264_mb_context_t *ctx = mb->context;    uint8_t *p_src = ctx->p_img[0] + 4 * block_idx_x[idx] + 4 * block_idx_y[idx] * ctx->i_img[0];    int      i_src = ctx->i_img[0];    uint8_t *p_dst = ctx->p_fdec[0] + 4 * block_idx_x[idx] + 4 * block_idx_y[idx] * ctx->i_fdec[0];    int      i_dst = ctx->i_fdec[0];    int16_t luma[4][4];    int16_t dct4x4[4][4];    /* we calculate diff */    h->pixf.sub4x4( luma, p_src, i_src, p_dst, i_dst );    /* calculate dct coeffs */    h->dctf.dct4x4( dct4x4, luma );    quant_4x4( dct4x4, i_qscale, 1 );    scan_zigzag_4x4full( mb->block[idx].luma4x4, dct4x4 );    /* output samples to fdec */    x264_mb_dequant_4x4( dct4x4, i_qscale );    h->dctf.idct4x4( luma, dct4x4 );    /* put pixel to fdec */    h->pixf.add4x4( p_dst, i_dst, luma );}static void x264_mb_encode_i16x16( x264_t *h, x264_macroblock_t *mb, int i_qscale ){    x264_mb_context_t *ctx = mb->context;    uint8_t *p_src = ctx->p_img[0];    int      i_src = ctx->i_img[0];    uint8_t *p_dst = ctx->p_fdec[0];    int      i_dst = ctx->i_fdec[0];    int16_t luma[16][4][4];    int16_t dct4x4[16+1][4][4];    int i;    /* calculate the diff */    h->pixf.sub16x16( luma, p_src, i_src, p_dst, i_dst );    /* calculate dct coeffs */    for( i = 0; i < 16; i++ )    {        h->dctf.dct4x4( dct4x4[i+1], luma[i] );        /* copy dc coeff */        dct4x4[0][block_idx_y[i]][block_idx_x[i]] = dct4x4[1+i][0][0];        quant_4x4( dct4x4[1+i], i_qscale, 1 );        scan_zigzag_4x4( mb->block[i].residual_ac, dct4x4[1+i] );    }    h->dctf.dct4x4dc( dct4x4[0], dct4x4[0] );    quant_4x4_dc( dct4x4[0], i_qscale );    scan_zigzag_4x4full( mb->luma16x16_dc, dct4x4[0] );    /* output samples to fdec */    h->dctf.idct4x4dc( dct4x4[0], dct4x4[0] );    x264_mb_dequant_4x4_dc( dct4x4[0], i_qscale );  /* XXX not inversed */    /* calculate dct coeffs */    for( i = 0; i < 16; i++ )    {        x264_mb_dequant_4x4( dct4x4[1+i], i_qscale );        /* copy dc coeff */        dct4x4[1+i][0][0] = dct4x4[0][block_idx_y[i]][block_idx_x[i]];        h->dctf.idct4x4( luma[i], dct4x4[i+1] );    }    /* put pixels to fdec */    h->pixf.add16x16( p_dst, i_dst, luma );}static void x264_mb_encode_8x8( x264_t *h, x264_macroblock_t *mb, int b_inter, int i_qscale ){    x264_mb_context_t *ctx = mb->context;    uint8_t *p_src, *p_dst;    int      i_src, i_dst;    int i, ch;    int i_decimate_score = 0;    for( ch = 0; ch < 2; ch++ )    {        int16_t chroma[4][4][4];        int16_t dct2x2[2][2];        int16_t dct4x4[4][4][4];        p_src = ctx->p_img[1+ch];        i_src = ctx->i_img[1+ch];        p_dst = ctx->p_fdec[1+ch];        i_dst = ctx->i_fdec[1+ch];        /* calculate the diff */        h->pixf.sub8x8( chroma, p_src, i_src, p_dst, i_dst );        /* calculate dct coeffs */        for( i = 0; i < 4; i++ )        {            h->dctf.dct4x4( dct4x4[i], chroma[i] );            /* copy dc coeff */            dct2x2[block_idx_y[i]][block_idx_x[i]] = dct4x4[i][0][0];            quant_4x4( dct4x4[i], i_qscale, b_inter ? 0 : 1 );            scan_zigzag_4x4( mb->block[16+i+ch*4].residual_ac, dct4x4[i] );            i_decimate_score += x264_mb_decimate_score( mb->block[16+i+ch*4].residual_ac, 15 );        }        h->dctf.dct2x2dc( dct2x2, dct2x2 );        quant_2x2_dc( dct2x2, i_qscale, b_inter ? 0 : 1 );        scan_zigzag_2x2_dc( mb->chroma_dc[ch], dct2x2 );        if( i_decimate_score < 7 && b_inter )        {            /* Near null chroma 8x8 block so make it null (bits saving) */            for( i = 0; i < 4; i++ )            {                int x, y;                for( x = 0; x < 15; x++ )                {                    mb->block[16+i+ch*4].residual_ac[x] = 0;                }                for( x = 0; x < 4; x++ )                {                    for( y = 0; y < 4; y++ )                    {                        dct4x4[i][x][y] = 0;                    }                }            }        }        /* output samples to fdec */        h->dctf.idct2x2dc( dct2x2, dct2x2 );        x264_mb_dequant_2x2_dc( dct2x2, i_qscale );  /* XXX not inversed */        /* calculate dct coeffs */        for( i = 0; i < 4; i++ )        {            x264_mb_dequant_4x4( dct4x4[i], i_qscale );            /* copy dc coeff */            dct4x4[i][0][0] = dct2x2[block_idx_y[i]][block_idx_x[i]];            h->dctf.idct4x4( chroma[i], dct4x4[i] );        }        h->pixf.add8x8( p_dst, i_dst, chroma );    }}/***************************************************************************** * x264_macroblock_encode: *****************************************************************************/void x264_macroblock_encode( x264_t *h, x264_macroblock_t *mb ){    x264_mb_context_t *ctx = mb->context;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲少妇30p| 91搞黄在线观看| 亚洲欧美日韩综合aⅴ视频| 26uuu国产电影一区二区| 欧美精品日日鲁夜夜添| 日本电影亚洲天堂一区| 91在线小视频| 成人免费视频网站在线观看| 大尺度一区二区| 粉嫩av一区二区三区粉嫩| 国产黄色成人av| 99国产精品一区| 色婷婷综合久久| 欧美日韩精品三区| 欧美日韩亚洲国产综合| 欧美一区二区三区人| 91精品国产乱| 国产丝袜欧美中文另类| 国产精品欧美精品| 亚洲视频免费观看| 亚洲成人免费在线| 免播放器亚洲一区| 国产乱人伦精品一区二区在线观看| 久久97超碰色| 成人不卡免费av| 欧美亚洲国产怡红院影院| 欧美性高清videossexo| 日韩免费高清电影| 国产亚洲欧美在线| 一区二区在线观看av| 午夜精品视频在线观看| 精品一区中文字幕| av午夜精品一区二区三区| 91福利视频网站| 精品欧美一区二区三区精品久久 | 亚洲激情网站免费观看| 夜夜嗨av一区二区三区网页| 日韩电影一区二区三区四区| 国产**成人网毛片九色| 在线观看免费视频综合| 欧美一级艳片视频免费观看| 中文字幕一区二区日韩精品绯色| 亚洲成人第一页| 国产超碰在线一区| 欧美三级电影网| 欧美国产综合一区二区| 亚洲超碰精品一区二区| 国产一区二区三区黄视频| 色综合视频在线观看| 欧美一区二区日韩一区二区| 亚洲美女视频在线| 久久精品国产一区二区三 | 在线日韩国产精品| 欧美一区二区三区免费在线看| 国产精品麻豆99久久久久久| 丝袜诱惑亚洲看片| 成人免费三级在线| 欧美一区二区啪啪| 一区二区欧美在线观看| 岛国精品在线播放| 91精品国产综合久久福利软件| 亚洲日本免费电影| 国产在线视频一区二区三区| 日韩一区二区在线看| 亚洲精品视频在线看| 成人涩涩免费视频| 国产亚洲自拍一区| 老司机一区二区| 91精品国产高清一区二区三区蜜臀| 亚洲精品videosex极品| a美女胸又www黄视频久久| 国产色91在线| 国产一区不卡视频| 欧美电视剧在线观看完整版| 人人精品人人爱| 3atv一区二区三区| 亚洲成人免费电影| 欧美人与禽zozo性伦| 亚洲亚洲人成综合网络| 视频精品一区二区| 6080亚洲精品一区二区| 亚洲一区二区影院| 欧洲另类一二三四区| 亚洲网友自拍偷拍| 欧美在线不卡视频| 丝袜诱惑制服诱惑色一区在线观看| 欧美日韩中文另类| 污片在线观看一区二区| 欧美一区二区在线不卡| 蜜臀久久久久久久| 精品国产人成亚洲区| 国产一区二区三区久久久| 欧美国产精品一区二区三区| 91美女在线看| 亚洲第四色夜色| 日韩视频123| 成人的网站免费观看| 欧美国产禁国产网站cc| 色婷婷亚洲婷婷| 亚洲午夜三级在线| 日韩欧美国产电影| 国产一区视频网站| 国产精品免费网站在线观看| 色综合视频在线观看| 亚洲精品免费电影| 欧美一区二区三区四区久久| 国产精品综合久久| 自拍偷拍欧美激情| 欧美夫妻性生活| 国产精品12区| 亚洲综合网站在线观看| 欧美电影免费观看高清完整版 | 亚洲精品成人在线| 欧美精品亚洲一区二区在线播放| 国产制服丝袜一区| 日本一道高清亚洲日美韩| 欧美一级在线视频| 成人免费视频一区二区| 性做久久久久久| 国产嫩草影院久久久久| 欧美午夜精品理论片a级按摩| 精品伊人久久久久7777人| 亚洲精选免费视频| 精品国产成人在线影院| 91丝袜呻吟高潮美腿白嫩在线观看| 亚洲成人激情av| 日本一区二区三区在线观看| 欧美视频一区二区三区四区| 国产suv精品一区二区三区| 亚洲欧美区自拍先锋| 日韩精品一区二区三区视频在线观看 | 欧美一区二区在线播放| 福利视频网站一区二区三区| 蜜臀久久久99精品久久久久久| 久久精品日韩一区二区三区| 欧美精品在线一区二区| 91浏览器入口在线观看| 国产一区久久久| 免播放器亚洲一区| 中文字幕免费观看一区| 欧美精品一区二区三区蜜桃| 欧美一区二区三区不卡| 播五月开心婷婷综合| 国产在线一区二区| 久久se这里有精品| 丝袜亚洲精品中文字幕一区| 亚洲一级二级在线| 国产精品人妖ts系列视频| 欧美一级黄色大片| 在线电影一区二区三区| 欧美日韩激情一区| 欧美视频一区二区三区| 一本色道久久综合狠狠躁的推荐 | 成人性色生活片| 老司机免费视频一区二区| 亚洲一区二区三区爽爽爽爽爽| 中文字幕第一页久久| 国产亚洲精品bt天堂精选| 日韩手机在线导航| 日韩精品一区二区三区老鸭窝| 91精品国产欧美一区二区成人| 91精品国产综合久久福利| 91精品啪在线观看国产60岁| 91精品免费观看| 日韩欧美国产麻豆| 精品福利av导航| 久久精品亚洲麻豆av一区二区| 国产欧美日韩一区二区三区在线观看| 26uuu国产电影一区二区| 日韩手机在线导航| 久久久精品日韩欧美| 国产欧美一区二区精品性| 制服丝袜亚洲精品中文字幕| 日韩精品最新网址| 精品福利在线导航| 国产欧美日韩在线| 亚洲欧美中日韩| 午夜一区二区三区在线观看| 视频一区中文字幕国产| 麻豆成人91精品二区三区| 国产毛片精品视频| 99热这里都是精品| 欧美久久久久免费| 欧美精品一区二区三区在线播放| 欧美激情一区二区在线| 亚洲色图欧洲色图| 午夜精品福利一区二区蜜股av | 亚洲欧洲另类国产综合| 亚洲女同女同女同女同女同69| 天堂成人国产精品一区| 精品一区二区三区不卡| aaa亚洲精品一二三区| 欧美色图一区二区三区| 欧美mv和日韩mv国产网站| 国产精品无码永久免费888| 亚洲精品高清在线| 国产在线精品一区二区| 91黄色激情网站| 久久影音资源网| 亚洲国产综合色|