[FFmpeg-cvslog] r21274 - in trunk/libavcodec: h264.c h264.h h264_loopfilter.c
michael
subversion
Mon Jan 18 01:20:44 CET 2010
Author: michael
Date: Mon Jan 18 01:20:44 2010
New Revision: 21274
Log:
Move the qp check to skip the loop filter up.
Modified:
trunk/libavcodec/h264.c
trunk/libavcodec/h264.h
trunk/libavcodec/h264_loopfilter.c
Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c Mon Jan 18 00:44:23 2010 (r21273)
+++ trunk/libavcodec/h264.c Mon Jan 18 01:20:44 2010 (r21274)
@@ -2184,7 +2184,8 @@ static void loop_filter(H264Context *h){
uvlinesize = h->mb_uvlinesize = s->uvlinesize;
}
backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, !is_complex);
- fill_filter_caches(h, mb_type); //FIXME don't fill stuff which isn't used by filter_mb
+ if(fill_filter_caches(h, mb_type) < 0)
+ continue;
h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
Modified: trunk/libavcodec/h264.h
==============================================================================
--- trunk/libavcodec/h264.h Mon Jan 18 00:44:23 2010 (r21273)
+++ trunk/libavcodec/h264.h Mon Jan 18 01:20:44 2010 (r21274)
@@ -726,7 +726,7 @@ static inline int get_chroma_qp(H264Cont
static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my);
-static av_always_inline void fill_caches(H264Context *h, int mb_type, int for_deblock){
+static av_always_inline int fill_caches(H264Context *h, int mb_type, int for_deblock){
MpegEncContext * const s = &h->s;
const int mb_xy= h->mb_xy;
int topleft_xy, top_xy, topright_xy, left_xy[2];
@@ -795,6 +795,19 @@ static av_always_inline void fill_caches
h->left_mb_xy[0] = left_xy[0];
h->left_mb_xy[1] = left_xy[1];
if(for_deblock){
+
+ //for sufficiently low qp, filtering wouldn't do anything
+ //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
+ if(!FRAME_MBAFF){
+ int qp_thresh = h->qp_thresh;
+ int qp = s->current_picture.qscale_table[mb_xy];
+ if(qp <= qp_thresh
+ && (s->mb_x == 0 || ((qp + s->current_picture.qscale_table[mb_xy-1] + 1)>>1) <= qp_thresh)
+ && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){
+ return 1;
+ }
+ }
+
*((uint64_t*)&h->non_zero_count_cache[0+8*1])= *((uint64_t*)&h->non_zero_count[mb_xy][ 0]);
*((uint64_t*)&h->non_zero_count_cache[0+8*2])= *((uint64_t*)&h->non_zero_count[mb_xy][ 8]);
*((uint32_t*)&h->non_zero_count_cache[0+8*5])= *((uint32_t*)&h->non_zero_count[mb_xy][16]);
@@ -1186,14 +1199,19 @@ static av_always_inline void fill_caches
if(!for_deblock)
h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
+ return 0;
}
static void fill_decode_caches(H264Context *h, int mb_type){
fill_caches(h, mb_type, 0);
}
-static void fill_filter_caches(H264Context *h, int mb_type){
- fill_caches(h, mb_type, 1);
+/**
+ *
+ * @returns non zero if the loop filter can be skiped
+ */
+static int fill_filter_caches(H264Context *h, int mb_type){
+ return fill_caches(h, mb_type, 1);
}
/**
Modified: trunk/libavcodec/h264_loopfilter.c
==============================================================================
--- trunk/libavcodec/h264_loopfilter.c Mon Jan 18 00:44:23 2010 (r21273)
+++ trunk/libavcodec/h264_loopfilter.c Mon Jan 18 01:20:44 2010 (r21274)
@@ -651,17 +651,6 @@ void ff_h264_filter_mb( H264Context *h,
av_unused int dir;
int list;
- //for sufficiently low qp, filtering wouldn't do anything
- //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
- if(!FRAME_MBAFF){
- int qp_thresh = h->qp_thresh;
- int qp = s->current_picture.qscale_table[mb_xy];
- if(qp <= qp_thresh
- && (mb_x == 0 || ((qp + s->current_picture.qscale_table[mb_xy-1] + 1)>>1) <= qp_thresh)
- && (h->top_mb_xy < 0 || ((qp + s->current_picture.qscale_table[h->top_mb_xy] + 1)>>1) <= qp_thresh)){
- return;
- }
- }
// CAVLC 8x8dct requires NNZ values for residual decoding that differ from what the loop filter needs
if(!h->pps.cabac && h->pps.transform_8x8_mode){
int top_type, left_type[2];
More information about the ffmpeg-cvslog
mailing list