Skip to content

Commit

Permalink
Revert "Use "rav1e" if available as default ("auto") avif encoder"
Browse files Browse the repository at this point in the history
This reverts commit ddc8e7e.
  • Loading branch information
fdintino committed Dec 17, 2024
1 parent b585f9e commit da2e18d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/handbook/image-file-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
YUV range, either "full" or "limited". Defaults to "full"

**codec**
AV1 codec to use for encoding. Specific values are "rav1e", "aom", and
AV1 codec to use for encoding. Specific values are "aom", "rav1e", and
"svt", presuming the chosen codec is available. Defaults to "auto", which
will choose the first available codec in the order of the preceding list.

Expand Down
10 changes: 1 addition & 9 deletions src/_avif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <Python.h>
#include "avif/avif.h"

static int have_rav1e = 0;

typedef struct {
avifPixelFormat subsampling;
int qmin;
Expand Down Expand Up @@ -361,11 +359,7 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
enc_options.speed = speed;

if (strcmp(codec, "auto") == 0) {
if (have_rav1e) {
enc_options.codec = AVIF_CODEC_CHOICE_RAV1E;
} else {
enc_options.codec = AVIF_CODEC_CHOICE_AUTO;
}
enc_options.codec = AVIF_CODEC_CHOICE_AUTO;
} else {
enc_options.codec = avifCodecChoiceFromName(codec);
}
Expand Down Expand Up @@ -1011,8 +1005,6 @@ setup_module(PyObject *m) {
PyDict_SetItemString(d, "libavif_version", v ? v : Py_None);
Py_XDECREF(v);

have_rav1e = _codec_available("rav1e", AVIF_CODEC_FLAG_CAN_ENCODE);

return 0;
}

Expand Down

0 comments on commit da2e18d

Please sign in to comment.