From 26f01bd106f62ffe501a9baf609c476051d919da Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 15 Jul 2012 17:43:50 +0200 Subject: [PATCH 1/3] x86: PMINUB: port to cpuflags --- libavcodec/x86/ac3dsp.asm | 3 --- libavutil/x86/x86util.asm | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index 9d66fda7bb..2c453c59f5 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -63,12 +63,10 @@ cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, offset REP_RET %endmacro -%define PMINUB PMINUB_MMX %define LOOP_ALIGN INIT_MMX mmx AC3_EXPONENT_MIN %if HAVE_MMXEXT -%define PMINUB PMINUB_MMXEXT %define LOOP_ALIGN ALIGN 16 INIT_MMX mmxext AC3_EXPONENT_MIN @@ -77,7 +75,6 @@ AC3_EXPONENT_MIN INIT_XMM sse2 AC3_EXPONENT_MIN %endif -%undef PMINUB %undef LOOP_ALIGN ;----------------------------------------------------------------------------- diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 761cea0a8e..ca0041acf7 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -530,14 +530,14 @@ movh [%7+%8], %4 %endmacro -%macro PMINUB_MMX 3 ; dst, src, tmp +%macro PMINUB 3 ; dst, src, ignored +%if cpuflag(mmxext) + pminub %1, %2 +%else ; dst, src, tmp mova %3, %1 psubusb %3, %2 psubb %1, %3 -%endmacro - -%macro PMINUB_MMXEXT 3 ; dst, src, ignored - pminub %1, %2 +%endif %endmacro %macro SPLATW 2-3 0 From 85f67c4865d8014ded2aaa64b3cba6e2970342d7 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Sat, 20 Oct 2012 09:56:11 -0700 Subject: [PATCH 2/3] PGS subtitles: Expose forced flag Useful for detection of subtitles displayed during foreign language scenes. Signed-off-by: Diego Biurrun --- libavcodec/avcodec.h | 3 +++ libavcodec/pgssubdec.c | 11 ++++++++--- libavcodec/version.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 73321b2040..43f7c87b23 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3166,6 +3166,8 @@ enum AVSubtitleType { SUBTITLE_ASS, }; +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + typedef struct AVSubtitleRect { int x; ///< top left corner of pict, undefined when pict is not set int y; ///< top left corner of pict, undefined when pict is not set @@ -3188,6 +3190,7 @@ typedef struct AVSubtitleRect { * struct. */ char *ass; + int flags; } AVSubtitleRect; typedef struct AVSubtitle { diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 9fd26d80aa..0326ea8f1b 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -45,6 +45,7 @@ typedef struct PGSSubPresentation { int y; int id_number; int object_number; + uint8_t composition_flag; } PGSSubPresentation; typedef struct PGSSubPicture { @@ -299,16 +300,17 @@ static void parse_presentation_segment(AVCodecContext *avctx, buf += 3; ctx->presentation.object_number = bytestream_get_byte(&buf); + ctx->presentation.composition_flag = 0; if (!ctx->presentation.object_number) return; /* - * Skip 4 bytes of unknown: + * Skip 3 bytes of unknown: * object_id_ref (2 bytes), * window_id_ref, - * composition_flag (0x80 - object cropped, 0x40 - object forced) */ - buf += 4; + buf += 3; + ctx->presentation.composition_flag = bytestream_get_byte(&buf); x = bytestream_get_be16(&buf); y = bytestream_get_be16(&buf); @@ -368,6 +370,9 @@ static int display_end_segment(AVCodecContext *avctx, void *data, sub->rects[0] = av_mallocz(sizeof(*sub->rects[0])); sub->num_rects = 1; + if (ctx->presentation.composition_flag & 0x40) + sub->rects[0]->flags |= AV_SUBTITLE_FLAG_FORCED; + sub->rects[0]->x = ctx->presentation.x; sub->rects[0]->y = ctx->presentation.y; sub->rects[0]->w = ctx->picture.w; diff --git a/libavcodec/version.h b/libavcodec/version.h index 5ee7c7c55d..45ff5077ba 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -27,7 +27,7 @@ */ #define LIBAVCODEC_VERSION_MAJOR 54 -#define LIBAVCODEC_VERSION_MINOR 32 +#define LIBAVCODEC_VERSION_MINOR 33 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From 9a07c1332cfe092b57b5758f22b686ca58806c60 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 2 Nov 2012 12:04:16 +0100 Subject: [PATCH 3/3] parser: Move Doxygen documentation to the header files --- libavcodec/avcodec.h | 4 ++++ libavcodec/parser.c | 9 --------- libavcodec/parser.h | 5 +++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 43f7c87b23..d5968f9e55 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3890,6 +3890,10 @@ int av_parser_parse2(AVCodecParserContext *s, int64_t pts, int64_t dts, int64_t pos); +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitstreamFilter + */ int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 03f327efd0..7ace766eb9 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -167,11 +167,6 @@ int av_parser_parse2(AVCodecParserContext *s, return index; } -/** - * - * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed - * @deprecated use AVBitstreamFilter - */ int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, @@ -217,10 +212,6 @@ void av_parser_close(AVCodecParserContext *s) /*****************************************************/ -/** - * Combine the (truncated) bitstream to a complete frame. - * @return -1 if no complete frame could be created, AVERROR(ENOMEM) if there was a memory allocation error - */ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size) { if(pc->overread){ diff --git a/libavcodec/parser.h b/libavcodec/parser.h index 1d029e319e..ea1cae28a2 100644 --- a/libavcodec/parser.h +++ b/libavcodec/parser.h @@ -39,6 +39,11 @@ typedef struct ParseContext{ #define END_NOT_FOUND (-100) +/** + * Combine the (truncated) bitstream to a complete frame. + * @return -1 if no complete frame could be created, + * AVERROR(ENOMEM) if there was a memory allocation error + */ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size); int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size);