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

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th August 2015, 17:10   #1  |  Link
KAnthony
Registered User
 
Join Date: Mar 2015
Posts: 3
X264 Horizontal Rips on i_threads> 1

I'm trying to write an x264 encoder. However, I cannot set i_threads to anything greater then 1 and still get a usable picture out.

My Settings
Code:
Preset                  : veryfast
Tune                    : zerolatency
Profile                 : high
i_width                 : 1920
i_height                : 1080
i_fps_num               : 25
i_fps_den               : 1
i_timebase_num          : 1
i_timebase_den          : 1000
i_keyint_max            : 32
b_repeat_headers        : 1
b_annexb                : 1
b_intra_refresh         : 1
b_aud                   : 1
b_open_gop              : 1

RC:
i_rc_method             : X264_RC_ABR
i_bitrate               : 5120
i_vbv_buffer_size       : 5120
i_vbv_max_bitrate       : 5120 * 1.1
i_qp_constant           : 20
f_qblur                 : .5 
f_complexity_blur       : 20

Analyse:
i_me_method             : X264_ME_UMH
i_subpel_refine         : 7
i_me_range              : 16
b_psnr                  : 0
b_ssim                  : 0
i_noise_reduction       : 2
inter                   : X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8 | X264_ANALYSE_PSUB16x16


i_threads = 1:
http://tinypic.com/player.php?v=14xd...8#.VdNUyPlVhBc

i_threads = 2:
http://tinypic.com/player.php?v=b7ex...8#.VdNWyvlVhBc

What could be causing this?
KAnthony is offline   Reply With Quote
Old 18th August 2015, 20:02   #2  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
How are you calling x264? Via command-line or via API, and what exact arguments? What input are you giving it and how? Hopefully that can help narrow it down.
foxyshadis is offline   Reply With Quote
Old 18th August 2015, 20:12   #3  |  Link
KAnthony
Registered User
 
Join Date: Mar 2015
Posts: 3
API's, the input is a bitmap buffer I fill manually every 5 frames
That is exactly the parameters I am using.

Code:
    static int count = 0;
    static int one;
    if (count % (TARGET_FPS / 2) == 0) {
        one = rand() % 8;
    }
    int two, three;
    do {
        two = rand() % 8;
    } while (two == one);
    do {
        three = rand() % 8;
    } while (three == one || three == two);
    COLORREF* colorBuffer = reinterpret_cast<COLORREF*>(buffer);
    COLORREF background = GetColor(one);
    COLORREF lineOneInnerColor = GetColor(two);
    COLORREF lineOneOuterColor = GetColor(three);
    COLORREF lineTwoColor = GetColor(three);
    COLORREF lineThreeColor = GetColor(three);
    if (count % (TARGET_FPS / 5) == 0) {
        for (int i = 0; i < DEFAULT_WIDTH * DEFAULT_HEIGHT; ++i) {
            colorBuffer[i] = background;
        }
        for (int i = 0; i < LineOneOuterLength; ++i) {
            PIXELLOCATION p = LineOneOuter[i];
            int index = p.Y * DEFAULT_WIDTH + p.X;
            colorBuffer[index] = lineOneOuterColor;
        }
        for (int i = 0; i < LineOneInnerLength; ++i) {
            PIXELLOCATION p = LineOneInner[i];
            int index = p.Y * DEFAULT_WIDTH + p.X;
            colorBuffer[index] = lineOneInnerColor;
        }
        for (int i = 0; i < LineTwoLength; ++i) {
            PIXELLOCATION p = LineTwo[i];
            int index = p.Y * DEFAULT_WIDTH + p.X;
            colorBuffer[index] = lineTwoColor;
        }
        for (int i = 0; i < LineThreeLength; ++i) {
            PIXELLOCATION p = LineThree[i];
            int index = p.Y * DEFAULT_WIDTH + p.X;
            colorBuffer[index] = lineThreeColor;
        }
    }
    count++;
and this is how i'm encoding the picture
Code:
::avpicture_fill(&picRaw, static_cast<uint8_t*>(bufferIn), AV_PIX_FMT_RGB32, iWidthIn, iHeightIn);
::sws_scale(sws, picRaw.data, picRaw.linesize, 0, iHeightIn, picIn.img.plane, picIn.img.i_stride);
picIn.i_pts = static_cast<int64_t>(mi_pts);
picIn.i_type = X264_TYPE_AUTO;

::x264_encoder_encode(pEncoder, &pNals, &iNalCount, picIn, &picOut);
memcpy(bufferOut, pNals[0].p_payload, i_frame_size);
I stripped out a lot of the error checking
KAnthony is offline   Reply With Quote
Reply

Tags
x264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:43.


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