Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st October 2016, 05:39   #1  |  Link
mkreddy.477
Murali
 
Join Date: Oct 2016
Posts: 3
Nvidia Cuda video decoder- Purpose of CUVIDMPEG4PICPARAMS and CUVIDH264PICPARAMS

When I am going through the NVIDIA Cuda decoder, the cuvidDecodePicture returns a pointer to CUVIDPICPARAMS. However the CUVIDPICPARAMS contains a union which holds two separate variables for CUVIDMPEG4PICPARAMS and CUVIDH264PICPARAMS.

When decoding H.264(AVC) video which structure should I use for the post processing?
mkreddy.477 is offline   Reply With Quote
Old 31st October 2016, 06:34   #2  |  Link
JohnLai
Registered User
 
Join Date: Mar 2008
Posts: 448
-.-...........Isn't CUVIDMPEG4PICPARAMS refer to MPEG4 ASP (Advanced Simple Profile)?

I believe that is your answer......

EDIT: MPEG4-ASP---> Ah....the previous era of XVID and Divx......before H264 becomes dominant....
EDIT2: Yeah, I saw you asking at many different forums....Just doesn't bother to reply....seeing you so persistent in getting answer....
EDIT3: What...you don't believe me? You ought to read the documentation once in a while.....

Last edited by JohnLai; 31st October 2016 at 06:40.
JohnLai is offline   Reply With Quote
Old 31st October 2016, 07:35   #3  |  Link
mkreddy.477
Murali
 
Join Date: Oct 2016
Posts: 3
Thank you very much for your reply JohnLai. I have the same thought as well. I keep posting the same question in different forums for clarification. I didn't find any answer except yours.

I need to calculate the quantization value for each picture. In ffmpeg this value was calculated using on qscale of each pixel in a macro block.

I want to know how can I implement the same using NVCUVID API.

Please help me in this regard.

Thanks in advance.
Murali Krishna
mkreddy.477 is offline   Reply With Quote
Old 31st October 2016, 08:42   #4  |  Link
JohnLai
Registered User
 
Join Date: Mar 2008
Posts: 448
Quote:
Originally Posted by mkreddy.477 View Post
Thank you very much for your reply JohnLai. I have the same thought as well. I keep posting the same question in different forums for clarification. I didn't find any answer except yours.

I need to calculate the quantization value for each picture. In ffmpeg this value was calculated using on qscale of each pixel in a macro block.

I want to know how can I implement the same using NVCUVID API.


Please help me in this regard.

Thanks in advance.
Murali Krishna
??? Let me get this straight on 'qscale' stuff on H264 (libx264)

https://trac.ffmpeg.org/wiki/Encode/MPEG-4
qscale only works with older generation of codec.

https://trac.ffmpeg.org/ticket/3238
According to ticket here....qscale doesn't work with libx264

https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=1203
Next, -qp (Constant Quantization Parameter) roughly analogous of mpeg4's -qscale for x264.

These days, we mostly use CRF (Constant rate factor) instead of CQP with libx264.

So.....based on your red question....are you trying to find out libx264 CRF average QP for I, P and B frame respectively so that you can map it to nvenc QP IPB?

On your blue question, in conjunction with red question, are you trying to ask if one can use "Variable Bit Rate with qscale"?
JohnLai is offline   Reply With Quote
Old 31st October 2016, 09:46   #5  |  Link
mkreddy.477
Murali
 
Join Date: Oct 2016
Posts: 3
Hello John,

Sorry I am not talking about the command line option of qscale in ffmpeg.

Please refer the below link about the H264Context Struct Reference.

https://www.ffmpeg.org/doxygen/2.4/s...64Context.html

This structure has a variable qscale and below link is about Picture Structure which has qscale_table.

https://www.ffmpeg.org/doxygen/3.1/structPicture.html

These variables were filled while decoding each pixel of a macro block (in fill_filter_caches method of h264.c )
mkreddy.477 is offline   Reply With Quote
Old 31st October 2016, 12:48   #6  |  Link
JohnLai
Registered User
 
Join Date: Mar 2008
Posts: 448
Nope, you can't do that with CUVID, it is too abstracted.

You want something like these:
Macroblock 121 (16x16)
slice 0
slice structure Frame
bits total 2
bits prediction 2
bits residuals 0
QP 7
skip_flag 1

Macroblock 13 (208x0)
slice 0
slice structure Frame
bits total 29
bits prediction 29
bits residuals 0
QP 12
skip_flag 0
Sub macroblock 3


Macroblock 249 (144x32)
slice 0
slice structure Frame
bits total 122
bits prediction 23
bits residuals 99
QP 6
skip_flag 0

Too bad you can't get those macroblock info using CUVID.
In ffmpeg software decoding, AVParser (the qscale) is used.
But in CUVID case, CUVIDPARSER is used, the problem is I don't think CUVIDPARSER doesn't have such functionality to 'extract' such info on the fly.


_CUVIDPARSERPARAMS

CUVIDEOFORMATEX *pExtVideoInfo; /**< [Optional] sequence header data from system layer */

* Video Signal Description
*/
struct {
unsigned char video_format : 3;
unsigned char video_full_range_flag : 1;
unsigned char reserved_zero_bits : 4;
unsigned char color_primaries;
unsigned char transfer_characteristics;
unsigned char matrix_coefficients;
} video_signal_description;
unsigned int seqhdr_data_length; /**< Additional bytes following (CUVIDEOFORMATEX) */
} CUVIDEOFORMAT;

/*!
* \struct CUVIDEOFORMATEX
* Video format including raw sequence header information
*/

typedef struct
{
CUVIDEOFORMAT format;
unsigned char raw_seqhdr_data[1024];
} CUVIDEOFORMATEX;

Maybe you could extract all sequence header data instead and see if it contain QP data as per SDK info above?

Last edited by JohnLai; 31st October 2016 at 12:57.
JohnLai is offline   Reply With Quote
Reply

Tags
ffmpegsource, h264 decoder


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:04.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.