summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-27 03:32:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-27 03:32:45 +0200
commitf211d9d8391c15e7408b8468dd7430eae2514544 (patch)
treef432096b52ab7971a7ca7fb05db18dcc1cfcb3a5 /libavcodec
parent721719dd0c0321b47500fa49b649c78422e910aa (diff)
parent659aa20e56de03b461afdaa6ae7e5d4be6e0d5fc (diff)
downloadffmpeg-f211d9d8391c15e7408b8468dd7430eae2514544.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: build: improve rules for test programs build: factor out the .c and .S compile commands as a macro swscale: remove unused xInc/srcW arguments from hScale(). H.264: disable 2tap qpel with CODEC_FLAG2_FAST and >8-bit H.264: make filter_mb_fast support 4:4:4 mpeg4videoenc: Remove disabled variant of mpeg4_encode_block(). configure: allow post-fixed cpu strings for athlon64, k8, and opteron when setting the -march flag. Move some variable declarations below the proper #ifdefs. Conflicts: Makefile ffplay.c libswscale/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/fft-test.c5
-rw-r--r--libavcodec/h264.c3
-rw-r--r--libavcodec/h264_loopfilter.c62
-rw-r--r--libavcodec/mpeg4videoenc.c65
4 files changed, 54 insertions, 81 deletions
diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c
index a676627de2..be105fe834 100644
--- a/libavcodec/fft-test.c
+++ b/libavcodec/fft-test.c
@@ -252,8 +252,9 @@ int main(int argc, char **argv)
#if CONFIG_FFT_FLOAT
RDFTContext r1, *r = &r1;
DCTContext d1, *d = &d1;
+ int fft_size_2;
#endif
- int fft_nbits, fft_size, fft_size_2;
+ int fft_nbits, fft_size;
double scale = 1.0;
AVLFG prng;
av_lfg_init(&prng, 1);
@@ -292,7 +293,6 @@ int main(int argc, char **argv)
}
fft_size = 1 << fft_nbits;
- fft_size_2 = fft_size >> 1;
tab = av_malloc(fft_size * sizeof(FFTComplex));
tab1 = av_malloc(fft_size * sizeof(FFTComplex));
tab_ref = av_malloc(fft_size * sizeof(FFTComplex));
@@ -372,6 +372,7 @@ int main(int argc, char **argv)
break;
#if CONFIG_FFT_FLOAT
case TRANSFORM_RDFT:
+ fft_size_2 = fft_size >> 1;
if (do_inverse) {
tab1[ 0].im = 0;
tab1[fft_size_2].im = 0;
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index dd9f425c3b..8ecf9b4dbd 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2488,7 +2488,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
s->dropable= h->nal_ref_idc == 0;
- if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !h->nal_ref_idc){
+ /* FIXME: 2tap qpel isn't implemented for high bit depth. */
+ if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !h->nal_ref_idc && !h->pixel_shift){
s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab;
s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab;
}else{
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index 46abc54c49..226c2aef28 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -218,10 +218,11 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
int mb_type, left_type;
int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh;
int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));
+ int chroma444 = CHROMA444;
mb_xy = h->mb_xy;
- if(!h->top_type || !h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff || CHROMA444) {
+ if(!h->top_type || !h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) {
ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize);
return;
}
@@ -264,16 +265,46 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h);
}
if(chroma){
- if(left_type){
- filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h);
- filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h);
+ if(chroma444){
+ if(left_type){
+ filter_mb_edgev( &img_cb[4*0], linesize, bS4, qpc0, h);
+ filter_mb_edgev( &img_cr[4*0], linesize, bS4, qpc0, h);
+ }
+ if( IS_8x8DCT(mb_type) ) {
+ filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h);
+ filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h);
+ filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h);
+ filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h);
+ } else {
+ filter_mb_edgev( &img_cb[4*1], linesize, bS3, qpc, h);
+ filter_mb_edgev( &img_cr[4*1], linesize, bS3, qpc, h);
+ filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h);
+ filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h);
+ filter_mb_edgev( &img_cb[4*3], linesize, bS3, qpc, h);
+ filter_mb_edgev( &img_cr[4*3], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h);
+ filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h);
+ filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, h);
+ filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, h);
+ }
+ }else{
+ if(left_type){
+ filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h);
+ filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h);
+ }
+ filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h);
+ filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h);
+ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
+ filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
}
- filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h);
- filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h);
- filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
- filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
- filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
- filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
}
return;
} else {
@@ -301,9 +332,14 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
#define FILTER(hv,dir,edge)\
if(AV_RN64A(bS[dir][edge])) { \
filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir, h );\
- if(chroma && !(edge&1)) {\
- filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
- filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
+ if(chroma){\
+ if(chroma444){\
+ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
+ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
+ } else if(!(edge&1)) {\
+ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
+ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
+ }\
}\
}
if(left_type)
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index bdff535a99..2760ca064f 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -296,10 +296,6 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
{
int i, last_non_zero;
-#if 0 //variables for the outcommented version
- int code, sign, last;
-#endif
- const RLTable *rl;
uint32_t *bits_tab;
uint8_t *len_tab;
const int last_index = s->block_last_index[n];
@@ -309,20 +305,17 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
mpeg4_encode_dc(dc_pb, intra_dc, n);
if(last_index<1) return;
i = 1;
- rl = &ff_mpeg4_rl_intra;
bits_tab= uni_mpeg4_intra_rl_bits;
len_tab = uni_mpeg4_intra_rl_len;
} else {
if(last_index<0) return;
i = 0;
- rl = &ff_h263_rl_inter;
bits_tab= uni_mpeg4_inter_rl_bits;
len_tab = uni_mpeg4_inter_rl_len;
}
/* AC coefs */
last_non_zero = i - 1;
-#if 1
for (; i < last_index; i++) {
int level = block[ scan_table[i] ];
if (level) {
@@ -348,64 +341,6 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
put_bits(ac_pb, 7+2+1+6+1+12+1, (3<<23)+(3<<21)+(1<<20)+(run<<14)+(1<<13)+(((level-64)&0xfff)<<1)+1);
}
}
-#else
- for (; i <= last_index; i++) {
- const int slevel = block[ scan_table[i] ];
- if (slevel) {
- int level;
- int run = i - last_non_zero - 1;
- last = (i == last_index);
- sign = 0;
- level = slevel;
- if (level < 0) {
- sign = 1;
- level = -level;
- }
- code = get_rl_index(rl, last, run, level);
- put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
- if (code == rl->n) {
- int level1, run1;
- level1 = level - rl->max_level[last][run];
- if (level1 < 1)
- goto esc2;
- code = get_rl_index(rl, last, run, level1);
- if (code == rl->n) {
- esc2:
- put_bits(ac_pb, 1, 1);
- if (level > MAX_LEVEL)
- goto esc3;
- run1 = run - rl->max_run[last][level] - 1;
- if (run1 < 0)
- goto esc3;
- code = get_rl_index(rl, last, run1, level);
- if (code == rl->n) {
- esc3:
- /* third escape */
- put_bits(ac_pb, 1, 1);
- put_bits(ac_pb, 1, last);
- put_bits(ac_pb, 6, run);
- put_bits(ac_pb, 1, 1);
- put_sbits(ac_pb, 12, slevel);
- put_bits(ac_pb, 1, 1);
- } else {
- /* second escape */
- put_bits(ac_pb, 1, 0);
- put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
- put_bits(ac_pb, 1, sign);
- }
- } else {
- /* first escape */
- put_bits(ac_pb, 1, 0);
- put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
- put_bits(ac_pb, 1, sign);
- }
- } else {
- put_bits(ac_pb, 1, sign);
- }
- last_non_zero = i;
- }
- }
-#endif
}
static int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc,