diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-21 13:06:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-21 13:06:14 +0100 |
commit | 86d9d349cce54984ef7f4b67647ae73bf1c48f88 (patch) | |
tree | f1a65e0d48eb386d67b993fd9e56ddf3051614cd | |
parent | 92656787cfeaf28af368bd4c20ffbaedc8ad3ca9 (diff) | |
parent | 23e85be58fc64b2e804e68b0034a08a6d257e523 (diff) | |
download | ffmpeg-86d9d349cce54984ef7f4b67647ae73bf1c48f88.tar.gz |
Merge commit '23e85be58fc64b2e804e68b0034a08a6d257e523'
* commit '23e85be58fc64b2e804e68b0034a08a6d257e523':
h264: add a parameter to the CHROMA444 macro.
h264: add a parameter to the CHROMA422 macro.
Conflicts:
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_cavlc.c
libavcodec/h264_loopfilter.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/h264.c | 32 | ||||
-rw-r--r-- | libavcodec/h264.h | 4 | ||||
-rw-r--r-- | libavcodec/h264_cabac.c | 8 | ||||
-rw-r--r-- | libavcodec/h264_cavlc.c | 4 | ||||
-rw-r--r-- | libavcodec/h264_loopfilter.c | 14 | ||||
-rw-r--r-- | libavcodec/h264_mb_template.c | 2 | ||||
-rw-r--r-- | libavcodec/h264_mvpred.h | 4 |
7 files changed, 34 insertions, 34 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 87322a2b83..2adee84bf3 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2089,8 +2089,8 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *top_border; int top_idx = 1; const int pixel_shift = h->pixel_shift; - int chroma444 = CHROMA444; - int chroma422 = CHROMA422; + int chroma444 = CHROMA444(h); + int chroma422 = CHROMA422(h); src_y -= linesize; src_cb -= uvlinesize; @@ -2486,7 +2486,7 @@ void ff_h264_hl_decode_mb(H264Context *h) const int mb_type = h->cur_pic.mb_type[mb_xy]; int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || h->qscale == 0; - if (CHROMA444) { + if (CHROMA444(h)) { if (is_complex || h->pixel_shift) hl_decode_mb_444_complex(h); else @@ -2988,51 +2988,51 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) { switch (h->sps.bit_depth_luma) { case 9: - if (CHROMA444) { + if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { return AV_PIX_FMT_GBRP9; } else return AV_PIX_FMT_YUV444P9; - } else if (CHROMA422) + } else if (CHROMA422(h)) return AV_PIX_FMT_YUV422P9; else return AV_PIX_FMT_YUV420P9; break; case 10: - if (CHROMA444) { + if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { return AV_PIX_FMT_GBRP10; } else return AV_PIX_FMT_YUV444P10; - } else if (CHROMA422) + } else if (CHROMA422(h)) return AV_PIX_FMT_YUV422P10; else return AV_PIX_FMT_YUV420P10; break; case 12: - if (CHROMA444) { + if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { return AV_PIX_FMT_GBRP12; } else return AV_PIX_FMT_YUV444P12; - } else if (CHROMA422) + } else if (CHROMA422(h)) return AV_PIX_FMT_YUV422P12; else return AV_PIX_FMT_YUV420P12; break; case 14: - if (CHROMA444) { + if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { return AV_PIX_FMT_GBRP14; } else return AV_PIX_FMT_YUV444P14; - } else if (CHROMA422) + } else if (CHROMA422(h)) return AV_PIX_FMT_YUV422P14; else return AV_PIX_FMT_YUV420P14; break; case 8: - if (CHROMA444) { + if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { av_log(h->avctx, AV_LOG_DEBUG, "Detected GBR colorspace.\n"); return AV_PIX_FMT_GBR24P; @@ -3041,7 +3041,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) } return h->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ444P : AV_PIX_FMT_YUV444P; - } else if (CHROMA422) { + } else if (CHROMA422(h)) { return h->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P : AV_PIX_FMT_YUV422P; } else { @@ -3082,7 +3082,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) h->avctx->coded_height = h->height; } else{ avcodec_set_dimensions(h->avctx, h->width, h->height); - h->avctx->width -= (2>>CHROMA444)*FFMIN(h->sps.crop_right, (8<<CHROMA444)-1); + h->avctx->width -= (2>>CHROMA444(h))*FFMIN(h->sps.crop_right, (8<<CHROMA444(h))-1); h->avctx->height -= (1<<h->chroma_y_shift)*FFMIN(h->sps.crop_bottom, (16>>h->chroma_y_shift)-1) * (2 - h->sps.frame_mbs_only_flag); } @@ -4147,10 +4147,10 @@ static void loop_filter(H264Context *h, int start_x, int end_x) dest_y = h->cur_pic.f.data[0] + ((mb_x << pixel_shift) + mb_y * h->linesize) * 16; dest_cb = h->cur_pic.f.data[1] + - (mb_x << pixel_shift) * (8 << CHROMA444) + + (mb_x << pixel_shift) * (8 << CHROMA444(h)) + mb_y * h->uvlinesize * block_h; dest_cr = h->cur_pic.f.data[2] + - (mb_x << pixel_shift) * (8 << CHROMA444) + + (mb_x << pixel_shift) * (8 << CHROMA444(h)) + mb_y * h->uvlinesize * block_h; // FIXME simplify above diff --git a/libavcodec/h264.h b/libavcodec/h264.h index f20401dc34..392f2f5a7c 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -88,8 +88,8 @@ #endif #define CHROMA (h->sps.chroma_format_idc) -#define CHROMA422 (h->sps.chroma_format_idc == 2) -#define CHROMA444 (h->sps.chroma_format_idc == 3) +#define CHROMA422(h) (h->sps.chroma_format_idc == 2) +#define CHROMA444(h) (h->sps.chroma_format_idc == 3) #define EXTENDED_SAR 255 diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index 6f7224e013..60048e0112 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1811,7 +1811,7 @@ static av_always_inline void decode_cabac_residual_nondc(H264Context *h, int max_coeff) { /* read coded block flag */ - if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) { + if( (cat != 5 || CHROMA444(h)) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) { if( max_coeff == 64 ) { fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, 0, 1); } else { @@ -2296,7 +2296,7 @@ decode_intra_mb: /* It would be better to do this in fill_decode_caches, but we don't know * the transform mode of the current macroblock there. */ - if (CHROMA444 && IS_8x8DCT(mb_type)){ + if (CHROMA444(h) && IS_8x8DCT(mb_type)){ int i; uint8_t *nnz_cache = h->non_zero_count_cache; for (i = 0; i < 2; i++){ @@ -2361,10 +2361,10 @@ decode_intra_mb: h->last_qscale_diff=0; decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0); - if(CHROMA444){ + if (CHROMA444(h)) { decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1); decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2); - } else if (CHROMA422) { + } else if (CHROMA422(h)) { if( cbp&0x30 ){ int c; for (c = 0; c < 2; c++) diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index 63f8d7826f..d06c86a6f4 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -1112,7 +1112,7 @@ decode_intra_mb: return -1; } h->cbp_table[mb_xy] |= ret << 12; - if(CHROMA444){ + if (CHROMA444(h)) { if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ){ return -1; } @@ -1126,7 +1126,7 @@ decode_intra_mb: for(chroma_idx=0; chroma_idx<2; chroma_idx++) if (decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, - CHROMA422 ? chroma422_dc_scan : chroma_dc_scan, + CHROMA422(h) ? chroma422_dc_scan : chroma_dc_scan, NULL, 4*num_c8x8) < 0) { return -1; } diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index e617588d5a..26dc5bcee5 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -242,8 +242,8 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h, int pixel_shift) { int chroma = CHROMA && !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY)); - int chroma444 = CHROMA444; - int chroma422 = CHROMA422; + int chroma444 = CHROMA444(h); + int chroma422 = CHROMA422(h); int mb_xy = h->mb_xy; int left_type= h->left_type[LTOP]; @@ -463,8 +463,8 @@ static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int a, int b, int chroma, int dir) { int edge; int chroma_qp_avg[2]; - int chroma444 = CHROMA444; - int chroma422 = CHROMA422; + int chroma444 = CHROMA444(h); + int chroma422 = CHROMA422(h); const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy; const int mbm_type = dir == 0 ? h->left_type[LTOP] : h->top_type; @@ -780,12 +780,12 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1], a, b, 1 ); if (chroma){ - if (CHROMA444) { + if (CHROMA444(h)) { filter_mb_mbaff_edgev ( h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1], a, b, 1 ); - } else if (CHROMA422) { + } else if (CHROMA422(h)) { filter_mb_mbaff_edgecv(h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1); filter_mb_mbaff_edgecv(h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1); filter_mb_mbaff_edgecv(h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1); @@ -801,7 +801,7 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint filter_mb_mbaff_edgev ( h, img_y , 2* linesize, bS , 2, qp [0], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1], a, b, 1 ); if (chroma){ - if (CHROMA444) { + if (CHROMA444(h)) { filter_mb_mbaff_edgev ( h, img_cb, 2*uvlinesize, bS , 2, bqp[0], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_cr, 2*uvlinesize, bS , 2, rqp[0], a, b, 1 ); diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c index 8ef93a1453..15cb3c9a24 100644 --- a/libavcodec/h264_mb_template.c +++ b/libavcodec/h264_mb_template.c @@ -53,7 +53,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h) const int is_h264 = !CONFIG_SVQ3_DECODER || SIMPLE || h->avctx->codec_id == AV_CODEC_ID_H264; void (*idct_add)(uint8_t *dst, int16_t *block, int stride); const int block_h = 16 >> h->chroma_y_shift; - const int chroma422 = CHROMA422; + const int chroma422 = CHROMA422(h); dest_y = h->cur_pic.f.data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16; dest_cb = h->cur_pic.f.data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h; diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h index 361c1d7793..7015d8cdcf 100644 --- a/libavcodec/h264_mvpred.h +++ b/libavcodec/h264_mvpred.h @@ -555,12 +555,12 @@ static void fill_decode_caches(H264Context *h, int mb_type) nnz = h->non_zero_count[left_xy[LEFT(i)]]; nnz_cache[3 + 8 * 1 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i]]; nnz_cache[3 + 8 * 2 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i]]; - if (CHROMA444) { + if (CHROMA444(h)) { nnz_cache[3 + 8 * 6 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] + 4 * 4]; nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] + 4 * 4]; nnz_cache[3 + 8 * 11 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] + 8 * 4]; nnz_cache[3 + 8 * 12 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] + 8 * 4]; - } else if (CHROMA422) { + } else if (CHROMA422(h)) { nnz_cache[3 + 8 * 6 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] - 2 + 4 * 4]; nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] - 2 + 4 * 4]; nnz_cache[3 + 8 * 11 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] - 2 + 8 * 4]; |