The lavfi_pix_fmts test is disabled, this because there are many tests which are failing, and there are still some output files which cannot be played by NUT/ffplay. Originally committed as revision 23297 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -261,6 +261,7 @@ LAVFI_TESTS = \ · 260 unmodified lines | |||
| 261 | vflip \ | 261 | vflip \ |
| 262 | vflip_crop \ | 262 | vflip_crop \ |
| 263 | vflip_vflip \ | 263 | vflip_vflip \ |
| 264 | # lavfi_pix_fmts \ | ||
| 264 | 265 | ||
| 265 | ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes)) | 266 | ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes)) |
| 266 | VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes)) | 267 | VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes)) |
| @@ -309,7 +310,7 @@ $(LAVF_TESTS): · 42 unmodified lines | |||
| 309 | @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)" | 310 | @$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)" |
| 310 | @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@) | 311 | @diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@) |
| 311 | 312 | ||
| 312 | $(LAVFI_TESTS): | 313 | $(LAVFI_TESTS): tools/lavfi-showfiltfmts$(EXESUF) |
| 313 | @echo "TEST LAVFI $(@:regtest-%=%)" | 314 | @echo "TEST LAVFI $(@:regtest-%=%)" |
| 314 | @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)" | 315 | @$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)" |
| 315 | @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@) | 316 | @diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@) |
| @@ -14,6 +14,18 @@ eval do_$test=y · 13 unmodified lines | |||
| 14 | rm -f "$logfile" | 14 | rm -f "$logfile" |
| 15 | rm -f "$benchfile" | 15 | rm -f "$benchfile" |
| 16 | 16 | ||
| 17 | get_common_elements() ( | ||
| 18 | l1=$1 | ||
| 19 | l2=$2 | ||
| 20 | for elt1 in $1; do | ||
| 21 | for elt2 in $2; do | ||
| 22 | [ $elt1 = $elt2 ] && res="$res $elt1 " | ||
| 23 | done | ||
| 24 | done | ||
| 25 | |||
| 26 | echo $res | ||
| 27 | ) | ||
| 28 | |||
| 17 | do_lavfi() { | 29 | do_lavfi() { |
| 18 | test_name=$1 | 30 | test_name=$1 |
| 19 | eval test=\$do_$test_name | 31 | eval test=\$do_$test_name |
| @@ -35,9 +47,32 @@ do_lavfi "vflip" "vflip" · 15 unmodified lines | |||
| 35 | do_lavfi "vflip_crop" "vflip,crop=100:100" | 47 | do_lavfi "vflip_crop" "vflip,crop=100:100" |
| 36 | do_lavfi "vflip_vflip" "vflip,vflip" | 48 | do_lavfi "vflip_vflip" "vflip,vflip" |
| 37 | 49 | ||
| 50 | # all these filters have exactly one input and exactly one output | ||
| 51 | filters_args=" | ||
| 52 | crop=100:100:100:100 | ||
| 53 | null | ||
| 54 | pad=500:400:20:20 | ||
| 55 | scale=200:100 | ||
| 56 | vflip | ||
| 57 | " | ||
| 58 | |||
| 59 | if [ -n "$do_lavfi_pix_fmts" ]; then | ||
| 60 | scale_out_pix_fmts=$(tools/lavfi-showfiltfmts scale | grep "^OUTPUT" | cut -d: -f2) | ||
| 61 | |||
| 62 | for filter_args in $filters_args; do | ||
| 63 | filter=$(echo $filter_args | sed -e 's/\([^=]\+\)=.*/\1/') | ||
| 64 | in_pix_fmts=$(tools/lavfi-showfiltfmts $filter | grep "^INPUT" | cut -d: -f2) | ||
| 65 | pix_fmts=$(get_common_elements "$in_pix_fmts" "$scale_out_pix_fmts") | ||
| 66 | |||
| 67 | for pix_fmt in $pix_fmts; do | ||
| 68 | do_video_encoding "${pix_fmt}-${filter}.nut" "" \ | ||
| 69 | "-vf slicify=random,format=$pix_fmt,$filter_args -vcodec rawvideo -pix_fmt $pix_fmt" | ||
| 70 | done | ||
| 71 | done | ||
| 72 | fi | ||
| 73 | |||
| 38 | # TODO: add tests for | 74 | # TODO: add tests for |
| 39 | # direct rendering, | 75 | # direct rendering, |
| 40 | # slices | ||
| 41 | # chains with feedback loops | 76 | # chains with feedback loops |
| 42 | 77 | ||
| 43 | rm -f "$bench" "$bench2" | 78 | rm -f "$bench" "$bench2" |
| @@ -0,0 +1,98 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2009 Stefano Sabatini | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include "libavformat/avformat.h" | ||
| 22 | #include "libavutil/pixdesc.h" | ||
| 23 | #include "libavfilter/avfilter.h" | ||
| 24 | |||
| 25 | int main(int argc, char **argv) | ||
| 26 | { | ||
| 27 | AVFilter *filter; | ||
| 28 | AVFilterContext *filter_ctx; | ||
| 29 | const char *filter_name; | ||
| 30 | const char *filter_args = NULL; | ||
| 31 | int i, j; | ||
| 32 | |||
| 33 | av_log_set_level(AV_LOG_DEBUG); | ||
| 34 | |||
| 35 | if (!argv[1]) { | ||
| 36 | fprintf(stderr, "Missing filter name as argument\n"); | ||
| 37 | return 1; | ||
| 38 | } | ||
| 39 | |||
| 40 | filter_name = argv[1]; | ||
| 41 | if (argv[2]) | ||
| 42 | filter_args = argv[2]; | ||
| 43 | |||
| 44 | avfilter_register_all(); | ||
| 45 | |||
| 46 | /* get a corresponding filter and open it */ | ||
| 47 | if (!(filter = avfilter_get_by_name(filter_name))) { | ||
| 48 | fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name); | ||
| 49 | return 1; | ||
| 50 | } | ||
| 51 | |||
| 52 | if (!(filter_ctx = avfilter_open(filter, NULL))) { | ||
| 53 | fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_name); | ||
| 54 | return 1; | ||
| 55 | } | ||
| 56 | if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) { | ||
| 57 | fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n", filter_name, filter_args); | ||
| 58 | return 1; | ||
| 59 | } | ||
| 60 | |||
| 61 | /* create a link for each of the input pads */ | ||
| 62 | for (i = 0; i < filter_ctx->input_count; i++) { | ||
| 63 | AVFilterLink *link = av_malloc(sizeof(AVFilterLink)); | ||
| 64 | filter_ctx->inputs[i] = link; | ||
| 65 | } | ||
| 66 | for (i = 0; i < filter_ctx->output_count; i++) { | ||
| 67 | AVFilterLink *link = av_malloc(sizeof(AVFilterLink)); | ||
| 68 | filter_ctx->outputs[i] = link; | ||
| 69 | } | ||
| 70 | |||
| 71 | if (filter->query_formats) | ||
| 72 | filter->query_formats(filter_ctx); | ||
| 73 | else | ||
| 74 | avfilter_default_query_formats(filter_ctx); | ||
| 75 | |||
| 76 | /* print the supported formats in input */ | ||
| 77 | for (i = 0; i < filter_ctx->input_count; i++) { | ||
| 78 | AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats; | ||
| 79 | |||
| 80 | printf("INPUT[%d] %s: ", i, filter_ctx->filter->inputs[i].name); | ||
| 81 | for (j = 0; j < fmts->format_count; j++) | ||
| 82 | printf("%s ", av_pix_fmt_descriptors[fmts->formats[j]].name); | ||
| 83 | printf("\n"); | ||
| 84 | } | ||
| 85 | |||
| 86 | /* print the supported formats in output */ | ||
| 87 | for (i = 0; i < filter_ctx->output_count; i++) { | ||
| 88 | AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats; | ||
| 89 | |||
| 90 | printf("OUTPUT[%d] %s: ", i, filter_ctx->filter->outputs[i].name); | ||
| 91 | for (j = 0; j < fmts->format_count; j++) | ||
| 92 | printf("%s ", av_pix_fmt_descriptors[fmts->formats[j]].name); | ||
| 93 | printf("\n"); | ||
| 94 | } | ||
| 95 | |||
| 96 | fflush(stdout); | ||
| 97 | return 0; | ||
| 98 | } | ||