Compare commits

...

21 Commits

Author SHA1 Message Date
Andreas Rheinhardt fa959bb135 avcodec/parsers: Silence deprecation warnings
Slipped through because Clang (in contrast to GCC) does not warn about
this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 18:48:17 +01:00
Andreas Rheinhardt 25968dbb05 avcodec/parser_internal: Rename PASSTHROUGH macro to avoid name conflict
wingdi.h defines its own PASSTHROUGH and it is included implicitly
by the VC-1 parser (which is mpegvideo-based and therefore includes
a lot of stuff).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 18:41:27 +01:00
Andreas Rheinhardt 8a322c956f avcodec/avcodec: Schedule parser API to use enum AVCodecID for codec ids
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 16:57:03 +01:00
Andreas Rheinhardt 7c43cc4cb7 avcodec/parser_internal: Remove prefix from parser_{init,parse,close}
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 16:57:03 +01:00
Andreas Rheinhardt e0b0ca8111 avcodec/avcodec: Schedule moving private fields of AVCodecParser out of avcodec.h
AVCodecParser has several fields which are not really meant
to be accessed by users, but it has no public-private
demarkation line, so these fields are technically public
and can therefore not simply be made private like
20f9727018 did for AVCodec.*

This commit therefore deprecates these fields and
schedules them to become private. All parsers have already
been switched to FFCodecParser, which (for now) is a union
of AVCodecParser and an unnamed clone of AVCodecParser
(new fields can be added at the end of this clone).

*: This is also the reason why split has never been removed despite
not being set for several years now.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 16:57:02 +01:00
Andreas Rheinhardt e9fe30ccd1 avcodec/parsers: Add macro to set list of codec ids
The current code relies on AV_CODEC_ID_NONE being zero, so that
unused codec ids are set to their proper value. This commit adds
a macro to set unset ids to AV_CODEC_ID_NONE.

(The actual rationale for this macro is to simplify
the transition to making the private fields that are
currently public in avcodec.h really private.)

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 16:57:02 +01:00
Andreas Rheinhardt 12f7a7724d avcodec: Remove unnecessary parser.h inclusions
It only contains declarations for some auxiliary functions for parsing
that parsers that only work with complete packets don't need.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 16:57:02 +01:00
James Almer 633d424b1b avutil/csp: don't dereference NULL pointer in av_csp_primaries_desc_from_id()
Fixes CID 1668265.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-11-01 12:41:23 -03:00
James Almer 492310ec6e fftools/ffmpeg_demux: fix memory leak when creating tile grid filtergraphs
If av_packet_side_data_to_frame() fails, graph_str will leak.

Fixes CID 1668266.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-11-01 12:41:23 -03:00
James Almer acd2cfe2eb fftools/ffmpeg: make fg_create{_simple,} clear the input string pointer
The graph string is either freed or attached to the filtergraph, so it's best to
not leave a dangling pointer with the caller.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-11-01 12:41:23 -03:00
James Almer 9c266084fe avcodec/vc1_parser: stop splitting ENDOFSEQ markers into separate packets
The decode API can handle outputting delayed frames without relying on the
parser splitting off the ENDOFSEQ marker.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-11-01 12:23:19 -03:00
James Almer 9ab6a94195 avcodec/vc1dec: look for ENDOFSEQ markers at the end of a packet's payload
This is in preparation for the parser no longer splitting them into their own
packets.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-11-01 12:22:49 -03:00
Andreas Rheinhardt fc2c030fb2 avcodec/vc1dec: Deduplicate cleanup code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 15:47:45 +01:00
Andreas Rheinhardt a44f7b6c4f avcodec/vc1dec: Don't initialize write-only intra_scantable
VC-1 does not use it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 15:47:45 +01:00
Andreas Rheinhardt b91081274f avcodec/x86/h264_qpel: Add and use ff_{avg,put}_pixels16x16_l2_sse2()
This avoids mmx (the size 16 h264qpel dsp now no longer uses any mmx)
and improves performance, particularly for the avg case:

Old benchmarks:
avg_h264_qpel_16_mc01_8_c:                             780.0 ( 1.00x)
avg_h264_qpel_16_mc01_8_sse2:                           91.2 ( 8.55x)
avg_h264_qpel_16_mc03_8_c:                             804.0 ( 1.00x)
avg_h264_qpel_16_mc03_8_sse2:                           91.2 ( 8.82x)
put_h264_qpel_16_mc01_8_c:                             779.5 ( 1.00x)
put_h264_qpel_16_mc01_8_sse2:                           82.8 ( 9.41x)
put_h264_qpel_16_mc03_8_c:                             770.1 ( 1.00x)
put_h264_qpel_16_mc03_8_sse2:                           82.5 ( 9.33x)

New benchmarks:
avg_h264_qpel_16_mc01_8_c:                             783.9 ( 1.00x)
avg_h264_qpel_16_mc01_8_sse2:                           84.1 ( 9.32x)
avg_h264_qpel_16_mc03_8_c:                             797.4 ( 1.00x)
avg_h264_qpel_16_mc03_8_sse2:                           83.9 ( 9.51x)
put_h264_qpel_16_mc01_8_c:                             767.4 ( 1.00x)
put_h264_qpel_16_mc01_8_sse2:                           80.5 ( 9.53x)
put_h264_qpel_16_mc03_8_c:                             779.9 ( 1.00x)
put_h264_qpel_16_mc03_8_sse2:                           80.3 ( 9.71x)

