1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

h264_ps: move and export aspect_ratio

Needed for filters that may need it, like an SPS bsf.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Christophe Gisquet 2014-11-30 00:45:52 +00:00 committed by Michael Niedermayer
parent e74f2be1ed
commit 6a2bfd52e5
2 changed files with 22 additions and 23 deletions

View File

@ -31,32 +31,12 @@
#include "internal.h" #include "internal.h"
#include "avcodec.h" #include "avcodec.h"
#include "h264.h" #include "h264.h"
#include "h264data.h" //FIXME FIXME FIXME (just for zigzag_scan) #include "h264data.h"
#include "golomb.h" #include "golomb.h"
#define MAX_LOG2_MAX_FRAME_NUM (12 + 4) #define MAX_LOG2_MAX_FRAME_NUM (12 + 4)
#define MIN_LOG2_MAX_FRAME_NUM 4 #define MIN_LOG2_MAX_FRAME_NUM 4
static const AVRational pixel_aspect[17] = {
{ 0, 1 },
{ 1, 1 },
{ 12, 11 },
{ 10, 11 },
{ 16, 11 },
{ 40, 33 },
{ 24, 11 },
{ 20, 11 },
{ 32, 11 },
{ 80, 33 },
{ 18, 11 },
{ 15, 11 },
{ 64, 33 },
{ 160, 99 },
{ 4, 3 },
{ 3, 2 },
{ 2, 1 },
};
#define QP(qP, depth) ((qP) + 6 * ((depth) - 8)) #define QP(qP, depth) ((qP) + 6 * ((depth) - 8))
#define CHROMA_QP_TABLE_END(d) \ #define CHROMA_QP_TABLE_END(d) \
@ -164,8 +144,8 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
if (aspect_ratio_idc == EXTENDED_SAR) { if (aspect_ratio_idc == EXTENDED_SAR) {
sps->sar.num = get_bits(&h->gb, 16); sps->sar.num = get_bits(&h->gb, 16);
sps->sar.den = get_bits(&h->gb, 16); sps->sar.den = get_bits(&h->gb, 16);
} else if (aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)) { } else if (aspect_ratio_idc < FF_ARRAY_ELEMS(ff_h264_pixel_aspect)) {
sps->sar = pixel_aspect[aspect_ratio_idc]; sps->sar = ff_h264_pixel_aspect[aspect_ratio_idc];
} else { } else {
av_log(h->avctx, AV_LOG_ERROR, "illegal aspect ratio\n"); av_log(h->avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;

View File

@ -167,4 +167,23 @@ static const PMbInfo b_sub_mb_type_info[13] = {
{ MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 4, }, { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 4, },
}; };
static const AVRational ff_h264_pixel_aspect[17] = {
{ 0, 1 },
{ 1, 1 },
{ 12, 11 },
{ 10, 11 },
{ 16, 11 },
{ 40, 33 },
{ 24, 11 },
{ 20, 11 },
{ 32, 11 },
{ 80, 33 },
{ 18, 11 },
{ 15, 11 },
{ 64, 33 },
{ 160, 99 },
{ 4, 3 },
{ 3, 2 },
{ 2, 1 },
};
#endif /* AVCODEC_H264DATA_H */ #endif /* AVCODEC_H264DATA_H */