[Libav-user] MJPEG Quantization tables

Виктор Мулин 17sep96 at gmail.com
Tue May 19 11:53:36 EEST 2020


I tried the following before opening the encoder:
codec_context-> intra_matrix = (uint16_t *) std_luminance_quant_tbl;
codec_context-> croma_intra_matrix = (uint16_t *) std_crominance_quant_tbl;
The picture has acquired a blue tint. When packet was written to a file,
DQT tables were not added to the file.
Questions remain open:
1) How to force a codec to use two standard DQT tables (JPEG ISO / IEC
10918-1 ITU-T recomendation T.81 Annex K.1 and K.2)
2) How to make the codec add both DQT tables to paccket->data, then save
packet->data to a jpg file?

пн, 18 мая 2020 г. в 23:16, Richard Hussong <rhussong at westpond.com>:

> Sorry, but I've never modified those values myself and I don't know how
> they work. I think you'll have to read the source code for the JPEG encoder
> to find out.
>
> - Richard
>
> On Mon, May 18, 2020 at 1:37 PM Виктор Мулин <17sep96 at gmail.com> wrote:
>
>> Thanks for the answer.
>> intra_matrix and inter_matrix are of type uint16_t, and tables from
>> jpegtables.c are of type uint8_t. What to do? Make a cast of uint8_t * to
>> uint16_t * or define a new array of type uint16_t by filling it with values
>> from standard tables?
>> Will these tables be added to the output file automatically after I
>> specify array references in the AVCodecContext structure?
>>
>> пн, 18 мая 2020 г. в 19:54, Richard Hussong <rhussong at westpond.com>:
>>
>>>
>>>
>>> On Mon, May 18, 2020 at 7:38 AM Виктор Мулин <17sep96 at gmail.com> wrote:
>>>
>>>> Hello! When using the mjpeg codec to convert an image from bmp to jpg
>>>> format, a picture with one quantization table is created. I need two
>>>> standard tables described in the jpeg iso / iec 10918-1 T.81 standard in
>>>> Appendix K.1 and K.2 to be added to the output image file. I also found
>>>> them in the ffmpeg source codes (jpegtables.c -> std_luminance_quant_tbl
>>>> and jpegtables.c -> std_chrominance_quant_tbl [url:
>>>> https://ffmpeg.org/doxygen/trunk/jpegtables_8c_source.html]. I looked
>>>> through the mailing list archive and found old solutions (
>>>> https://ffmpeg.org/pipermail/libav-user/2015-July/008318.html), but
>>>> now the av_codec_set_chroma_intra_matrix () function is declared
>>>> depricated. How do I get what I want? How to set intra_matrix,
>>>> chroma_intra_matrix and inter_matrix (in the description they are almost
>>>> the same)?
>>>>
>>>
>>> The intra_matrix and inter_matrix can now be set directly in the
>>> AVCodecContext structure. See
>>> https://ffmpeg.org/doxygen/trunk/structAVCodecContext.html, and search
>>> for "intra_matrix" and "inter_matrix".
>>>
>>> P.S .: Sorry, I don't speak English well. I use google translator.
>>>>
>>>
>>> Don't worry - what you wrote is clear enough.
>>>
>>>> _______________________________________________
>>>> Libav-user mailing list
>>>> Libav-user at ffmpeg.org
>>>> https://ffmpeg.org/mailman/listinfo/libav-user
>>>>
>>>> To unsubscribe, visit link above, or email
>>>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>>>
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>> To unsubscribe, visit link above, or email
>>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/libav-user
>>
>> To unsubscribe, visit link above, or email
>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200519/8df9a6d0/attachment.html>


More information about the Libav-user mailing list