(qpeldsp will use these functions when it gets ported to SSE2;
then the mmxext functions will be removed as well.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 15:17:05 +01:00
Andreas Rheinhardt 529a048c31 avcodec/x86/qpel: Add specializations for put_l2 functions
These functions are currently always called with height either
being equal to the block size or block size+1. height is
a compile-time constant at every callsite. This makes it possible
to split this function into two to avoid the check inside
the function for whether height is odd or even.

The corresponding avg function is only used with height == block size,
so that it does not have a height parameter at all. Removing the
parameter from the put_l2 functions as well therefore simplifies
the C code.

The new functions increase the size of .text from qpel{dsp}.o
by 32B here, yet they save 464B of C code here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 15:17:05 +01:00
Andreas Rheinhardt 5715eb1274 avcodec/x86/{h264_qpel,qpeldsp_init}: Move shared decls into header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 15:17:05 +01:00
Andreas Rheinhardt b03b45cf22 avcodec/x86/h264_chromamc: Remove MMX(EXT) funcs overridden by SSSE3
SSSE3 is already quite old (introduced 2006 for Intel, 2011 for AMD),
so that the overwhelming majority of our users (particularly those
that actually update their FFmpeg) will be using the SSSE3 versions.
This commit therefore removes the MMX(EXT) functions overridden
by them (which don't abide by the ABI) to get closer to a removal
of emms_c.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 13:34:23 +01:00
Andreas Rheinhardt cb054ee89b avcodec/x86/h264_chromamc: Add SSSE3 RV40 chroma motion compensation functions
The only difference between it and the H.264/VC-1 versions is the
bias constant which depends on the shift parameters for RV40.
This value ends up in a register and therefore one can reuse
the H.264 code by setting the registers for RV40 and then jumping
into the relevant H.264 function, making the four new functions
cheap (just 256 bytes in total). This approach uses one jump more
for the no-filter case and one jump less in the one-dimensional
case than an approach using separate functions.

avg_chroma_mc4_c:                                      167.5 ( 1.00x)
avg_chroma_mc4_mmxext:                                  48.1 ( 3.48x)
avg_chroma_mc4_ssse3:                                   31.1 ( 5.39x)
avg_chroma_mc8_c:                                      325.5 ( 1.00x)
avg_chroma_mc8_mmxext:                                 103.2 ( 3.15x)
avg_chroma_mc8_ssse3:                                   33.5 ( 9.71x)
put_chroma_mc4_c:                                      137.4 ( 1.00x)
put_chroma_mc4_mmx:                                     44.5 ( 3.09x)
put_chroma_mc4_ssse3:                                   28.4 ( 4.83x)
put_chroma_mc8_c:                                      271.4 ( 1.00x)
put_chroma_mc8_mmx:                                     99.9 ( 2.72x)
put_chroma_mc8_ssse3:                                   30.6 ( 8.86x)

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 13:34:00 +01:00
Andreas Rheinhardt c607aae2b9 configure: Add config_components.asm
This is in preparation for the next commit.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 13:33:56 +01:00
Andreas Rheinhardt c6efe1abda avcodec/h264chroma: Move mc1 function to mpegvideo_dec.c
It is only used by mpegvideo decoders (for lowres). It is also only used
for bitdepth == 8, so don't build the bitdepth == 16 function at all any
more.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-01 13:31:57 +01:00
96 changed files with 946 additions and 973 deletions

11
configure vendored
View File

@ -4398,7 +4398,7 @@ CODEC_LIST="
$ENCODER_LIST
$DECODER_LIST
"
PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
PARSER_LIST=$(find_things_extern parser FFCodecParser libavcodec/parsers.c)
BSF_LIST=$(find_things_extern bsf FFBitStreamFilter libavcodec/bitstream_filters.c)
HWACCEL_LIST=$(find_things_extern hwaccel FFHWAccel libavcodec/hwaccels.h)
PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
@ -8524,8 +8524,10 @@ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
cp_if_changed $TMPH config.h
touch ffbuild/.config
# Copy config.asm before printing ALL_COMPONENTS; that's not needed in assembly.
enabled x86asm && cp_if_changed $TMPASM config.asm
# Copy config.asm and reopen a new TMPASM for config_components.asm
enabled x86asm && cp_if_changed $TMPASM config.asm && cat > $TMPASM <<EOF
; Automatically generated by configure - do not modify!
EOF
# Reopen a new TMPH for config_components.h.
cat > $TMPH <<EOF
@ -8540,6 +8542,7 @@ echo "#endif /* FFMPEG_CONFIG_COMPONENTS_H */" >> $TMPH
echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
cp_if_changed $TMPH config_components.h
enabled x86asm && cp_if_changed $TMPASM config_components.asm
cat > $TMPH <<EOF
/* Generated by ffmpeg configure */
@ -8592,7 +8595,7 @@ print_enabled_components(){
print_enabled_components libavfilter/filter_list.c FFFilter filter_list $FILTER_LIST
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/parser_list.c FFCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $DEMUXER_LIST
print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST

View File

@ -2,6 +2,14 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
2025-11-01 - xxxxxxxxxx - lavc 62.19.100 - avcodec.h
Schedule AVCodecParser and av_parser_init() to use enum AVCodecID
for codec ids on the next major version bump.
2025-11-01 - xxxxxxxxxx - lavc 62.18.100 - avcodec.h
Deprecate AVCodecParser fields priv_data_size, parser_init,
parser_parse, parser_close, and split with no replacement.
2025-10-30 - xxxxxxxxxx - lavc 62.17.100 - packet.h
Add av_packet_side_data_from_frame() and av_packet_side_data_to_frame().

View File

@ -811,7 +811,7 @@ int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int fi
int filtergraph_is_simple(const FilterGraph *fg);
int fg_create_simple(FilterGraph **pfg,
InputStream *ist,
char *graph_desc,
char **graph_desc,
Scheduler *sch, unsigned sched_idx_enc,
const OutputFilterOptions *opts);
int fg_finalise_bindings(void);
@ -834,10 +834,10 @@ int ofilter_bind_enc(OutputFilter *ofilter,
/**
* Create a new filtergraph in the global filtergraph list.
*
* @param graph_desc Graph description; an av_malloc()ed string, filtergraph
* @param graph_desc Pointer to graph description; an av_malloc()ed string, filtergraph
* takes ownership of it.
*/
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
const OutputFilterOptions *opts);
void fg_free(FilterGraph **pfg);

View File

@ -1702,17 +1702,22 @@ static int istg_parse_tile_grid(const OptionsContext *o, Demuxer *d, InputStream
ret = av_packet_side_data_to_frame(&opts.side_data, &opts.nb_side_data, sd, 0);
if (ret < 0 && ret != AVERROR(EINVAL))
return ret;
goto fail;
}
ret = fg_create(NULL, graph_str, d->sch, &opts);
ret = fg_create(NULL, &graph_str, d->sch, &opts);
if (ret < 0)
return ret;
goto fail;
istg->fg = filtergraphs[nb_filtergraphs-1];
istg->fg->is_internal = 1;
return 0;
ret = 0;
fail:
if (ret < 0)
av_freep(&graph_str);
return ret;
}
static int istg_add(const OptionsContext *o, Demuxer *d, AVStreamGroup *stg)

View File

@ -1085,7 +1085,7 @@ static const AVClass fg_class = {
.category = AV_CLASS_CATEGORY_FILTER,
};
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch,
const OutputFilterOptions *opts)
{
FilterGraphPriv *fgp;
@ -1097,7 +1097,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
fgp = av_mallocz(sizeof(*fgp));
if (!fgp) {
av_freep(&graph_desc);
av_freep(graph_desc);
return AVERROR(ENOMEM);
}
fg = &fgp->fg;
@ -1108,7 +1108,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
} else {
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
if (ret < 0) {
av_freep(&graph_desc);
av_freep(graph_desc);
av_freep(&fgp);
return ret;
}
@ -1117,11 +1117,13 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch,
}
fg->class = &fg_class;
fg->graph_desc = graph_desc;
fg->graph_desc = *graph_desc;
fgp->disable_conversions = !auto_conversion_filters;
fgp->nb_threads = -1;
fgp->sch = sch;
*graph_desc = NULL;
snprintf(fgp->log_name, sizeof(fgp->log_name), "fc#%d", fg->index);
fgp->frame = av_frame_alloc();
@ -1245,7 +1247,7 @@ fail:
int fg_create_simple(FilterGraph **pfg,
InputStream *ist,
char *graph_desc,
char **graph_desc,
Scheduler *sch, unsigned sched_idx_enc,
const OutputFilterOptions *opts)
{
@ -1270,7 +1272,7 @@ int fg_create_simple(FilterGraph **pfg,
"to have exactly 1 input and 1 output. "
"However, it had %d input(s) and %d output(s). Please adjust, "
"or use a complex filtergraph (-filter_complex) instead.\n",
graph_desc, fg->nb_inputs, fg->nb_outputs);
*graph_desc, fg->nb_inputs, fg->nb_outputs);
return AVERROR(EINVAL);
}
if (fg->outputs[0]->type != type) {

View File

@ -1003,7 +1003,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
ost->filter = ofilter;
ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts);
} else {
ret = fg_create_simple(&ost->fg_simple, ost->ist, filters,
ret = fg_create_simple(&ost->fg_simple, ost->ist, &filters,
mux->sch, ms->sch_idx_enc, &opts);
if (ret >= 0)
ost->filter = ost->fg_simple->outputs[0];

View File

@ -1496,7 +1496,7 @@ int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
/* create complex filtergraphs */
for (int i = 0; i < go.nb_filtergraphs; i++) {
ret = fg_create(NULL, go.filtergraphs[i], sch, NULL);
ret = fg_create(NULL, &go.filtergraphs[i], sch, NULL);
go.filtergraphs[i] = NULL;
if (ret < 0)
goto fail;

View File

@ -24,6 +24,7 @@
#include "aac_ac3_parser.h"
#include "adts_header.h"
#include "adts_parser.h"
#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
static int aac_sync(uint64_t state, int *need_next_header, int *new_frame_start)
@ -51,10 +52,10 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
}
const AVCodecParser ff_aac_parser = {
.codec_ids = { AV_CODEC_ID_AAC },
const FFCodecParser ff_aac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,
.parser_parse = ff_aac_ac3_parse,
.parser_close = ff_parse_close,
.init = aac_parse_init,
.parse = ff_aac_ac3_parse,
.close = ff_parse_close,
};

View File

@ -31,6 +31,7 @@
#include "ac3_parser_internal.h"
#include "aac_ac3_parser.h"
#include "get_bits.h"
#include "parser_internal.h"
#define AC3_HEADER_SIZE 7
@ -477,12 +478,12 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
}
const AVCodecParser ff_ac3_parser = {
.codec_ids = { AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3 },
const FFCodecParser ff_ac3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
.parser_parse = ff_aac_ac3_parse,
.parser_close = ff_parse_close,
.init = ac3_parse_init,
.parse = ff_aac_ac3_parse,
.close = ff_parse_close,
};
#else

View File

@ -25,9 +25,9 @@
* Splits packets into individual blocks.
*/
#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "adx.h"
#include "parser_internal.h"
typedef struct ADXParseContext {
ParseContext pc;
@ -98,9 +98,9 @@ static int adx_parse(AVCodecParserContext *s1,
return next;
}
const AVCodecParser ff_adx_parser = {
.codec_ids = { AV_CODEC_ID_ADPCM_ADX },
const FFCodecParser ff_adx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
.parser_parse = adx_parse,
.parser_close = ff_parse_close,
.parse = adx_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct AHXParseContext {
ParseContext pc;
@ -70,9 +71,9 @@ static int ahx_parse(AVCodecParserContext *s1,
return next;
}
const AVCodecParser ff_ahx_parser = {
.codec_ids = { AV_CODEC_ID_AHX },
const FFCodecParser ff_ahx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
.parser_parse = ahx_parse,
.parser_close = ff_parse_close,
.parse = ahx_parse,
.close = ff_parse_close,
};

View File

@ -28,6 +28,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "parser_internal.h"
static const uint8_t amrnb_packed_size[16] = {
13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
@ -122,10 +123,10 @@ static int amr_parse(AVCodecParserContext *s1,
return next;
}
const AVCodecParser ff_amr_parser = {
.codec_ids = { AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB },
const FFCodecParser ff_amr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
.parser_init = amr_parse_init,
.parser_parse = amr_parse,
.parser_close = ff_parse_close,
.init = amr_parse_init,
.parse = amr_parse,
.close = ff_parse_close,
};

View File

@ -23,6 +23,7 @@
#include "apv.h"
#include "cbs.h"
#include "cbs_apv.h"
#include "parser_internal.h"
typedef struct APVParseContext {
CodedBitstreamContext *cbc;
@ -140,10 +141,10 @@ static av_cold void close(AVCodecParserContext *s)
ff_cbs_close(&p->cbc);
}
const AVCodecParser ff_apv_parser = {
.codec_ids = { AV_CODEC_ID_APV },
const FFCodecParser ff_apv_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
.parser_init = init,
.parser_parse = parse,
.parser_close = close,
.init = init,
.parse = parse,
.close = close,
};

View File

@ -24,9 +24,10 @@
#include "libavutil/avassert.h"
#include "av1_parse.h"
#include "avcodec.h"
#include "cbs.h"
#include "cbs_av1.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct AV1ParseContext {
CodedBitstreamContext *cbc;
@ -209,10 +210,10 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
ff_cbs_close(&s->cbc);
}
const AVCodecParser ff_av1_parser = {
.codec_ids = { AV_CODEC_ID_AV1 },
const FFCodecParser ff_av1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
.parser_init = av1_parser_init,
.parser_close = av1_parser_close,
.parser_parse = av1_parser_parse,
.init = av1_parser_init,
.close = av1_parser_close,
.parse = av1_parser_parse,
};

View File

@ -2732,17 +2732,35 @@ typedef struct AVCodecParserContext {
} AVCodecParserContext;
typedef struct AVCodecParser {
#if FF_API_PARSER_CODECID
int codec_ids[7]; /* several codec IDs are permitted */
#else
enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
#endif
#if FF_API_PARSER_PRIVATE
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavcodec and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
attribute_deprecated
int priv_data_size;
attribute_deprecated
int (*parser_init)(AVCodecParserContext *s);
/* This callback never returns an error, a negative value means that
* the frame start was in a previous packet. */
attribute_deprecated
int (*parser_parse)(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
attribute_deprecated
void (*parser_close)(AVCodecParserContext *s);
attribute_deprecated
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
#endif
} AVCodecParser;
/**
@ -2756,7 +2774,11 @@ typedef struct AVCodecParser {
*/
const AVCodecParser *av_parser_iterate(void **opaque);
#if FF_API_PARSER_CODECID
AVCodecParserContext *av_parser_init(int codec_id);
#else
AVCodecParserContext *av_parser_init(enum AVCodecID codec_id);
#endif
/**
* Parse a packet.

View File

@ -23,6 +23,7 @@
#include "avs2.h"
#include "get_bits.h"
#include "parser.h"
#include "parser_internal.h"
static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@ -189,9 +190,9 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_avs2_parser = {
.codec_ids = { AV_CODEC_ID_AVS2 },
const FFCodecParser ff_avs2_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs2_parse,
.parser_close = ff_parse_close,
.parse = avs2_parse,
.close = ff_parse_close,
};

View File

@ -24,6 +24,7 @@
#include "avs3.h"
#include "get_bits.h"
#include "parser.h"
#include "parser_internal.h"
static int avs3_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@ -172,9 +173,9 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_avs3_parser = {
.codec_ids = { AV_CODEC_ID_AVS3 },
const FFCodecParser ff_avs3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs3_parse,
.parser_close = ff_parse_close,
.parse = avs3_parse,
.close = ff_parse_close,
};

View File

@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct BMPParseContext {
ParseContext pc;
@ -105,9 +106,9 @@ flush:
return next;
}
const AVCodecParser ff_bmp_parser = {
.codec_ids = { AV_CODEC_ID_BMP },
const FFCodecParser ff_bmp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
.parser_parse = bmp_parse,
.parser_close = ff_parse_close,
.parse = bmp_parse,
.close = ff_parse_close,
};

View File

@ -27,6 +27,7 @@
#include "parser.h"
#include "cavs.h"
#include "parser_internal.h"
/**
@ -96,9 +97,9 @@ static int cavsvideo_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_cavsvideo_parser = {
.codec_ids = { AV_CODEC_ID_CAVS },
const FFCodecParser ff_cavsvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
.parser_parse = cavsvideo_parse,
.parser_close = ff_parse_close,
.parse = cavsvideo_parse,
.close = ff_parse_close,
};

View File

@ -28,7 +28,8 @@
#include <stdint.h>
#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "avcodec.h"
#include "parser_internal.h"
typedef struct CookParseContext {
int duration;
@ -53,8 +54,8 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
const AVCodecParser ff_cook_parser = {
.codec_ids = { AV_CODEC_ID_COOK },
const FFCodecParser ff_cook_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
.parser_parse = cook_parse,
.parse = cook_parse,
};

View File

@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct CRIParser {
ParseContext pc;
@ -97,9 +98,9 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_cri_parser = {
.codec_ids = { AV_CODEC_ID_CRI },
const FFCodecParser ff_cri_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
.parser_parse = cri_parse,
.parser_close = ff_parse_close,
.parse = cri_parse,
.close = ff_parse_close,
};

View File

@ -29,6 +29,7 @@
#include "dca_syncwords.h"
#include "get_bits.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct DCAParseContext {
ParseContext pc;
@ -343,10 +344,10 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_dca_parser = {
.codec_ids = { AV_CODEC_ID_DTS },
const FFCodecParser ff_dca_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
.parser_parse = dca_parse,
.parser_close = ff_parse_close,
.init = dca_parse_init,
.parse = dca_parse,
.close = ff_parse_close,
};

View File

@ -34,6 +34,7 @@
#include "libavutil/mem.h"
#include "avcodec.h"
#include "parser_internal.h"
#define DIRAC_PARSE_INFO_PREFIX 0x42424344
@ -274,9 +275,9 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
av_freep(&pc->buffer);
}
const AVCodecParser ff_dirac_parser = {
.codec_ids = { AV_CODEC_ID_DIRAC },
const FFCodecParser ff_dirac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
.parser_parse = dirac_parse,
.parser_close = dirac_parse_close,
.parse = dirac_parse,
.close = dirac_parse_close,
};

View File

@ -26,6 +26,7 @@
#include "parser.h"
#include "dnxhddata.h"
#include "parser_internal.h"
typedef struct {
ParseContext pc;
@ -138,9 +139,9 @@ static int dnxhd_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_dnxhd_parser = {
.codec_ids = { AV_CODEC_ID_DNXHD },
const FFCodecParser ff_dnxhd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
.parser_parse = dnxhd_parse,
.parser_close = ff_parse_close,
.parse = dnxhd_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
#include "libavutil/bswap.h"
typedef struct DNxUcParseContext {
@ -81,9 +82,9 @@ static int dnxuc_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_dnxuc_parser = {
.codec_ids = { AV_CODEC_ID_DNXUC },
const FFCodecParser ff_dnxuc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
.parser_parse = dnxuc_parse,
.parser_close = ff_parse_close,
.parse = dnxuc_parse,
.close = ff_parse_close,
};

View File

@ -21,6 +21,7 @@
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "dolby_e.h"
#include "parser_internal.h"
typedef struct DBEParseContext {
DBEContext dectx;
@ -65,8 +66,8 @@ end:
return buf_size;
}
const AVCodecParser ff_dolby_e_parser = {
.codec_ids = { AV_CODEC_ID_DOLBY_E },
const FFCodecParser ff_dolby_e_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
.parser_parse = dolby_e_parse,
.parse = dolby_e_parse,
};

View File

@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct DPXParseContext {
ParseContext pc;
@ -108,9 +109,9 @@ flush:
return next;
}
const AVCodecParser ff_dpx_parser = {
.codec_ids = { AV_CODEC_ID_DPX },
const FFCodecParser ff_dpx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
.parser_parse = dpx_parse,
.parser_close = ff_parse_close,
.parse = dpx_parse,
.close = ff_parse_close,
};

View File

@ -23,8 +23,9 @@
* Determines the duration for each packet.
*/
#include "parser.h"
#include "avcodec.h"
#include "dvaudio.h"
#include "parser_internal.h"
static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@ -40,7 +41,7 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
const AVCodecParser ff_dvaudio_parser = {
.codec_ids = { AV_CODEC_ID_DVAUDIO },
.parser_parse = dvaudio_parse,
const FFCodecParser ff_dvaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
.parse = dvaudio_parse,
};

View File

@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "parser_internal.h"
/* Parser (mostly) copied from dvdsub.c */
@ -163,8 +164,8 @@ static int dvbsub_parse(AVCodecParserContext *s,
return buf_size;
}
const AVCodecParser ff_dvbsub_parser = {
.codec_ids = { AV_CODEC_ID_DVB_SUBTITLE },
const FFCodecParser ff_dvbsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
.parser_parse = dvbsub_parse,
.parse = dvbsub_parse,
};

View File

@ -18,9 +18,10 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "get_bits.h"
#include "parser.h"
#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
#define PCI_SIZE 980
#define DSI_SIZE 1018
@ -107,9 +108,9 @@ static int dvd_nav_parse(AVCodecParserContext *s,
return buf_size;
}
const AVCodecParser ff_dvd_nav_parser = {
.codec_ids = { AV_CODEC_ID_DVD_NAV },
const FFCodecParser ff_dvd_nav_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
.parser_init = dvd_nav_parse_init,
.parser_parse = dvd_nav_parse,
.init = dvd_nav_parse_init,
.parse = dvd_nav_parse,
};

View File

@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "parser_internal.h"
/* parser definition */
typedef struct DVDSubParseContext {
@ -84,9 +85,9 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
av_freep(&pc->packet);
}
const AVCodecParser ff_dvdsub_parser = {
.codec_ids = { AV_CODEC_ID_DVD_SUBTITLE },
const FFCodecParser ff_dvdsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
.parser_parse = dvdsub_parse,
.parser_close = dvdsub_parse_close,
.parse = dvdsub_parse,
.close = dvdsub_parse_close,
};

View File

@ -24,6 +24,7 @@
#include "bytestream.h"
#include "evc.h"
#include "evc_parse.h"
#include "parser_internal.h"
#include "libavutil/attributes.h"
@ -371,9 +372,9 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
ff_evc_ps_free(&ctx->ps);
}
const AVCodecParser ff_evc_parser = {
.codec_ids = { AV_CODEC_ID_EVC },
const FFCodecParser ff_evc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
.parser_parse = evc_parse,
.parser_close = evc_parser_close,
.parse = evc_parse,
.close = evc_parser_close,
};

View File

@ -18,6 +18,7 @@
#include "avcodec.h"
#include "ffv1.h"
#include "parser_internal.h"
#include "rangecoder.h"
#include "libavutil/attributes.h"
@ -80,9 +81,9 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
ff_ffv1_close(&p->f);
}
const AVCodecParser ff_ffv1_parser = {
.codec_ids = { AV_CODEC_ID_FFV1 },
const FFCodecParser ff_ffv1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
.parser_parse = parse,
.parser_close = ffv1_close,
.parse = parse,
.close = ffv1_close,
};

View File

@ -36,6 +36,7 @@
#include "libavutil/crc.h"
#include "libavutil/mem.h"
#include "flac_parse.h"
#include "parser_internal.h"
/** maximum number of adjacent headers that compare CRCs against each other */
#define FLAC_MAX_SEQUENTIAL_HEADERS 4
@ -902,10 +903,10 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
av_freep(&fpc->wrap_buf);
}
const AVCodecParser ff_flac_parser = {
.codec_ids = { AV_CODEC_ID_FLAC },
const FFCodecParser ff_flac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
.parser_parse = flac_parse,
.parser_close = flac_parse_close,
.init = flac_parse_init,
.parse = flac_parse,
.close = flac_parse_close,
};

View File

@ -28,6 +28,7 @@
#include "adts_header.h"
#include "adts_parser.h"
#include "mpeg4audio.h"
#include "parser_internal.h"
typedef struct FTRParseContext {
ParseContext pc;
@ -96,9 +97,9 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_ftr_parser = {
.codec_ids = { AV_CODEC_ID_FTR },
const FFCodecParser ff_ftr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
.parser_parse = ftr_parse,
.parser_close = ff_parse_close,
.parse = ftr_parse,
.close = ff_parse_close,
};

View File

@ -23,6 +23,7 @@
#include "parser.h"
#include "g723_1.h"
#include "parser_internal.h"
typedef struct G723_1ParseContext {
ParseContext pc;
@ -52,9 +53,9 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_g723_1_parser = {
.codec_ids = { AV_CODEC_ID_G723_1 },
const FFCodecParser ff_g723_1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
.parser_parse = g723_1_parse,
.parser_close = ff_parse_close,
.parse = g723_1_parse,
.close = ff_parse_close,
};

View File

@ -27,6 +27,7 @@
#include "parser.h"
#include "g729.h"
#include "parser_internal.h"
typedef struct G729ParseContext {
ParseContext pc;
@ -84,9 +85,9 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_g729_parser = {
.codec_ids = { AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN },
const FFCodecParser ff_g729_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
.parser_parse = g729_parse,
.parser_close = ff_parse_close,
.parse = g729_parse,
.close = ff_parse_close,
};

View File

@ -26,6 +26,7 @@
#include "gif.h"
#include "parser.h"
#include "parser_internal.h"
typedef enum GIFParseStates {
GIF_HEADER = 1,
@ -200,9 +201,9 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_gif_parser = {
.codec_ids = { AV_CODEC_ID_GIF },
const FFCodecParser ff_gif_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
.parser_parse = gif_parse,
.parser_close = ff_parse_close,
.parse = gif_parse,
.close = ff_parse_close,
};

View File

@ -28,6 +28,7 @@
#include "libavutil/avassert.h"
#include "parser.h"
#include "gsm.h"
#include "parser_internal.h"
typedef struct GSMParseContext {
ParseContext pc;
@ -83,9 +84,9 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_gsm_parser = {
.codec_ids = { AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS },
const FFCodecParser ff_gsm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
.parser_parse = gsm_parse,
.parser_close = ff_parse_close,
.parse = gsm_parse,
.close = ff_parse_close,
};

View File

@ -26,6 +26,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
static int h261_find_frame_end(ParseContext *pc, AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
@ -86,9 +87,9 @@ static int h261_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_h261_parser = {
.codec_ids = { AV_CODEC_ID_H261 },
const FFCodecParser ff_h261_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h261_parse,
.parser_close = ff_parse_close,
.parse = h261_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@ -87,9 +88,9 @@ static int h263_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_h263_parser = {
.codec_ids = { AV_CODEC_ID_H263 },
const FFCodecParser ff_h263_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h263_parse,
.parser_close = ff_parse_close,
.parse = h263_parse,
.close = ff_parse_close,
};

View File

@ -49,6 +49,7 @@
#include "mpegutils.h"
#include "parser.h"
#include "libavutil/refstruct.h"
#include "parser_internal.h"
#include "startcode.h"
typedef struct H264ParseContext {
@ -682,10 +683,10 @@ static av_cold int init(AVCodecParserContext *s)
return 0;
}
const AVCodecParser ff_h264_parser = {
.codec_ids = { AV_CODEC_ID_H264 },
const FFCodecParser ff_h264_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
.parser_init = init,
.parser_parse = h264_parse,
.parser_close = h264_close,
.init = init,
.parse = h264_parse,
.close = h264_close,
};

View File

@ -32,11 +32,9 @@
c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1_ ## depth ## _c; \
av_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
{

View File

@ -26,40 +26,6 @@
#include "bit_depth_template.c"
#define H264_CHROMA_MC(OPNAME, OP)\
static void FUNCC(OPNAME ## h264_chroma_mc1)(uint8_t *_dst /*align 8*/, const uint8_t *_src /*align 1*/, ptrdiff_t stride, int h, int x, int y){\
pixel *dst = (pixel*)_dst;\
const pixel *src = (const pixel*)_src;\
const int A=(8-x)*(8-y);\
const int B=( x)*(8-y);\
const int C=(8-x)*( y);\
const int D=( x)*( y);\
int i;\
stride >>= sizeof(pixel)-1;\
\
av_assert2(x<8 && y<8 && x>=0 && y>=0);\
\
if(D){\
for(i=0; i<h; i++){\
OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
dst+= stride;\
src+= stride;\
}\
} else if (B + C) {\
const int E= B+C;\
const int step= C ? stride : 1;\
for(i=0; i<h; i++){\
OP(dst[0], (A*src[0] + E*src[step+0]));\
dst+= stride;\
src+= stride;\
}\
} else {\
for(i=0; i<h; i++){\
OP(dst[0], (A*src[0]));\
dst+= stride;\
src+= stride;\
}\
}\
}\
static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst /*align 8*/, const uint8_t *_src /*align 1*/, ptrdiff_t stride, int h, int x, int y)\
{\
pixel *dst = (pixel*)_dst;\

View File

@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct HDRParseContext {
ParseContext pc;
@ -71,9 +72,9 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_hdr_parser = {
.codec_ids = { AV_CODEC_ID_RADIANCE_HDR },
const FFCodecParser ff_hdr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
.parser_parse = hdr_parse,
.parser_close = ff_parse_close,
.parse = hdr_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
#include "golomb.h"
#include "hevc.h"
#include "parser_internal.h"
#include "parse.h"
#include "ps.h"
#include "sei.h"
@ -352,9 +353,9 @@ static void hevc_parser_close(AVCodecParserContext *s)
av_freep(&ctx->pc.buffer);
}
const AVCodecParser ff_hevc_parser = {
.codec_ids = { AV_CODEC_ID_HEVC },
const FFCodecParser ff_hevc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
.parser_parse = hevc_parse,
.parser_close = hevc_parser_close,
.parse = hevc_parse,
.close = hevc_parser_close,
};

View File

@ -25,6 +25,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
typedef struct IPUParseContext {
ParseContext pc;
@ -69,9 +70,9 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_ipu_parser = {
.codec_ids = { AV_CODEC_ID_IPU },
const FFCodecParser ff_ipu_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
.parser_parse = ipu_parse,
.parser_close = ff_parse_close,
.parse = ipu_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
/* Whether frame is jp2 file or codestream
*/
@ -211,9 +212,9 @@ static int jpeg2000_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_jpeg2000_parser = {
.codec_ids = { AV_CODEC_ID_JPEG2000 },
const FFCodecParser ff_jpeg2000_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
.parser_parse = jpeg2000_parse,
.parser_close = ff_parse_close,
.parse = jpeg2000_parse,
.close = ff_parse_close,
};

View File

@ -32,6 +32,7 @@
#include "bytestream.h"
#include "codec_id.h"
#include "parser_internal.h"
#define UNCHECKED_BITSTREAM_READER 0
#define BITSTREAM_READER_LE
#include "get_bits.h"
@ -1545,9 +1546,9 @@ flush:
return next;
}
const AVCodecParser ff_jpegxl_parser = {
.codec_ids = { AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM },
const FFCodecParser ff_jpegxl_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
.parser_parse = jpegxl_parse,
.parser_close = ff_parse_close,
.parse = jpegxl_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
#include <stdint.h>
#include "parser.h"
#include "parser_internal.h"
#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits)
#define LATM_MASK 0xFFE000 // top 11 bits
@ -104,9 +105,9 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_aac_latm_parser = {
.codec_ids = { AV_CODEC_ID_AAC_LATM },
const FFCodecParser ff_aac_latm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
.parser_parse = latm_parse,
.parser_close = ff_parse_close
.parse = latm_parse,
.close = ff_parse_close
};

View File

@ -19,6 +19,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
typedef struct MISC4Context {
ParseContext pc;
@ -73,9 +74,9 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_misc4_parser = {
.codec_ids = { AV_CODEC_ID_MISC4 },
const FFCodecParser ff_misc4_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
.parser_parse = misc4_parse,
.parser_close = ff_parse_close,
.parse = misc4_parse,
.close = ff_parse_close,
};

View File

@ -27,6 +27,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
typedef struct MJPEGParserContext{
ParseContext pc;
@ -128,9 +129,9 @@ static int jpeg_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_mjpeg_parser = {
.codec_ids = { AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS },
const FFCodecParser ff_mjpeg_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
.parser_parse = jpeg_parse,
.parser_close = ff_parse_close,
.parse = jpeg_parse,
.close = ff_parse_close,
};

View File

@ -31,6 +31,7 @@
#include "parser.h"
#include "mlp_parse.h"
#include "mlp.h"
#include "parser_internal.h"
typedef struct MLPParseContext
{
@ -204,10 +205,10 @@ lost_sync:
return 1;
}
const AVCodecParser ff_mlp_parser = {
.codec_ids = { AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD },
const FFCodecParser ff_mlp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
.parser_init = mlp_init,
.parser_parse = mlp_parse,
.parser_close = ff_parse_close,
.init = mlp_init,
.parse = mlp_parse,
.close = ff_parse_close,
};

View File

@ -27,6 +27,7 @@
#include "mpegvideo.h"
#include "mpeg4videodec.h"
#include "mpeg4videodefs.h"
#include "parser_internal.h"
struct Mp4vParseContext {
ParseContext pc;
@ -155,10 +156,10 @@ static int mpeg4video_parse(AVCodecParserContext *s,
return next;
}
const AVCodecParser ff_mpeg4video_parser = {
.codec_ids = { AV_CODEC_ID_MPEG4 },
const FFCodecParser ff_mpeg4video_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
.parser_init = mpeg4video_parse_init,
.parser_parse = mpeg4video_parse,
.parser_close = ff_parse_close,
.init = mpeg4video_parse_init,
.parse = mpeg4video_parse,
.close = ff_parse_close,
};

View File

@ -22,6 +22,7 @@
#include "parser.h"
#include "mpegaudiodecheader.h"
#include "parser_internal.h"
#include "libavutil/common.h"
#include "libavformat/apetag.h" // for APE tag.
#include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE
@ -136,9 +137,10 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_mpegaudio_parser = {
.codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU },
const FFCodecParser ff_mpegaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
.parser_parse = mpegaudio_parse,
.parser_close = ff_parse_close,
.parse = mpegaudio_parse,
.close = ff_parse_close,
};

View File

@ -44,6 +44,45 @@
#include "threadprogress.h"
#include "wmv2dec.h"
#define H264_CHROMA_MC(OPNAME, OP)\
static void OPNAME ## h264_chroma_mc1(uint8_t *dst /*align 8*/, const uint8_t *src /*align 1*/, ptrdiff_t stride, int h, int x, int y)\
{\
const int A = (8-x) * (8-y);\
const int B = ( x) * (8-y);\
const int C = (8-x) * ( y);\
const int D = ( x) * ( y);\
\
av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);\
\
if (D) {\
for (int i = 0; i < h; ++i) {\
OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
dst += stride;\
src += stride;\
}\
} else if (B + C) {\
const int E = B + C;\
const int step = C ? stride : 1;\
for (int i = 0; i < h; ++i) {\
OP(dst[0], (A*src[0] + E*src[step+0]));\
dst += stride;\
src += stride;\
}\
} else {\
for (int i = 0; i < h; ++i) {\
OP(dst[0], (A*src[0]));\
dst += stride;\
src += stride;\
}\
}\
}\
#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
#define op_put(a, b) a = (((b) + 32)>>6)
H264_CHROMA_MC(put_, op_put)
H264_CHROMA_MC(avg_, op_avg)
av_cold int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
{
enum ThreadingStatus thread_status;
@ -62,6 +101,8 @@ av_cold int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
ff_mpv_idct_init(s);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
s->h264chroma.avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1;
s->h264chroma.put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1;
if (s->picture_pool) // VC-1 can call this multiple times
return 0;

View File

@ -25,6 +25,7 @@
#include "parser.h"
#include "mpeg12.h"
#include "mpeg12data.h"
#include "parser_internal.h"
#include "startcode.h"
struct MpvParseContext {
@ -299,10 +300,10 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
return 0;
}
const AVCodecParser ff_mpegvideo_parser = {
.codec_ids = { AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO },
const FFCodecParser ff_mpegvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
.parser_init = mpegvideo_parse_init,
.parser_parse = mpegvideo_parse,
.parser_close = ff_parse_close,
.init = mpegvideo_parse_init,
.parse = mpegvideo_parse,
.close = ff_parse_close,
};

View File

@ -31,6 +31,7 @@
#include "opus.h"
#include "parse.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct OpusParserContext {
ParseContext pc;
@ -213,9 +214,9 @@ fail:
return buf_size;
}
const AVCodecParser ff_opus_parser = {
.codec_ids = { AV_CODEC_ID_OPUS },
const FFCodecParser ff_opus_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
.parser_parse = opus_parse,
.parser_close = ff_parse_close
.parse = opus_parse,
.close = ff_parse_close
};

View File

@ -29,11 +29,17 @@
#include "libavutil/mem.h"
#include "parser.h"
#include "parser_internal.h"
#if FF_API_PARSER_CODECID
av_cold AVCodecParserContext *av_parser_init(int codec_id)
#else
av_cold AVCodecParserContext *av_parser_init(enum AVCodecID codec_id)
#endif
{
AVCodecParserContext *s = NULL;
const AVCodecParser *parser;
const FFCodecParser *ffparser;
void *i = 0;
int ret;
@ -53,17 +59,18 @@ av_cold AVCodecParserContext *av_parser_init(int codec_id)
return NULL;
found:
ffparser = ffcodecparser(parser);
s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
goto err_out;
s->parser = parser;
s->priv_data = av_mallocz(parser->priv_data_size);
s->priv_data = av_mallocz(ffparser->priv_data_size);
if (!s->priv_data)
goto err_out;
s->fetch_timestamp=1;
s->pict_type = AV_PICTURE_TYPE_I;
if (parser->parser_init) {
ret = parser->parser_init(s);
if (ffparser->init) {
ret = ffparser->init(s);
if (ret != 0)
goto err_out;
}
@ -161,8 +168,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
ff_fetch_timestamp(s, 0, 0, 0);
}
/* WARNING: the returned index can be negative */
index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
poutbuf_size, buf, buf_size);
index = ffcodecparser(s->parser)->parse(s, avctx, (const uint8_t **) poutbuf,
poutbuf_size, buf, buf_size);
av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes
#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
@ -194,8 +201,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
av_cold void av_parser_close(AVCodecParserContext *s)
{
if (s) {
if (s->parser->parser_close)
s->parser->parser_close(s);
if (ffcodecparser(s->parser)->close)
ffcodecparser(s->parser)->close(s);
av_freep(&s->priv_data);
av_free(s);
}

View File

@ -0,0 +1,83 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_PARSER_INTERNAL_H
#define AVCODEC_PARSER_INTERNAL_H
#include <stdint.h>
#include "libavutil/macros.h"
#include "avcodec.h"
#include "codec_id.h"
#if FF_API_PARSER_PRIVATE
typedef union FFCodecParser {
struct {
#if FF_API_PARSER_CODECID
int codec_ids[7]; /* several codec IDs are permitted */
#else
enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
#endif
int priv_data_size;
int (*init)(AVCodecParserContext *s);
int (*parse)(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void (*close)(AVCodecParserContext *s);
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
};
AVCodecParser p;
#else
typedef struct FFCodecParser {
AVCodecParser p;
unsigned priv_data_size;
int (*init)(AVCodecParserContext *s);
int (*parse)(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void (*close)(AVCodecParserContext *s);
#endif
} FFCodecParser;
static inline const FFCodecParser *ffcodecparser(const AVCodecParser *parser)
{
return (const FFCodecParser*)parser;
}
#define EIGTH_ARG(a,b,c,d,e,f,g,h,...) h
#define NO_FAIL
// Expands to nothing if <= 7 args; induces compilation failure if not.
#define CHECK_FOR_TOO_MANY_IDS(...) AV_JOIN(EIGTH_ARG(__VA_ARGS__, NO, NO, NO, NO, NO, NO, NO, NO), _FAIL)
// For compatibility with MSVC's old, spec-incompliant preprocessor.
#define FF_MSVC_EXPAND(...) __VA_ARGS__
#define FIRST_SEVEN2(a,b,c,d,e,f,g,...) a,b,c,d,e,f,g
#define FIRST_SEVEN(...) FF_MSVC_EXPAND(FIRST_SEVEN2(__VA_ARGS__))
#define TIMES_SEVEN(a) a,a,a,a,a,a,a
#if FF_API_PARSER_PRIVATE
#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
#else
#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
.p.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
#endif
#endif /* AVCODEC_PARSER_INTERNAL_H */

View File

@ -19,83 +19,102 @@
#include <stdint.h>
#include "avcodec.h"
#include "parser_internal.h"
extern const AVCodecParser ff_aac_parser;
extern const AVCodecParser ff_aac_latm_parser;
extern const AVCodecParser ff_ac3_parser;
extern const AVCodecParser ff_adx_parser;
extern const AVCodecParser ff_ahx_parser;
extern const AVCodecParser ff_amr_parser;
extern const AVCodecParser ff_apv_parser;
extern const AVCodecParser ff_av1_parser;
extern const AVCodecParser ff_avs2_parser;
extern const AVCodecParser ff_avs3_parser;
extern const AVCodecParser ff_bmp_parser;
extern const AVCodecParser ff_cavsvideo_parser;
extern const AVCodecParser ff_cook_parser;
extern const AVCodecParser ff_cri_parser;
extern const AVCodecParser ff_dca_parser;
extern const AVCodecParser ff_dirac_parser;
extern const AVCodecParser ff_dnxhd_parser;
extern const AVCodecParser ff_dnxuc_parser;
extern const AVCodecParser ff_dolby_e_parser;
extern const AVCodecParser ff_dpx_parser;
extern const AVCodecParser ff_dvaudio_parser;
extern const AVCodecParser ff_dvbsub_parser;
extern const AVCodecParser ff_dvdsub_parser;
extern const AVCodecParser ff_dvd_nav_parser;
extern const AVCodecParser ff_evc_parser;
extern const AVCodecParser ff_flac_parser;
extern const AVCodecParser ff_ftr_parser;
extern const AVCodecParser ff_ffv1_parser;
extern const AVCodecParser ff_g723_1_parser;
extern const AVCodecParser ff_g729_parser;
extern const AVCodecParser ff_gif_parser;
extern const AVCodecParser ff_gsm_parser;
extern const AVCodecParser ff_h261_parser;
extern const AVCodecParser ff_h263_parser;
extern const AVCodecParser ff_h264_parser;
extern const AVCodecParser ff_hevc_parser;
extern const AVCodecParser ff_hdr_parser;
extern const AVCodecParser ff_ipu_parser;
extern const AVCodecParser ff_jpeg2000_parser;
extern const AVCodecParser ff_jpegxl_parser;
extern const AVCodecParser ff_misc4_parser;
extern const AVCodecParser ff_mjpeg_parser;
extern const AVCodecParser ff_mlp_parser;
extern const AVCodecParser ff_mpeg4video_parser;
extern const AVCodecParser ff_mpegaudio_parser;
extern const AVCodecParser ff_mpegvideo_parser;
extern const AVCodecParser ff_opus_parser;
extern const AVCodecParser ff_prores_parser;
extern const AVCodecParser ff_png_parser;
extern const AVCodecParser ff_pnm_parser;
extern const AVCodecParser ff_prores_raw_parser;
extern const AVCodecParser ff_qoi_parser;
extern const AVCodecParser ff_rv34_parser;
extern const AVCodecParser ff_sbc_parser;
extern const AVCodecParser ff_sipr_parser;
extern const AVCodecParser ff_tak_parser;
extern const AVCodecParser ff_vc1_parser;
extern const AVCodecParser ff_vorbis_parser;
extern const AVCodecParser ff_vp3_parser;
extern const AVCodecParser ff_vp8_parser;
extern const AVCodecParser ff_vp9_parser;
extern const AVCodecParser ff_vvc_parser;
extern const AVCodecParser ff_webp_parser;
extern const AVCodecParser ff_xbm_parser;
extern const AVCodecParser ff_xma_parser;
extern const AVCodecParser ff_xwd_parser;
#if FF_API_PARSER_PRIVATE
#include "libavutil/internal.h"
#include <assert.h>
#include <stddef.h>
FF_DISABLE_DEPRECATION_WARNINGS
#define CHECK_OFFSET(field, public_prefix) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.public_prefix ## field), "Wrong offsets")
CHECK_OFFSET(codec_ids,);
CHECK_OFFSET(priv_data_size,);
CHECK_OFFSET(init, parser_);
CHECK_OFFSET(parse, parser_);
CHECK_OFFSET(close, parser_);
CHECK_OFFSET(split,);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
extern const FFCodecParser ff_aac_parser;
extern const FFCodecParser ff_aac_latm_parser;
extern const FFCodecParser ff_ac3_parser;
extern const FFCodecParser ff_adx_parser;
extern const FFCodecParser ff_ahx_parser;
extern const FFCodecParser ff_amr_parser;
extern const FFCodecParser ff_apv_parser;
extern const FFCodecParser ff_av1_parser;
extern const FFCodecParser ff_avs2_parser;
extern const FFCodecParser ff_avs3_parser;
extern const FFCodecParser ff_bmp_parser;
extern const FFCodecParser ff_cavsvideo_parser;
extern const FFCodecParser ff_cook_parser;
extern const FFCodecParser ff_cri_parser;
extern const FFCodecParser ff_dca_parser;
extern const FFCodecParser ff_dirac_parser;
extern const FFCodecParser ff_dnxhd_parser;
extern const FFCodecParser ff_dnxuc_parser;
extern const FFCodecParser ff_dolby_e_parser;
extern const FFCodecParser ff_dpx_parser;
extern const FFCodecParser ff_dvaudio_parser;
extern const FFCodecParser ff_dvbsub_parser;
extern const FFCodecParser ff_dvdsub_parser;
extern const FFCodecParser ff_dvd_nav_parser;
extern const FFCodecParser ff_evc_parser;
extern const FFCodecParser ff_flac_parser;
extern const FFCodecParser ff_ftr_parser;
extern const FFCodecParser ff_ffv1_parser;
extern const FFCodecParser ff_g723_1_parser;
extern const FFCodecParser ff_g729_parser;
extern const FFCodecParser ff_gif_parser;
extern const FFCodecParser ff_gsm_parser;
extern const FFCodecParser ff_h261_parser;
extern const FFCodecParser ff_h263_parser;
extern const FFCodecParser ff_h264_parser;
extern const FFCodecParser ff_hevc_parser;
extern const FFCodecParser ff_hdr_parser;
extern const FFCodecParser ff_ipu_parser;
extern const FFCodecParser ff_jpeg2000_parser;
extern const FFCodecParser ff_jpegxl_parser;
extern const FFCodecParser ff_misc4_parser;
extern const FFCodecParser ff_mjpeg_parser;
extern const FFCodecParser ff_mlp_parser;
extern const FFCodecParser ff_mpeg4video_parser;
extern const FFCodecParser ff_mpegaudio_parser;
extern const FFCodecParser ff_mpegvideo_parser;
extern const FFCodecParser ff_opus_parser;
extern const FFCodecParser ff_prores_parser;
extern const FFCodecParser ff_png_parser;
extern const FFCodecParser ff_pnm_parser;
extern const FFCodecParser ff_prores_raw_parser;
extern const FFCodecParser ff_qoi_parser;
extern const FFCodecParser ff_rv34_parser;
extern const FFCodecParser ff_sbc_parser;
extern const FFCodecParser ff_sipr_parser;
extern const FFCodecParser ff_tak_parser;
extern const FFCodecParser ff_vc1_parser;
extern const FFCodecParser ff_vorbis_parser;
extern const FFCodecParser ff_vp3_parser;
extern const FFCodecParser ff_vp8_parser;
extern const FFCodecParser ff_vp9_parser;
extern const FFCodecParser ff_vvc_parser;
extern const FFCodecParser ff_webp_parser;
extern const FFCodecParser ff_xbm_parser;
extern const FFCodecParser ff_xma_parser;
extern const FFCodecParser ff_xwd_parser;
#include "libavcodec/parser_list.c"
const AVCodecParser *av_parser_iterate(void **opaque)
{
uintptr_t i = (uintptr_t)*opaque;
const AVCodecParser *p = parser_list[i];
const FFCodecParser *p = parser_list[i];
if (p)
if (p) {
*opaque = (void*)(i + 1);
return &p->p;
}
return p;
return NULL;
}

View File

@ -25,6 +25,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
#include "png.h"
typedef struct PNGParseContext {
@ -110,9 +111,9 @@ flush:
return next;
}
const AVCodecParser ff_png_parser = {
.codec_ids = { AV_CODEC_ID_PNG },
const FFCodecParser ff_png_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
.parser_parse = png_parse,
.parser_close = ff_parse_close,
.parse = png_parse,
.close = ff_parse_close,
};

View File

@ -23,6 +23,7 @@
#include "libavutil/imgutils.h"
#include "parser.h" //for ParseContext
#include "parser_internal.h"
#include "pnm.h"
typedef struct PNMParseContext {
@ -133,11 +134,11 @@ end:
return next;
}
const AVCodecParser ff_pnm_parser = {
.codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
AV_CODEC_ID_PHM },
const FFCodecParser ff_pnm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
AV_CODEC_ID_PHM),
.priv_data_size = sizeof(PNMParseContext),
.parser_parse = pnm_parse,
.parser_close = ff_parse_close,
.parse = pnm_parse,
.close = ff_parse_close,
};

View File

@ -20,6 +20,7 @@
#include "bytestream.h"
#include "avcodec.h"
#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@ -122,7 +123,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
const AVCodecParser ff_prores_parser = {
.codec_ids = { AV_CODEC_ID_PRORES },
.parser_parse = parse,
const FFCodecParser ff_prores_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
.parse = parse,
};

View File

@ -20,6 +20,7 @@
#include "parser.h"
#include "bytestream.h"
#include "parser_internal.h"
static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@ -96,7 +97,7 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return buf_size;
}
const AVCodecParser ff_prores_raw_parser = {
.codec_ids = { AV_CODEC_ID_PRORES_RAW },
.parser_parse = prores_raw_parse,
const FFCodecParser ff_prores_raw_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
.parse = prores_raw_parse,
};

View File

@ -25,6 +25,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
typedef struct QOIParseContext {
ParseContext pc;
@ -69,9 +70,9 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_qoi_parser = {
.codec_ids = { AV_CODEC_ID_QOI },
const FFCodecParser ff_qoi_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
.parser_parse = qoi_parse,
.parser_close = ff_parse_close,
.parse = qoi_parse,
.close = ff_parse_close,
};

View File

@ -25,6 +25,7 @@
*/
#include "avcodec.h"
#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
typedef struct RV34ParseContext {
@ -75,8 +76,8 @@ static int rv34_parse(AVCodecParserContext *s,
return buf_size;
}
const AVCodecParser ff_rv34_parser = {
.codec_ids = { AV_CODEC_ID_RV30, AV_CODEC_ID_RV40 },
const FFCodecParser ff_rv34_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
.parse = rv34_parse,
};

View File

@ -24,6 +24,7 @@
* RV40 decoder motion compensation functions
*/
#include "libavutil/attributes_internal.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "h264qpel.h"
@ -283,7 +284,7 @@ static void avg_rv40_qpel8_mc33_c(uint8_t *dst, const uint8_t *src, ptrdiff_t st
avg_pixels8_xy2_8_c(dst, src, stride, 8);
}
static const int rv40_bias[4][4] = {
attribute_visibility_hidden const int ff_rv40_bias[4][4] = {
{ 0, 16, 32, 16 },
{ 32, 28, 32, 28 },
{ 0, 32, 16, 32 },
@ -300,7 +301,7 @@ static void OPNAME ## rv40_chroma_mc4_c(uint8_t *dst /*align 8*/,\
const int C = (8-x) * ( y);\
const int D = ( x) * ( y);\
int i;\
int bias = rv40_bias[y>>1][x>>1];\
int bias = ff_rv40_bias[y>>1][x>>1];\
\
av_assert2(x<8 && y<8 && x>=0 && y>=0);\
\
@ -336,7 +337,7 @@ static void OPNAME ## rv40_chroma_mc8_c(uint8_t *dst/*align 8*/,\
const int C = (8-x) * ( y);\
const int D = ( x) * ( y);\
int i;\
int bias = rv40_bias[y>>1][x>>1];\
int bias = ff_rv40_bias[y>>1][x>>1];\
\
av_assert2(x<8 && y<8 && x>=0 && y>=0);\
\

View File

@ -22,6 +22,7 @@
#include "sbc.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct SBCParseContext {
ParseContext pc;
@ -116,9 +117,9 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_sbc_parser = {
.codec_ids = { AV_CODEC_ID_SBC },
const FFCodecParser ff_sbc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
.parser_parse = sbc_parse,
.parser_close = ff_parse_close,
.parse = sbc_parse,
.close = ff_parse_close,
};

View File

@ -22,6 +22,7 @@
*/
#include "parser.h"
#include "parser_internal.h"
typedef struct SiprParserContext{
ParseContext pc;
@ -66,9 +67,9 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_sipr_parser = {
.codec_ids = { AV_CODEC_ID_SIPR },
const FFCodecParser ff_sipr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
.parser_parse = sipr_parse,
.parser_close = ff_parse_close,
.parse = sipr_parse,
.close = ff_parse_close,
};

View File

@ -27,6 +27,7 @@
#define CACHED_BITSTREAM_READER !ARCH_X86_32
#define BITSTREAM_READER_LE
#include "parser.h"
#include "parser_internal.h"
#include "tak.h"
typedef struct TAKParseContext {
@ -123,9 +124,9 @@ fail:
return buf_size + consumed;
}
const AVCodecParser ff_tak_parser = {
.codec_ids = { AV_CODEC_ID_TAK },
const FFCodecParser ff_tak_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
.parser_parse = tak_parse,
.parser_close = ff_parse_close,
.parse = tak_parse,
.close = ff_parse_close,
};

View File

@ -28,6 +28,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "parser.h"
#include "parser_internal.h"
#include "vc1.h"
#include "get_bits.h"
#include "vc1dsp.h"
@ -216,7 +217,8 @@ static int vc1_parse(AVCodecParserContext *s,
if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) {
pic_found = 1;
}
else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) {
else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)
&& b != (VC1_CODE_ENDOFSEQ & 0xFF)) {
next = i - 4;
pic_found = b == (VC1_CODE_FRAME & 0xFF);
break;
@ -270,10 +272,10 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
return 0;
}
const AVCodecParser ff_vc1_parser = {
.codec_ids = { AV_CODEC_ID_VC1 },
const FFCodecParser ff_vc1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
.parser_init = vc1_parse_init,
.parser_parse = vc1_parse,
.parser_close = ff_parse_close,
.init = vc1_parse_init,
.parse = vc1_parse,
.close = ff_parse_close,
};

View File

@ -468,9 +468,6 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx)
if (ret < 0)
return ret;
ff_permute_scantable(s->intra_scantable.permutated, ff_wmv1_scantable[1],
s->idsp.idct_permutation);
ret = vc1_decode_init_alloc_tables(v);
if (ret < 0) {
vc1_decode_reset(avctx);
@ -835,8 +832,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
if(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
s->low_delay = 1;
if (buf_size >= 4 && AV_RB32(&buf[buf_size-4]) == VC1_CODE_ENDOFSEQ)
buf_size -= 4;
/* no supplementary picture */
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {
if (buf_size == 0) {
/* special case for last picture */
if (s->low_delay == 0 && s->next_pic.ptr) {
if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0)
@ -1369,12 +1369,7 @@ image:
}
end:
av_free(buf2);
for (i = 0; i < n_slices; i++)
av_free(slices[i].buf);
av_free(slices);
return buf_size;
ret = buf_size;
err:
av_free(buf2);
for (i = 0; i < n_slices; i++)

View File

@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 17
#define LIBAVCODEC_VERSION_MINOR 19
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -45,6 +45,9 @@
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove the OMX encoder on next major bump
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump

View File

@ -31,6 +31,7 @@
#include "libavutil/mem.h"
#include "get_bits.h"
#include "parser_internal.h"
#include "xiph.h"
#include "vorbis_parser_internal.h"
@ -335,10 +336,10 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
av_vorbis_parse_free(&s->vp);
}
const AVCodecParser ff_vorbis_parser = {
.codec_ids = { AV_CODEC_ID_VORBIS },
const FFCodecParser ff_vorbis_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
.parser_parse = vorbis_parse,
.parser_close = vorbis_parser_close,
.parse = vorbis_parse,
.close = vorbis_parser_close,
};
#endif /* CONFIG_VORBIS_PARSER */

View File

@ -18,7 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "parser.h"
#include "avcodec.h"
#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@ -35,10 +36,8 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
const AVCodecParser ff_vp3_parser = {
.codec_ids = {
AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A
},
.parser_parse = parse,
const FFCodecParser ff_vp3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
.parse = parse,
};

View File

@ -19,6 +19,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@ -73,7 +74,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
const AVCodecParser ff_vp8_parser = {
.codec_ids = { AV_CODEC_ID_VP8 },
.parser_parse = parse,
const FFCodecParser ff_vp8_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
.parse = parse,
};

View File

@ -21,9 +21,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "libavcodec/get_bits.h"
#include "parser.h"
#include "avcodec.h"
#include "get_bits.h"
#include "parser_internal.h"
static int parse(AVCodecParserContext *ctx,
AVCodecContext *avctx,
@ -64,7 +64,7 @@ static int parse(AVCodecParserContext *ctx,
return size;
}
const AVCodecParser ff_vp9_parser = {
.codec_ids = { AV_CODEC_ID_VP9 },
.parser_parse = parse,
const FFCodecParser ff_vp9_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
.parse = parse,
};

View File

@ -24,6 +24,7 @@
#include "cbs.h"
#include "cbs_h266.h"
#include "parser.h"
#include "parser_internal.h"
#define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
#define IS_IDR(nut) (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP)
@ -505,10 +506,10 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
av_freep(&ctx->pc.buffer);
}
const AVCodecParser ff_vvc_parser = {
.codec_ids = { AV_CODEC_ID_VVC },
const FFCodecParser ff_vvc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
.parser_init = vvc_parser_init,
.parser_close = vvc_parser_close,
.parser_parse = vvc_parser_parse,
.init = vvc_parser_init,
.close = vvc_parser_close,
.parse = vvc_parser_parse,
};

View File

@ -27,6 +27,7 @@
#include "libavutil/common.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct WebPParseContext {
ParseContext pc;
@ -104,9 +105,9 @@ flush:
return next;
}
const AVCodecParser ff_webp_parser = {
.codec_ids = { AV_CODEC_ID_WEBP },
const FFCodecParser ff_webp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
.parser_parse = webp_parse,
.parser_close = ff_parse_close,
.parse = webp_parse,
.close = ff_parse_close,
};

View File

@ -20,43 +20,11 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "config_components.asm"
%include "libavutil/x86/x86util.asm"
SECTION_RODATA
rnd_rv40_2d_tbl: times 4 dw 0
times 4 dw 16
times 4 dw 32
times 4 dw 16
times 4 dw 32
times 4 dw 28
times 4 dw 32
times 4 dw 28
times 4 dw 0
times 4 dw 32
times 4 dw 16
times 4 dw 32
times 4 dw 32
times 4 dw 28
times 4 dw 32
times 4 dw 28
rnd_rv40_1d_tbl: times 4 dw 0
times 4 dw 2
times 4 dw 4
times 4 dw 2
times 4 dw 4
times 4 dw 3
times 4 dw 4
times 4 dw 3
times 4 dw 0
times 4 dw 4
times 4 dw 2
times 4 dw 4
times 4 dw 4
times 4 dw 3
times 4 dw 4
times 4 dw 3
cextern pw_3
cextern pw_4
cextern pw_8
@ -64,6 +32,8 @@ pw_28: times 8 dw 28
cextern pw_32
cextern pw_64
cextern rv40_bias
SECTION .text
%macro mv0_pixels_mc8 0
@ -89,285 +59,6 @@ SECTION .text
jne .next4rows
%endmacro
%macro chroma_mc8_mmx_func 2-3
%ifidn %2, rv40
%if PIC
%define rnd_1d_rv40 r8
%define rnd_2d_rv40 r8
%define extra_regs 2
%else ; no-PIC
%define rnd_1d_rv40 rnd_rv40_1d_tbl
%define rnd_2d_rv40 rnd_rv40_2d_tbl
%define extra_regs 1
%endif ; PIC
%else
%define extra_regs 0
%endif ; rv40
; void ff_put/avg_h264_chroma_mc8_*(uint8_t *dst /* align 8 */,
; const uint8_t *src /* align 1 */,
; ptrdiff_t stride, int h, int mx, int my)
cglobal %1_%2_chroma_mc8%3, 6, 7 + extra_regs, 0
mov r6d, r5d
or r6d, r4d
jne .at_least_one_non_zero
; mx == 0 AND my == 0 - no filter needed
mv0_pixels_mc8
RET
.at_least_one_non_zero:
%ifidn %2, rv40
%if ARCH_X86_64
mov r7, r5
and r7, 6 ; &~1 for mx/my=[0,7]
lea r7, [r7*4+r4]
sar r7d, 1
%define rnd_bias r7
%define dest_reg r0
%else ; x86-32
mov r0, r5
and r0, 6 ; &~1 for mx/my=[0,7]
lea r0, [r0*4+r4]
sar r0d, 1
%define rnd_bias r0
%define dest_reg r5
%endif
%else ; vc1, h264
%define rnd_bias 0
%define dest_reg r0
%endif
test r5d, r5d
mov r6, 1
je .my_is_zero
test r4d, r4d
mov r6, r2 ; dxy = x ? 1 : stride
jne .both_non_zero
.my_is_zero:
; mx == 0 XOR my == 0 - 1 dimensional filter only
or r4d, r5d ; x + y
%ifidn %2, rv40
%if PIC
lea r8, [rnd_rv40_1d_tbl]
%endif
%if ARCH_X86_64 == 0
mov r5, r0m
%endif
%endif
movd m5, r4d
movq m4, [pw_8]
movq m6, [rnd_1d_%2+rnd_bias*8] ; mm6 = rnd >> 3
punpcklwd m5, m5
punpckldq m5, m5 ; mm5 = B = x
pxor m7, m7
psubw m4, m5 ; mm4 = A = 8-x
.next1drow:
movq m0, [r1 ] ; mm0 = src[0..7]
movq m2, [r1+r6] ; mm1 = src[1..8]
movq m1, m0
movq m3, m2
punpcklbw m0, m7
punpckhbw m1, m7
punpcklbw m2, m7
punpckhbw m3, m7
pmullw m0, m4 ; [mm0,mm1] = A * src[0..7]
pmullw m1, m4
pmullw m2, m5 ; [mm2,mm3] = B * src[1..8]
pmullw m3, m5
paddw m0, m6
paddw m1, m6
paddw m0, m2
paddw m1, m3
psrlw m0, 3
psrlw m1, 3
packuswb m0, m1
CHROMAMC_AVG m0, [dest_reg]
movq [dest_reg], m0 ; dst[0..7] = (A * src[0..7] + B * src[1..8] + (rnd >> 3)) >> 3
add dest_reg, r2
add r1, r2
dec r3d
jne .next1drow
RET
.both_non_zero: ; general case, bilinear
movd m4, r4d ; x
movd m6, r5d ; y
%ifidn %2, rv40
%if PIC
lea r8, [rnd_rv40_2d_tbl]
%endif
%if ARCH_X86_64 == 0
mov r5, r0m
%endif
%endif
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, 16 ; AA and DD
punpcklwd m4, m4
punpcklwd m6, m6
punpckldq m4, m4 ; mm4 = x words
punpckldq m6, m6 ; mm6 = y words
movq m5, m4
pmullw m4, m6 ; mm4 = x * y
psllw m5, 3
psllw m6, 3
movq m7, m5
paddw m7, m6
movq [rsp+8], m4 ; DD = x * y
psubw m5, m4 ; mm5 = B = 8x - xy
psubw m6, m4 ; mm6 = C = 8y - xy
paddw m4, [pw_64]
psubw m4, m7 ; mm4 = A = xy - (8x+8y) + 64
pxor m7, m7
movq [rsp ], m4
movq m0, [r1 ] ; mm0 = src[0..7]
movq m1, [r1+1] ; mm1 = src[1..8]
.next2drow:
add r1, r2
movq m2, m0
movq m3, m1
punpckhbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
punpckhbw m3, m7
pmullw m0, [rsp]
pmullw m2, [rsp]
pmullw m1, m5
pmullw m3, m5
paddw m2, m1 ; mm2 = A * src[0..3] + B * src[1..4]
paddw m3, m0 ; mm3 = A * src[4..7] + B * src[5..8]
movq m0, [r1]
movq m1, m0
punpcklbw m0, m7
punpckhbw m1, m7
pmullw m0, m6
pmullw m1, m6
paddw m2, m0
paddw m3, m1 ; [mm2,mm3] += C * src[0..7]
movq m1, [r1+1]
movq m0, m1
movq m4, m1
punpcklbw m0, m7
punpckhbw m4, m7
pmullw m0, [rsp+8]
pmullw m4, [rsp+8]
paddw m2, m0
paddw m3, m4 ; [mm2,mm3] += D * src[1..8]
movq m0, [r1]
paddw m2, [rnd_2d_%2+rnd_bias*8]
paddw m3, [rnd_2d_%2+rnd_bias*8]
psrlw m2, 6
psrlw m3, 6
packuswb m2, m3
CHROMAMC_AVG m2, [dest_reg]
movq [dest_reg], m2 ; dst[0..7] = ([mm2,mm3] + rnd) >> 6
add dest_reg, r2
dec r3d
jne .next2drow
mov rsp, r6 ; restore stack pointer
RET
%endmacro
%macro chroma_mc4_mmx_func 2
%define extra_regs 0
%ifidn %2, rv40
%if PIC
%define extra_regs 1
%endif ; PIC
%endif ; rv40
cglobal %1_%2_chroma_mc4, 6, 6 + extra_regs, 0
pxor m7, m7
movd m2, r4d ; x
movd m3, r5d ; y
movq m4, [pw_8]
movq m5, [pw_8]
punpcklwd m2, m2
punpcklwd m3, m3
punpcklwd m2, m2
punpcklwd m3, m3
psubw m4, m2
psubw m5, m3
%ifidn %2, rv40
%if PIC
lea r6, [rnd_rv40_2d_tbl]
%define rnd_2d_rv40 r6
%else
%define rnd_2d_rv40 rnd_rv40_2d_tbl
%endif
and r5, 6 ; &~1 for mx/my=[0,7]
lea r5, [r5*4+r4]
sar r5d, 1
%define rnd_bias r5
%else ; vc1, h264
%define rnd_bias 0
%endif
movd m0, [r1 ]
movd m6, [r1+1]
add r1, r2
punpcklbw m0, m7
punpcklbw m6, m7
pmullw m0, m4
pmullw m6, m2
paddw m6, m0
.next2rows:
movd m0, [r1 ]
movd m1, [r1+1]
add r1, r2
punpcklbw m0, m7
punpcklbw m1, m7
pmullw m0, m4
pmullw m1, m2
paddw m1, m0
movq m0, m1
pmullw m6, m5
pmullw m1, m3
paddw m6, [rnd_2d_%2+rnd_bias*8]
paddw m1, m6
psrlw m1, 6
packuswb m1, m1
CHROMAMC_AVG4 m1, m6, [r0]
movd [r0], m1
add r0, r2
movd m6, [r1 ]
movd m1, [r1+1]
add r1, r2
punpcklbw m6, m7
punpcklbw m1, m7
pmullw m6, m4
pmullw m1, m2
paddw m1, m6
movq m6, m1
pmullw m0, m5
pmullw m1, m3
paddw m0, [rnd_2d_%2+rnd_bias*8]
paddw m1, m0
psrlw m1, 6
packuswb m1, m1
CHROMAMC_AVG4 m1, m0, [r0]
movd [r0], m1
add r0, r2
sub r3d, 2
jnz .next2rows
RET
%endmacro
%macro chroma_mc2_mmx_func 2
cglobal %1_%2_chroma_mc2, 6, 7, 0
mov r6d, r4d
@ -425,33 +116,23 @@ cglobal %1_%2_chroma_mc2, 6, 7, 0
PAVGB %1, %2
%endmacro
INIT_MMX mmx
%define CHROMAMC_AVG NOTHING
%define CHROMAMC_AVG4 NOTHING
chroma_mc8_mmx_func put, h264, _rnd
chroma_mc8_mmx_func put, vc1, _nornd
chroma_mc8_mmx_func put, rv40
chroma_mc4_mmx_func put, h264
chroma_mc4_mmx_func put, rv40
INIT_MMX mmxext
%define CHROMAMC_AVG NOTHING
%define CHROMAMC_AVG4 NOTHING
chroma_mc2_mmx_func put, h264
%define CHROMAMC_AVG DIRECT_AVG
%define CHROMAMC_AVG4 COPY_AVG
chroma_mc8_mmx_func avg, h264, _rnd
chroma_mc8_mmx_func avg, vc1, _nornd
chroma_mc8_mmx_func avg, rv40
chroma_mc4_mmx_func avg, h264
chroma_mc4_mmx_func avg, rv40
chroma_mc2_mmx_func avg, h264
%macro chroma_mc8_ssse3_func 2-3
cglobal %1_%2_chroma_mc8%3, 6, 7, 8
cglobal %1_%2_chroma_mc8%3, 6, 7+UNIX64, 8
mov r6d, r5d
or r6d, r4d
jne .at_least_one_non_zero
; mx == 0 AND my == 0 - no filter needed
..@%1_%2_chroma_mc8_no_filter_ %+ cpuname:
mv0_pixels_mc8
RET
@ -462,6 +143,8 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
je .mx_is_zero
; general case, bilinear
movdqa m5, [rnd_2d_%2]
..@%1_%2_chroma_mc8_both_nonzero_ %+ cpuname:
mov r6d, r4d
shl r4d, 8
sub r4, r6
@ -473,7 +156,6 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
movd m7, r6d
movd m6, r4d
movdqa m5, [rnd_2d_%2]
movq m0, [r1 ]
movq m1, [r1+1]
pshuflw m7, m7, 0
@ -517,12 +199,13 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
RET
.my_is_zero:
movdqa m6, [rnd_1d_%2]
..@%1_%2_chroma_mc8_my_zero_ %+ cpuname:
mov r5d, r4d
shl r4d, 8
add r4, 8
sub r4, r5 ; 255*x+8 = x<<8 | (8-x)
movd m7, r4d
movdqa m6, [rnd_1d_%2]
pshuflw m7, m7, 0
movlhps m7, m7
@ -554,12 +237,13 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
RET
.mx_is_zero:
movdqa m6, [rnd_1d_%2]
..@%1_%2_chroma_mc8_mx_zero_ %+ cpuname:
mov r4d, r5d
shl r5d, 8
add r5, 8
sub r5, r4 ; 255*y+8 = y<<8 | (8-y)
movd m7, r5d
movdqa m6, [rnd_1d_%2]
pshuflw m7, m7, 0
movlhps m7, m7
@ -592,7 +276,9 @@ cglobal %1_%2_chroma_mc8%3, 6, 7, 8
%endmacro
%macro chroma_mc4_ssse3_func 2
cglobal %1_%2_chroma_mc4, 6, 7, 0
cglobal %1_%2_chroma_mc4, 6, 7+UNIX64, 0
movq m5, [pw_32]
..@%1_%2_chroma_mc4_after_init_ %+ cpuname:
mov r6, r4
shl r4d, 8
sub r4d, r6d
@ -604,7 +290,6 @@ cglobal %1_%2_chroma_mc4, 6, 7, 0
movd m7, r6d
movd m6, r4d
movq m5, [pw_32]
movd m0, [r1 ]
pshufw m7, m7, 0
punpcklbw m0, [r1+1]
@ -641,16 +326,79 @@ cglobal %1_%2_chroma_mc4, 6, 7, 0
RET
%endmacro
%macro rv40_get_bias 1 ; dst reg
%if !PIC || UNIX64
; on UNIX64 we have enough volatile registers
%if PIC && UNIX64
lea r7, [rv40_bias]
%endif
mov r6d, r5d
and r6d, 6 ; &~1 for mx/my=[0,7]
lea r6d, [r6d*4+r4d]
sar r6d, 1
%if PIC && UNIX64
movd %1, [r7+4*r6]
%else
movd %1, [rv40_bias+4*r6]
%endif
%else ; PIC && !UNIX64, de facto WIN64
lea r6, [rv40_bias]
%ifidn r5d, r5m ; always false for currently supported calling conventions
push r5
%endif
and r5d, 6 ; &~1 for mx/my=[0,7]
lea r5d, [r5d*4+r4d]
sar r5d, 1
movd %1, [r6+4*r5]
%ifidn r5d, r5m
pop r5
%else
mov r5d, r5m
%endif
%endif
SPLATW %1, %1
%endmacro
%macro rv40_chroma_mc8_func 1 ; put vs avg
%if CONFIG_RV40_DECODER
cglobal rv40_%1_chroma_mc8, 6, 7+UNIX64, 8
mov r6d, r5d
or r6d, r4d
jz ..@%1_h264_chroma_mc8_no_filter_ %+ cpuname
rv40_get_bias m5
; the bilinear code expects bias in m5, the one-dimensional code in m6
mova m6, m5
psraw m6, 3
test r5d, r5d
je ..@%1_h264_chroma_mc8_my_zero_ %+ cpuname
test r4d, r4d
je ..@%1_h264_chroma_mc8_mx_zero_ %+ cpuname
jmp ..@%1_h264_chroma_mc8_both_nonzero_ %+ cpuname
%endif
%endmacro
%macro rv40_chroma_mc4_func 1 ; put vs avg
%if CONFIG_RV40_DECODER
cglobal rv40_%1_chroma_mc4, 6, 7+UNIX64, 0
rv40_get_bias m5
jmp ..@%1_h264_chroma_mc4_after_init_ %+ cpuname
%endif
%endmacro
%define CHROMAMC_AVG NOTHING
INIT_XMM ssse3
chroma_mc8_ssse3_func put, h264, _rnd
chroma_mc8_ssse3_func put, vc1, _nornd
rv40_chroma_mc8_func put
INIT_MMX ssse3
chroma_mc4_ssse3_func put, h264
rv40_chroma_mc4_func put
%define CHROMAMC_AVG DIRECT_AVG
INIT_XMM ssse3
chroma_mc8_ssse3_func avg, h264, _rnd
chroma_mc8_ssse3_func avg, vc1, _nornd
rv40_chroma_mc8_func avg
INIT_MMX ssse3
chroma_mc4_ssse3_func avg, h264
rv40_chroma_mc4_func avg

View File

@ -28,31 +28,20 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/h264qpel.h"
#include "fpel.h"
#include "qpel.h"
#if HAVE_X86ASM
void ff_avg_pixels4_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t stride);
void ff_put_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t stride);
void ff_avg_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t stride);
void ff_put_pixels8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_avg_pixels8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_pixels16_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_avg_pixels16_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
#define ff_put_pixels4_l2_mmxext(dst, src1, src2, dststride, src1stride, h) \
ff_put_pixels4_l2_mmxext((dst), (src1), (src2), (dststride))
#define ff_avg_pixels4_l2_mmxext(dst, src1, src2, dststride, src1stride, h) \
ff_avg_pixels4_l2_mmxext((dst), (src1), (src2), (dststride))
#define ff_put_pixels8_l2_sse2 ff_put_pixels8_l2_mmxext
#define ff_avg_pixels8_l2_sse2(dst, src1, src2, dststride, src1stride, h) \
ff_avg_pixels8_l2_mmxext((dst), (src1), (src2), (dststride), (src1stride))
#define ff_put_pixels16_l2_sse2 ff_put_pixels16_l2_mmxext
#define ff_avg_pixels16_l2_sse2(dst, src1, src2, dststride, src1stride, h) \
ff_avg_pixels16_l2_mmxext((dst), (src1), (src2), (dststride), (src1stride))
void ff_put_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t stride);
void ff_avg_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
ptrdiff_t stride);
#define ff_put_pixels4x4_l2_mmxext(dst, src1, src2, dststride, src1stride) \
ff_put_pixels4x4_l2_mmxext((dst), (src1), (src2), (dststride))
#define ff_avg_pixels4x4_l2_mmxext(dst, src1, src2, dststride, src1stride) \
ff_avg_pixels4x4_l2_mmxext((dst), (src1), (src2), (dststride))
#define ff_put_pixels8x8_l2_sse2 ff_put_pixels8x8_l2_mmxext
#define ff_avg_pixels8x8_l2_sse2 ff_avg_pixels8x8_l2_mmxext
#define DEF_QPEL(OPNAME)\
void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride);\
@ -184,7 +173,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, const uin
{\
LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*SIZE]);\
ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
ff_ ## OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\
ff_ ## OPNAME ## pixels ## SIZE ## x ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride);\
}\
\
static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
@ -196,7 +185,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, const uin
{\
LOCAL_ALIGNED(ALIGN, uint8_t, temp, [SIZE*SIZE]);\
ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
ff_ ## OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\
ff_ ## OPNAME ## pixels ## SIZE ## x ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride);\
}\
#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN, SHIFT5_EXT) \

View File

@ -69,11 +69,11 @@ cglobal avg_pixels4, 3,4
mova %2, %1
%endmacro
; void ff_put/avg_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t stride)
; void ff_put/avg_pixels4x4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t stride)
%macro PIXELS4_L2 1
%define OP op_%1h
cglobal %1_pixels4_l2, 4,4
cglobal %1_pixels4x4_l2, 4,4
mova m0, [r1]
mova m1, [r1+r3]
lea r1, [r1+2*r3]

View File

@ -24,16 +24,6 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/h264chroma.h"
void ff_put_h264_chroma_mc8_rnd_mmx (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_h264_chroma_mc8_rnd_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_put_h264_chroma_mc4_mmx (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_h264_chroma_mc4_mmxext (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_put_h264_chroma_mc2_mmxext (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_h264_chroma_mc2_mmxext (uint8_t *dst, const uint8_t *src,
@ -68,14 +58,7 @@ av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
int high_bit_depth = bit_depth > 8;
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(cpu_flags) && !high_bit_depth) {
c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_rnd_mmx;
c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_mmx;
}
if (EXTERNAL_MMXEXT(cpu_flags) && !high_bit_depth) {
c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_mmxext;
c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_mmxext;
c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_mmxext;
c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_mmxext;
}

View File

@ -34,63 +34,65 @@ SECTION .text
mova %2, %1
%endmacro
%macro PIXELS8_L2 1
%macro PIXELS_L2 2-3 ; avg vs put, size, size+1
%define OP op_%1
%ifidn %1, put
; void ff_put_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
cglobal put_pixels8_l2, 6,6
test r5d, 1
je .loop
mova m0, [r1]
mova m1, [r2]
%if notcpuflag(sse2) ; SSE2 currently only uses 16x16
; void ff_put_pixels8x9_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal put_pixels%2x%3_l2, 5,6,2
movu m0, [r1]
pavgb m0, [r2]
add r1, r4
add r2, 8
pavgb m0, m1
add r2, mmsize
OP m0, [r0]
add r0, r3
dec r5d
%else
; void ff_avg_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal avg_pixels8_l2, 5,6
mov r5d, 8
; FIXME: avoid jump if prologue is empty
jmp %1_pixels%2x%2_after_prologue_ %+ cpuname
%endif
%endif
; void ff_avg/put_pixels8x8_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal %1_pixels%2x%2_l2, 5,6,2
%1_pixels%2x%2_after_prologue_ %+ cpuname:
mov r5d, %2
.loop:
mova m0, [r1]
mova m1, [r1+r4]
movu m0, [r1]
movu m1, [r1+r4]
lea r1, [r1+2*r4]
pavgb m0, [r2]
pavgb m1, [r2+8]
pavgb m1, [r2+mmsize]
OP m0, [r0]
OP m1, [r0+r3]
lea r0, [r0+2*r3]
mova m0, [r1]
mova m1, [r1+r4]
movu m0, [r1]
movu m1, [r1+r4]
lea r1, [r1+2*r4]
pavgb m0, [r2+16]
pavgb m1, [r2+24]
pavgb m0, [r2+2*mmsize]
pavgb m1, [r2+3*mmsize]
OP m0, [r0]
OP m1, [r0+r3]
lea r0, [r0+2*r3]
add r2, 32
add r2, 4*mmsize
sub r5d, 4
jne .loop
RET
%endmacro
INIT_MMX mmxext
PIXELS8_L2 put
PIXELS8_L2 avg
PIXELS_L2 put, 8, 9
PIXELS_L2 avg, 8
INIT_XMM sse2
PIXELS_L2 put, 16, 17
PIXELS_L2 avg, 16
%macro PIXELS16_L2 1
%define OP op_%1
%ifidn %1, put
; void ff_put_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
cglobal put_pixels16_l2, 6,6
test r5d, 1
je .loop
; void ff_put_pixels16x17_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal put_pixels16x17_l2, 5,6
mova m0, [r1]
mova m1, [r1+8]
pavgb m0, [r2]
@ -100,13 +102,14 @@ cglobal put_pixels16_l2, 6,6
OP m0, [r0]
OP m1, [r0+8]
add r0, r3
dec r5d
%else
; void ff_avg_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal avg_pixels16_l2, 5,6
mov r5d, 16
; FIXME: avoid jump if prologue is empty
jmp %1_pixels16x16_after_prologue_ %+ cpuname
%endif
; void ff_avg/put_pixels16x16_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal %1_pixels16x16_l2, 5,6
%1_pixels16x16_after_prologue_ %+ cpuname:
mov r5d, 16
.loop:
mova m0, [r1]
mova m1, [r1+8]

44
libavcodec/x86/qpel.h Normal file
View File

@ -0,0 +1,44 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_X86_QPEL_H
#define AVCODEC_X86_QPEL_H
#include <stddef.h>
#include <stdint.h>
void ff_put_pixels8x8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_avg_pixels8x8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_pixels16x16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_pixels16x16_l2_sse2(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_avg_pixels16x16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_avg_pixels16x16_l2_sse2(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
#endif /* AVCODEC_X86_QPEL_H */

View File

@ -32,13 +32,11 @@ cextern pw_20
SECTION .text
; void ff_put_no_rnd_pixels8_l2(uint8_t *dst, uint8_t *src1, uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
%macro PUT_NO_RND_PIXELS8_L2 0
cglobal put_no_rnd_pixels8_l2, 6,6
; void ff_put_no_rnd_pixels8x9_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal put_no_rnd_pixels8x9_l2, 5,6
pcmpeqb m6, m6
test r5d, 1
je .loop
mova m0, [r1]
mova m1, [r2]
add r1, r4
@ -49,7 +47,14 @@ cglobal put_no_rnd_pixels8_l2, 6,6
pxor m0, m6
mova [r0], m0
add r0, r3
dec r5d
jmp put_no_rnd_pixels8x8_after_prologue_ %+ cpuname
; void ff_put_no_rnd_pixels8x8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal put_no_rnd_pixels8x8_l2, 5,6
pcmpeqb m6, m6
put_no_rnd_pixels8x8_after_prologue_ %+ cpuname:
mov r5d, 8
.loop:
mova m0, [r1]
add r1, r4
@ -97,13 +102,11 @@ INIT_MMX mmxext
PUT_NO_RND_PIXELS8_L2
; void ff_put_no_rnd_pixels16_l2(uint8_t *dst, uint8_t *src1, uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride, int h)
; void ff_put_no_rnd_pixels16x17_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
%macro PUT_NO_RND_PIXELS16_l2 0
cglobal put_no_rnd_pixels16_l2, 6,6
cglobal put_no_rnd_pixels16x17_l2, 5,6
pcmpeqb m6, m6
test r5d, 1
je .loop
mova m0, [r1]
mova m1, [r1+8]
mova m2, [r2]
@ -121,7 +124,14 @@ cglobal put_no_rnd_pixels16_l2, 6,6
mova [r0], m0
mova [r0+8], m1
add r0, r3
dec r5d
jmp put_no_rnd_pixels16x16_after_prologue_ %+ cpuname
; void ff_put_no_rnd_pixels16x16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; ptrdiff_t dstStride, ptrdiff_t src1Stride)
cglobal put_no_rnd_pixels16x16_l2, 5,6
pcmpeqb m6, m6
put_no_rnd_pixels16x16_after_prologue_ %+ cpuname:
mov r5d, 16
.loop:
mova m0, [r1]
mova m1, [r1+8]

View File

@ -27,28 +27,28 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/pixels.h"
#include "libavcodec/qpeldsp.h"
#include "fpel.h"
#include "qpel.h"
void ff_put_pixels8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_put_no_rnd_pixels8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_avg_pixels8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_pixels16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_avg_pixels16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_no_rnd_pixels16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride, int h);
void ff_put_pixels8x9_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_pixels16x17_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_no_rnd_pixels8x8_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_no_rnd_pixels8x9_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_no_rnd_pixels16x16_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_no_rnd_pixels16x17_l2_mmxext(uint8_t *dst,
const uint8_t *src1, const uint8_t *src2,
ptrdiff_t dstStride, ptrdiff_t src1Stride);
void ff_put_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t dstStride, ptrdiff_t srcStride, int h);
void ff_avg_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, const uint8_t *src,
@ -82,7 +82,7 @@ void ff_put_no_rnd_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst,
#if HAVE_X86ASM
#define QPEL_OP(OPNAME, RND, MMX, ARG) \
#define QPEL_OP(OPNAME, RND, MMX) \
static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, \
const uint8_t *src, \
ptrdiff_t stride) \
@ -91,8 +91,8 @@ static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \
stride, 8); \
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src, half, \
stride, stride, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, \
@ -111,8 +111,8 @@ static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \
stride, 8); \
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src + 1, half, \
stride, stride, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src + 1, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, \
@ -123,8 +123,8 @@ static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, \
8, stride); \
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src, half, \
stride, stride, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, \
@ -143,8 +143,8 @@ static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, \
8, stride); \
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, src + stride, half, \
stride, stride, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, src + stride, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, \
@ -156,11 +156,11 @@ static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, \
stride, 9); \
ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src, halfH, 8, \
stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH, halfHV, \
stride, 8, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH, halfHV, \
stride, 8); \
} \
\
static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, \
@ -172,11 +172,11 @@ static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
stride, 9); \
ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src + 1, halfH, 8, \
stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH, halfHV, \
stride, 8, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH, halfHV, \
stride, 8); \
} \
\
static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, \
@ -188,11 +188,11 @@ static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, \
stride, 9); \
ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src, halfH, 8, \
stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH + 8, halfHV, \
stride, 8, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH + 8, halfHV, \
stride, 8); \
} \
\
static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, \
@ -204,11 +204,11 @@ static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
stride, 9); \
ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src + 1, halfH, 8, \
stride); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH + 8, halfHV, \
stride, 8, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH + 8, halfHV, \
stride, 8); \
} \
\
static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, \
@ -221,8 +221,8 @@ static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH, halfHV, \
stride, 8, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH, halfHV, \
stride, 8); \
} \
\
static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, \
@ -235,8 +235,8 @@ static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
ff_ ## OPNAME ## pixels8_l2_ ## MMX(ARG(dst, halfH + 8, halfHV, \
stride, 8, 8)); \
ff_ ## OPNAME ## pixels8x8_l2_ ## MMX(dst, halfH + 8, halfHV, \
stride, 8); \
} \
\
static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, \
@ -247,8 +247,8 @@ static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, \
8, stride, 9); \
ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src, halfH, \
8, stride); \
ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \
stride, 8); \
} \
@ -261,8 +261,8 @@ static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
stride, 9); \
ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
stride, 9); \
ff_put ## RND ## pixels8x9_l2_ ## MMX(halfH, src + 1, halfH, 8, \
stride); \
ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \
stride, 8); \
} \
@ -287,8 +287,8 @@ static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \
stride, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src, half, \
stride, stride, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, \
@ -307,8 +307,8 @@ static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t*) temp; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \
stride, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src + 1, half, \
stride, stride, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src + 1, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, \
@ -319,8 +319,8 @@ static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \
stride); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src, half, \
stride, stride, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, \
@ -339,8 +339,8 @@ static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, \
uint8_t *const half = (uint8_t *) temp; \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \
stride); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, src+stride, half, \
stride, stride, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, src+stride, half, \
stride, stride); \
} \
\
static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, \
@ -352,12 +352,12 @@ static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
stride, 17); \
ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src, halfH, 16, \
stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH, halfHV, \
stride, 16, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH, halfHV, \
stride, 16); \
} \
\
static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, \
@ -369,12 +369,12 @@ static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
stride, 17); \
ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src + 1, halfH, 16, \
stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH, halfHV, \
stride, 16, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH, halfHV, \
stride, 16); \
} \
\
static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, \
@ -386,12 +386,12 @@ static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
stride, 17); \
ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src, halfH, 16, \
stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH + 16, halfHV, \
stride, 16, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH + 16, halfHV, \
stride, 16); \
} \
\
static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, \
@ -403,12 +403,12 @@ static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, \
uint8_t *const halfHV = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
stride, 17); \
ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src + 1, halfH, 16, \
stride); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH + 16, halfHV, \
stride, 16, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH + 16, halfHV, \
stride, 16); \
} \
\
static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, \
@ -422,8 +422,8 @@ static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, \
stride, 17); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH, halfHV, \
stride, 16, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH, halfHV, \
stride, 16); \
} \
\
static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, \
@ -437,8 +437,8 @@ static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, \
stride, 17); \
ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
16, 16); \
ff_ ## OPNAME ## pixels16_l2_ ## MMX(ARG(dst, halfH + 16, halfHV, \
stride, 16, 16)); \
ff_ ## OPNAME ## pixels16x16_l2_ ## MMX(dst, halfH + 16, halfHV, \
stride, 16); \
} \
\
static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, \
@ -449,8 +449,8 @@ static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
stride, 17); \
ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src, halfH, 16, \
stride); \
ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \
stride, 16); \
} \
@ -463,8 +463,8 @@ static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, \
uint8_t *const halfH = (uint8_t *) half; \
ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
stride, 17); \
ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
stride, 17); \
ff_put ## RND ## pixels16x17_l2_ ## MMX(halfH, src + 1, halfH, 16, \
stride); \
ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \
stride, 16); \
} \
@ -481,13 +481,9 @@ static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, \
stride, 16); \
}
#define PASSTHROUGH(...) __VA_ARGS__
#define STRIP_HEIGHT(dst, src1, src2, dststride, srcstride, height) \
(dst), (src1), (src2), (dststride), (srcstride)
QPEL_OP(put_, _, mmxext, PASSTHROUGH)
QPEL_OP(avg_, _, mmxext, STRIP_HEIGHT)
QPEL_OP(put_no_rnd_, _no_rnd_, mmxext, PASSTHROUGH)
QPEL_OP(put_, _, mmxext)
QPEL_OP(avg_, _, mmxext)
QPEL_OP(put_no_rnd_, _no_rnd_, mmxext)
#endif /* HAVE_X86ASM */

