Skip to content

Commit

Permalink
Merge pull request #21 from darkxex/master
Browse files Browse the repository at this point in the history
Interpolation moved to Image
  • Loading branch information
darkxex authored Feb 7, 2022
2 parents 89d8151 + c443846 commit 5b7fcfb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 70 deletions.
1 change: 0 additions & 1 deletion include/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ enum PLAYER_RIGHT_MENU_STATES {
PLAYER_RIGHT_MENU_TRACKS_AUDIO,
PLAYER_RIGHT_MENU_TRACKS_SUB,
PLAYER_RIGHT_MENU_CHAPTERS,
PLAYER_RIGHT_MENU_INTERPOLATION,
PLAYER_RIGHT_MENU_ARATIO,
PLAYER_RIGHT_MENU_CUSTOMARATIO,
PLAYER_RIGHT_MENU_IMAGE,
Expand Down
1 change: 0 additions & 1 deletion include/playerwindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ namespace playerWindows{
void RightTrackVideoWindow(bool *focus, bool *first_item);
void RightTrackAudioWindow(bool *focus, bool *first_item);
void RightTrackSubWindow(bool *focus, bool *first_item);
void RightHomeInterpolation(bool *focus, bool *first_item);
void RightHomeAnime4K(bool *focus, bool *first_item);
void RightHomeARatio(bool *focus, bool *first_item);
void RightHomeCustomARatio(bool *focus, bool *first_item);
Expand Down
106 changes: 44 additions & 62 deletions source/UI/playerWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace playerWindows{
rightmenuposX = item.rightmenu_startpos;
if(item.rightmenu_startpos>1080)item.rightmenu_startpos-=10;
playerWindows::SetupRightWindow();
std::vector<std::string> topmenu = {"Tracks","Chapters","Aspect Ratio","Interpolation","Image","Audio","Subtitle","ShaderMania","Anime4K v4.0.1"};
std::vector<std::string> topmenu = {"Tracks","Chapters","Aspect Ratio","Image","Audio","Subtitle","ShaderMania","Anime4K v4.0.1"};
if (ImGui::Begin("Right Menu Home", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollbar)) {
ImGui::SetNextWindowFocus();
if (ImGui::BeginListBox("Right Menu Home List",ImVec2(1280.0f, 720.0f))){
Expand All @@ -67,9 +67,6 @@ namespace playerWindows{
if(topmenu[n] == "Aspect Ratio"){
item.rightmenustate = PLAYER_RIGHT_MENU_ARATIO;
}
if(topmenu[n] == "Interpolation"){
item.rightmenustate = PLAYER_RIGHT_MENU_INTERPOLATION;
}
if(topmenu[n] == "Image"){
item.rightmenustate = PLAYER_RIGHT_MENU_IMAGE;
}
Expand Down Expand Up @@ -327,64 +324,6 @@ namespace playerWindows{
playerWindows::ExitWindow();
}

void RightHomeInterpolation(bool *focus, bool *first_item){
playerWindows::SetupRightWindow();
if (ImGui::Begin("Right Menu Sub", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollbar)) {
ImGui::PushItemWidth(200-10);
auto windowWidth = ImGui::GetWindowSize().x;
//New interpolation
ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Interpolation", NULL, true).x) * 0.5f);
ImGui::PushItemWidth(200-10);
ImGui::Text("Interpolation");
std::vector<std::string> intermenu = {"Deactivated","Catmull_Rom","Mitchell","Bicubic","OverSample"};
if (ImGui::BeginCombo("Interpolation", intermenu[interpolationidx].c_str(), 0))
{
for (int n = 0; n < intermenu.size(); n++)
{
const bool is_selected = (interpolationidx == n);
if (ImGui::Selectable(intermenu[n].c_str(), is_selected)){
if(n == 0){
interpolationidx = 0;
mpv_command_string(libmpv->getHandle(),"set video-sync audio ; set interpolation no ; show-text \"Interpolation: ${interpolation}\nVideoSync: ${video-sync}\"");
}
if(n == 1){
interpolationidx = 1;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale catmull_rom ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
if(n == 2){
interpolationidx = 2;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale mitchell ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
if(n == 3){
interpolationidx = 3;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale bicubic ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
if(n == 4){
interpolationidx = 4;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale oversample ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
}


if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
ImGui::PopItemWidth();
}
ImGui::SetCursorPosY(ImGui::GetWindowSize().y -50);
if(ImGui::Button("Reset to Default")){
interpolationidx = 0;
mpv_command_string(libmpv->getHandle(),"set video-sync audio ; set interpolation no ; show-text \"Interpolation: ${interpolation}\nVideoSync: ${video-sync}\"");

}
//end new interpolation


}
playerWindows::ExitWindow();

}
void RightHomeARatio(bool *focus, bool *first_item){
playerWindows::SetupRightWindow();
std::vector<std::string> topmenu = {"Default","16:9","16:10","4:3","Custom Ratio"};
Expand Down Expand Up @@ -534,6 +473,47 @@ namespace playerWindows{
}
ImGui::EndCombo();
}
//New interpolation
ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Interpolation", NULL, true).x) * 0.5f);
ImGui::PushItemWidth(200-10);
ImGui::Text("Interpolation");
std::vector<std::string> intermenu = {"No","Catmull_Rom","Mitchell","Bicubic","OverSample"};
if (ImGui::BeginCombo("Interpolation", intermenu[interpolationidx].c_str(), 0))
{
for (int n = 0; n < intermenu.size(); n++)
{
const bool is_selected = (interpolationidx == n);
if (ImGui::Selectable(intermenu[n].c_str(), is_selected)){
if(n == 0){
interpolationidx = 0;
mpv_command_string(libmpv->getHandle(),"set video-sync audio ; set interpolation no ; show-text \"Interpolation: ${interpolation}\nVideoSync: ${video-sync}\"");
}
if(n == 1){
interpolationidx = 1;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale catmull_rom ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
if(n == 2){
interpolationidx = 2;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale mitchell ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
if(n == 3){
interpolationidx = 3;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale bicubic ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
if(n == 4){
interpolationidx = 4;
mpv_command_string(libmpv->getHandle(),"set video-sync display-resample ; set interpolation yes ; set tscale oversample ; show-text \"Interpolation: ${interpolation}\nMethod: ${tscale}\nVideoSync: ${video-sync}\"");
}
}


if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
ImGui::PopItemWidth();
}
//end new interpolation


ImGui::PopItemWidth();
Expand All @@ -546,6 +526,8 @@ namespace playerWindows{
drag_gamma = 0;
drag_hue = 0;
rotateidx = 0;
interpolationidx = 0;
mpv_command_string(libmpv->getHandle(),"set video-sync audio ; set interpolation no ; show-text \"Interpolation: ${interpolation}\nVideoSync: ${video-sync}\"");
configini->setDeinterlace(configini->getDeinterlace(false));
libmpv->setDeinterlace(configini->getDeinterlace(false));
libmpv->setBrightness(drag_hue,false);
Expand Down
6 changes: 0 additions & 6 deletions source/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,6 @@ namespace GUI {
else if(item.rightmenustate == PLAYER_RIGHT_MENU_CHAPTERS){
item.rightmenustate = PLAYER_RIGHT_MENU_HOME;
}
else if(item.rightmenustate == PLAYER_RIGHT_MENU_INTERPOLATION){
item.rightmenustate = PLAYER_RIGHT_MENU_HOME;
}
else if(item.rightmenustate == PLAYER_RIGHT_MENU_ANIME4K){
item.rightmenustate = PLAYER_RIGHT_MENU_HOME;
}
Expand Down Expand Up @@ -902,9 +899,6 @@ namespace GUI {
case PLAYER_RIGHT_MENU_CHAPTERS:
playerWindows::RightChapterWindow(&item.rightmenu_focus,&item.rightmenu_first_item);
break;
case PLAYER_RIGHT_MENU_INTERPOLATION:
playerWindows::RightHomeInterpolation(&item.rightmenu_focus,&item.rightmenu_first_item);
break;
case PLAYER_RIGHT_MENU_ANIME4K:
playerWindows::RightHomeAnime4K(&item.rightmenu_focus,&item.rightmenu_first_item);
break;
Expand Down

0 comments on commit 5b7fcfb

Please sign in to comment.