[Libav-user] MJPEG Quantization tables

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] MJPEG Quantization tables

Виктор Мулин
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)?
P.S .: Sorry, I don't speak English well. I use google translator.

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: MJPEG Quantization tables

Richard Hussong


On Mon, May 18, 2020 at 7:38 AM Виктор Мулин <[hidden email]> 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
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: MJPEG Quantization tables

Виктор Мулин
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 <[hidden email]>:


On Mon, May 18, 2020 at 7:38 AM Виктор Мулин <[hidden email]> 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
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: MJPEG Quantization tables

Richard Hussong
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 Виктор Мулин <[hidden email]> 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 <[hidden email]>:


On Mon, May 18, 2020 at 7:38 AM Виктор Мулин <[hidden email]> 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
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: MJPEG Quantization tables

Виктор Мулин
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 <[hidden email]>:
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 Виктор Мулин <[hidden email]> 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 <[hidden email]>:


On Mon, May 18, 2020 at 7:38 AM Виктор Мулин <[hidden email]> 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
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: MJPEG Quantization tables

Виктор Мулин
Sorry, the information that the picture has acquired blue shades is false!

вт, 19 мая 2020 г. в 11:53, Виктор Мулин <[hidden email]>:
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 <[hidden email]>:
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 Виктор Мулин <[hidden email]> 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 <[hidden email]>:


On Mon, May 18, 2020 at 7:38 AM Виктор Мулин <[hidden email]> 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
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".