View File

@ -40,16 +40,6 @@ static void op##_rv40_qpel##size##_mc33_##insn(uint8_t *dst, const uint8_t *src,
}
#if HAVE_X86ASM
void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_rv40_chroma_mc8_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_put_rv40_chroma_mc4_mmx (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_rv40_chroma_mc4_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
#define DECLARE_WEIGHT(opt) \
void ff_rv40_weight_func_rnd_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride); \
@ -178,6 +168,12 @@ DEFINE_FN(avg, 8, ssse3)
DEFINE_FN(avg, 16, sse2)
DEFINE_FN(avg, 16, ssse3)
#define CHROMA_MC_FUNC(OP, SIZE, XMM) \
void ff_rv40_ ## OP ## _chroma_mc ## SIZE ## _ ## XMM(uint8_t *dst, const uint8_t *src, \
ptrdiff_t stride, int h, int x, int y);\
c->OP ## _chroma_pixels_tab[SIZE == 4] = ff_rv40_ ## OP ## _chroma_mc ## SIZE ## _ ## XMM
#endif /* HAVE_X86ASM */
av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
@ -185,14 +181,6 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
av_unused int cpu_flags = av_get_cpu_flags();
#if HAVE_X86ASM
if (EXTERNAL_MMX(cpu_flags)) {
c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
}
if (EXTERNAL_MMXEXT(cpu_flags)) {
c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmxext;
c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmxext;
}
if (EXTERNAL_SSE2(cpu_flags)) {
c->put_pixels_tab[0][15] = put_rv40_qpel16_mc33_sse2;
c->avg_pixels_tab[0][15] = avg_rv40_qpel16_mc33_sse2;
@ -204,6 +192,10 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
QPEL_MC_SET(avg_, _sse2)
}
if (EXTERNAL_SSSE3(cpu_flags)) {
CHROMA_MC_FUNC(put, 8, ssse3);
CHROMA_MC_FUNC(put, 4, ssse3);
CHROMA_MC_FUNC(avg, 8, ssse3);
CHROMA_MC_FUNC(avg, 4, ssse3);
c->put_pixels_tab[0][15] = put_rv40_qpel16_mc33_ssse3;
c->put_pixels_tab[1][15] = put_rv40_qpel8_mc33_ssse3;
c->avg_pixels_tab[0][15] = avg_rv40_qpel16_mc33_ssse3;

View File

@ -80,10 +80,6 @@ DECLARE_FUNCTION(avg_, 16, _sse2)
#endif /* HAVE_X86ASM */
void ff_put_vc1_chroma_mc8_nornd_mmx (uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_vc1_chroma_mc8_nornd_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h, int x, int y);
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
@ -122,13 +118,8 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
#if HAVE_X86ASM
if (EXTERNAL_MMX(cpu_flags)) {
dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_mmx;
}
if (EXTERNAL_MMXEXT(cpu_flags)) {
ASSIGN_LF4(mmxext);
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_mmxext;
dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_vc1_mspel_mc00_8_mmxext;

View File

@ -30,6 +30,7 @@
#include "libavutil/avutil.h"
#include "parser.h"
#include "parser_internal.h"
typedef struct XBMParseContext {
ParseContext pc;
@ -100,10 +101,10 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_xbm_parser = {
.codec_ids = { AV_CODEC_ID_XBM },
const FFCodecParser ff_xbm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
.parser_init = xbm_init,
.parser_parse = xbm_parse,
.parser_close = ff_parse_close,
.init = xbm_init,
.parse = xbm_parse,
.close = ff_parse_close,
};

View File

@ -21,7 +21,8 @@
* XMA2 audio parser
*/
#include "parser.h"
#include "avcodec.h"
#include "parser_internal.h"
typedef struct XMAParserContext{
int skip_packets;
@ -55,8 +56,8 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
const AVCodecParser ff_xma_parser = {
.codec_ids = { AV_CODEC_ID_XMA2 },
const FFCodecParser ff_xma_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
.parser_parse = xma_parse,
.parse = xma_parse,
};

View File

@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "parser_internal.h"
#include "xwd.h"
typedef struct XWDParseContext {
@ -95,9 +96,9 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
const AVCodecParser ff_xwd_parser = {
.codec_ids = { AV_CODEC_ID_XWD },
const FFCodecParser ff_xwd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
.parser_parse = xwd_parse,
.parser_close = ff_parse_close,
.parse = xwd_parse,
.close = ff_parse_close,
};

View File

@ -100,7 +100,7 @@ const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries
else if (((unsigned)prm >= AVCOL_PRI_EXT_BASE) &&
((unsigned)prm < AVCOL_PRI_EXT_NB))
p = &color_primaries_ext[prm - AVCOL_PRI_EXT_BASE];
if (!p->prim.r.x.num)
if (!p || !p->prim.r.x.num)
return NULL;
return p;
}

View File

@ -51,7 +51,7 @@ static void check_chroma_mc(void)
for (int bit_depth = 8; bit_depth <= 10; bit_depth++) {
ff_h264chroma_init(&h, bit_depth);
randomize_buffers(bit_depth);
for (int size = 0; size < 4; size++) {
for (int size = 0; size < 3; size++) {
#define CHECK_CHROMA_MC(name) \
do { \